Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #21 from 340CT-1920SEPJAN/develop
Develop
- Loading branch information
Showing
7 changed files
with
73 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 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 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,60 @@ | ||
/* eslint-disable max-len */ | ||
'use strict' | ||
|
||
const puppeteer = require('puppeteer') | ||
const { configureToMatchImageSnapshot } = require('jest-image-snapshot') | ||
const width = 800 | ||
const height = 600 | ||
const delayMS = 100 | ||
const shell = require('shelljs') | ||
|
||
let browser | ||
let page | ||
|
||
// threshold is the difference in pixels before the snapshots dont match | ||
const toMatchImageSnapshot = configureToMatchImageSnapshot({ | ||
customDiffConfig: { threshold: 2 }, | ||
noColors: true, | ||
}) | ||
expect.extend({ toMatchImageSnapshot }) | ||
|
||
beforeAll( async() => { | ||
browser = await puppeteer.launch({ headless: true, slowMo: delayMS, args: [`--window-size=${width},${height}`, '--no-sandbox'] }) | ||
page = await browser.newPage() | ||
await page.setViewport({ width, height }) | ||
}) | ||
|
||
beforeEach( () => shell.exec('./abolishDB.sh')) | ||
|
||
afterAll( () => browser.close() ) | ||
|
||
describe('menu', () => { | ||
|
||
test('Main Menu', async done => { | ||
|
||
jest.setTimeout(30000) | ||
|
||
await page.goto('http://localhost:8080/login', { timeout: 30000, waitUntil: 'load' }) | ||
await page.goto('http://localhost:8080/login', { timeout: 30000, waitUntil: 'load' }) | ||
|
||
await page.click('[href="/register"]') | ||
|
||
await page.select('select[name=auth]', 'Kitchen') | ||
await page.type('input[name=user]', 'Craig') | ||
await page.type('input[name=pass]', 'bread') | ||
|
||
await page.click('input[type=submit]') | ||
|
||
await page.type('input[name=user]', 'Craig') | ||
await page.type('input[name=pass]', 'bread') | ||
|
||
await page.click('input[type=submit]') | ||
|
||
await page.click('button[name=Order]') | ||
const title = await page.title() | ||
expect(title).toBe('Main Menu') | ||
|
||
done() | ||
|
||
}) | ||
}) |
This file contains 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 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 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 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