-
Notifications
You must be signed in to change notification settings - Fork 12
Add continuous integration #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BackdoorTech
wants to merge
2
commits into
maxgaurav:version/4.0
Choose a base branch
from
BackdoorTech:feature/ci-cd
base: version/4.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
PUPPETEER_PORT = 8090 | ||
PUPPETEER_OPEN_CHROME = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: CI | ||
on: [push] | ||
jobs: | ||
build: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: borales/actions-yarn@v2.3.0 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
# with: | ||
# node-version: ${{ matrix.node-version }} | ||
# cache: 'npm' | ||
#- run: yarn install --frozen-lockfile | ||
- run: cp .env.example .env && yarn test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
/dist | ||
.DS_Store | ||
dist/es2015/tsconfig.tsbuildinfo | ||
.env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// jest-puppeteer.config.js | ||
require('dotenv').config() | ||
|
||
const openChrome = process.env.PUPPETEER_OPEN_CHROME | ||
const port = process.env.PUPPETEER_PORT | ||
|
||
module.exports = { | ||
server: { | ||
command: `http-server -a 127.0.0.1 --port ${port} ./`, | ||
port: port, | ||
launchTimeout: 5000 | ||
}, | ||
launch: { | ||
dumpio: true, | ||
headless: openChrome != 'true', | ||
product: 'chrome', | ||
args: [`--window-size=1200,1080`], | ||
defaultViewport: { | ||
width:1200, | ||
height:1080 | ||
}, | ||
// executablePath: chromPath | ||
}, | ||
browserContext: 'default', | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
"roots": [ | ||
"<rootDir>/test" | ||
], | ||
"testMatch": [ | ||
"**/__tests__/**/*.+(ts|tsx|js)", | ||
"**/?(*.)+(spec|test).+(ts|tsx|js)" | ||
], | ||
"transform": { | ||
"^.+\\.(ts|tsx)$": "ts-jest" | ||
}, | ||
// "globalSetup": "<rootDir>/test/setupJest.ts", | ||
preset: 'jest-puppeteer', | ||
// setupFilesAfterEnv: "<rootDir>/test/setupJest.ts", | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
import {Model as ModelType} from '../../src/index' | ||
import {Connector as ConnectorType} from '../../src/index' | ||
import {RelationTypes as _RelationTypes} from '../../src/index' | ||
import { ModelKeysInterface } from '../../src/models/model.interface' | ||
const port = process.env.PUPPETEER_PORT | ||
|
||
|
||
describe('simple model', () => { | ||
beforeAll(async () => { | ||
await page.goto(`http://127.0.0.1:${port}/example/index.html`) | ||
}) | ||
|
||
it('Create model with one attribute that is unique', async () => { | ||
|
||
// wait for variables to be present in the dom | ||
await page.waitForFunction(() => 'Connector' in window); | ||
await page.waitForFunction(() => 'Model' in window); | ||
await page.waitForFunction(() => 'RelationTypes' in window); | ||
|
||
await page.evaluate(() => { | ||
const Connector: typeof ConnectorType = window['Connector'] | ||
const Model: typeof ModelType = window['Model'] | ||
const RelationTypes: typeof _RelationTypes = window['RelationTypes'] | ||
|
||
const a = new Connector({ | ||
tables: [{ | ||
name: 'admin', | ||
columns: [{ | ||
name: 'email', | ||
attributes: { | ||
unique: true | ||
} | ||
}] | ||
}], | ||
name: 'sample-test', | ||
version: 1 | ||
}); | ||
|
||
a.connect().then(async (models:ModelKeysInterface) => { | ||
console.log(a, models); | ||
|
||
// list the tables in th page | ||
document.body.innerHTML = 'tables :'+JSON.stringify(Object.keys(models)) | ||
}); | ||
|
||
}) | ||
|
||
// await until the page has a visitable text 'admin' | ||
await page.waitForFunction(() => 'admin'); | ||
|
||
expect('time not exceeded').toBe('time not exceeded') | ||
}, 20000) | ||
}) | ||
|
||
|
||
|
||
|
||
|
||
describe('complex model', () => { | ||
beforeAll(async () => { | ||
await page.goto(`http://127.0.0.1:${port}/example/index.html`) | ||
}) | ||
|
||
it('Check dom variables', async () => { | ||
|
||
await page.waitForFunction(() => 'conn' in window); | ||
|
||
expect('time not exceeded').toBe('time not exceeded') | ||
}, 20000) | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const port = process.env.PUPPETEER_PORT | ||
|
||
describe('page Load', () => { | ||
beforeAll(async () => { | ||
await page.goto(`http://127.0.0.1:${port}/example/index.html`) | ||
}) | ||
|
||
it('Check dom variables', async () => { | ||
|
||
await page.waitForFunction(() => 'conn' in window); | ||
|
||
expect('time not exceeded').toBe('time not exceeded') | ||
}, 10000) | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { mergeDeep } from './../../../src/utils' | ||
|
||
describe('utils.js', () => { | ||
|
||
|
||
it('test function mergeDeep', async () => { | ||
|
||
let Person = { | ||
age: 18 | ||
} | ||
|
||
let Car = { | ||
Name: 'porsche' | ||
} | ||
|
||
expect(JSON.stringify(mergeDeep(Person, Car))).toBe(JSON.stringify({age: 18,Name:'porsche'})) | ||
}) | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.