Skip to content

Commit

Permalink
Merge pull request #11 from Shulammite-Aso/ui-tests
Browse files Browse the repository at this point in the history
setup jest-puppeteer for UI test
  • Loading branch information
jywarren authored Jul 12, 2020
2 parents cf059e7 + c4e2139 commit c197016
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- '10'
- '12'
pre_script: npm run build
7 changes: 7 additions & 0 deletions jest-puppeteer.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
launch: {
headless: process.env.HEADLESS !== 'false',
slowMo: process.env.SLOWMO ? process.env.SLOWMO : 0,
devtools: true
}
}
10 changes: 10 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
globals: {
URL: "http://localhost:8080"
},
preset: "jest-puppeteer",
testMatch: [
"**/tests/**/*.test.js"
],
verbose: true,
};
14 changes: 14 additions & 0 deletions test/ui-tests/title.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const timeout = process.env.SLOWMO ? 60000 : 10000;
const fs = require('fs');
beforeAll(async () => {
path = fs.realpathSync('file://../index.html');
await page.goto('file://' + path, {waitUntil: 'domcontentloaded'});
});

describe('Title of the page', () => {
test('Title of the page', async () => {
const title = await page.title();
expect(title).toBe('woofmark');

}, timeout);
});

0 comments on commit c197016

Please sign in to comment.