Skip to content
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

add tests for bottom step button #1387

Merged
merged 2 commits into from
Jan 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions test/ui-2/test/DropDownButtonStep.test.js
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);
});