fix(test): rsolve race conditions with toast and item

This commit is contained in:
Liam DeBeasi
2019-06-12 11:41:26 -04:00
parent 320719b904
commit b85b7c6b9d
2 changed files with 10 additions and 5 deletions

View File

@ -15,8 +15,10 @@ test('item: inputs', async () => {
expect(compare).toMatchScreenshot(); expect(compare).toMatchScreenshot();
// Disable everything // Disable everything
await page.click('#btnDisabled'); const disableToggle = await page.find('#btnDisabled');
await page.waitFor(500); await disableToggle.waitForVisible();
await disableToggle.click();
await page.waitFor(100);
// check form // check form
await page.click('#submit'); await page.click('#submit');
@ -28,7 +30,7 @@ test('item: inputs', async () => {
expect(compare).toMatchScreenshot(); expect(compare).toMatchScreenshot();
// Reenable and set some value // Reenable and set some value
await page.click('#btnDisabled'); await disableToggle.click();
await page.click('#btnSomeValue'); await page.click('#btnSomeValue');
await page.waitFor(100); await page.waitFor(100);
@ -64,5 +66,6 @@ test('item: inputs', async () => {
async function checkFormResult(page: E2EPage, content: string) { async function checkFormResult(page: E2EPage, content: string) {
const div = await page.find('#form-result'); const div = await page.find('#form-result');
expect(div.textContent).toEqual(content); expect(div.textContent).toEqual(content);
} }

View File

@ -16,10 +16,12 @@ export async function testToast(
const screenshotCompares = []; const screenshotCompares = [];
await page.click(selector); const button = await page.find(selector);
await page.waitForSelector(selector); await button.waitForVisible();
await button.click();
let toast = await page.find('ion-toast'); let toast = await page.find('ion-toast');
await toast.waitForVisible();
expect(toast).not.toBe(null); expect(toast).not.toBe(null);
await toast.waitForVisible(); await toast.waitForVisible();