forked from jywarren/image-sequencer
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c370a8b
commit b301209
Showing
1 changed file
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const timeout = process.env.SLOWMO ? 30000 : 10000; | ||
const fs = require('fs'); | ||
beforeAll(async () => { | ||
path = fs.realpathSync('file://../examples/index.html'); | ||
await page.goto('file://' + path, {waitUntil: 'domcontentloaded'}); | ||
}); | ||
describe('Add step dropdown', ()=>{ | ||
test('Click Button', async()=>{ | ||
// Wait for .step to load | ||
await page.waitForSelector('.step'); | ||
/// Get Length Of steps | ||
const Length = await page.evaluate(() => document.querySelectorAll('.step').length); | ||
|
||
// Wait for .selectize-input to load | ||
await page.waitForSelector('.selectize-input'); | ||
// Click dropdown and select appropriate option. then submit | ||
await page.click('.selectize-input'); | ||
await page.click('[data-value=\'blend\']'); | ||
await page.waitForSelector('#add-step-btn'); | ||
await page.click('#add-step-btn'); | ||
|
||
// Get Changed Length | ||
const LengthChanged = await page.evaluate(() => document.querySelectorAll('.step').length); | ||
|
||
// Check If Image Of Step actually Changed | ||
await page.waitForSelector('.step img'); | ||
const src1 = await page.evaluate(() => document.querySelectorAll('.step img')[0].src); | ||
const src2 = await page.evaluate(() => document.querySelectorAll('.step img')[1].src); | ||
expect(src1).not.toEqual(src2); | ||
|
||
expect(Length).toBe(1); | ||
expect(LengthChanged).toBe(2); | ||
|
||
}, timeout); | ||
}); |