test(config): tests now fail fast (#26447)

This commit is contained in:
Liam DeBeasi
2022-12-08 16:25:50 -05:00
committed by GitHub
parent 1aa1068df7
commit 7ba2b65b54
8 changed files with 32 additions and 17 deletions

View File

@ -85,7 +85,10 @@ const config: PlaywrightTestConfig = {
},
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
/* Fail fast on CI */
maxFailures: process.env.CI ? 1 : 0,
/* Flaky test should be either addressed or disabled until we can address them */
retries: 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */

View File

@ -304,10 +304,13 @@ test.describe('datetime: visibility', () => {
await datetime.evaluate((el: HTMLIonDatetimeElement) => el.style.setProperty('display', 'none'));
await expect(datetime).toBeHidden();
await expect(datetime).not.toHaveClass(/datetime-ready/);
await datetime.evaluate((el: HTMLIonDatetimeElement) => el.style.removeProperty('display'));
await expect(datetime).toBeVisible();
await page.waitForSelector('.datetime-ready');
// month/year interface should be reset
await expect(monthYearInterface).toBeHidden();
});

View File

@ -159,9 +159,10 @@ class TimePickerFixture {
}
async goto() {
await this.page.goto(`/src/components/datetime/test/presentation`);
await this.page.locator('select').selectOption('time');
await this.page.waitForSelector('.datetime-presentation-time');
await this.page.setContent(`
<ion-datetime presentation="time" value="2022-03-10T13:00:00"></ion-datetime>
`);
await this.page.waitForSelector('.datetime-ready');
this.timePicker = this.page.locator('ion-datetime');
}

View File

@ -40,7 +40,8 @@ test.describe('item-sliding: basic', () => {
expect(await item.screenshot()).toMatchSnapshot(`item-sliding-gesture-${page.getSnapshotSettings()}.png`);
});
test('should not scroll when the item-sliding is swiped', async ({ page, skip }) => {
// TODO FW-3006
test.skip('should not scroll when the item-sliding is swiped', async ({ page, skip }) => {
skip.browser('webkit', 'mouse.wheel is not available in WebKit');
skip.rtl();

View File

@ -2,7 +2,8 @@ import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('item-sliding: scroll-target', () => {
test('should not scroll when the item-sliding is swiped in custom scroll target', async ({ page, skip }) => {
// TODO FW-3006
test.skip('should not scroll when the item-sliding is swiped in custom scroll target', async ({ page, skip }) => {
skip.browser('webkit', 'mouse.wheel is not available in WebKit');
skip.rtl();

View File

@ -60,7 +60,7 @@ test.describe('picker-column-internal: disabled', () => {
`);
const disabledItem = page.locator('ion-picker-column-internal .picker-item.picker-item-disabled');
expect(disabledItem).not.toBeEnabled();
await expect(disabledItem).not.toBeEnabled();
});
test('disabled picker item should not be considered active', async ({ page }) => {
await page.setContent(`
@ -79,7 +79,7 @@ test.describe('picker-column-internal: disabled', () => {
`);
const disabledItem = page.locator('ion-picker-column-internal .picker-item[data-value="b"]');
expect(disabledItem).not.toHaveClass(/picker-item-active/);
await expect(disabledItem).not.toHaveClass(/picker-item-active/);
});
test('setting the value to a disabled item should not cause that item to be active', async ({ page }) => {
await page.setContent(`
@ -103,8 +103,8 @@ test.describe('picker-column-internal: disabled', () => {
await page.waitForChanges();
const disabledItem = page.locator('ion-picker-column-internal .picker-item[data-value="b"]');
expect(disabledItem).toHaveClass(/picker-item-disabled/);
expect(disabledItem).not.toHaveClass(/picker-item-active/);
await expect(disabledItem).toHaveClass(/picker-item-disabled/);
await expect(disabledItem).not.toHaveClass(/picker-item-active/);
});
test('defaulting the value to a disabled item should not cause that item to be active', async ({ page }) => {
await page.setContent(`
@ -124,7 +124,7 @@ test.describe('picker-column-internal: disabled', () => {
`);
const disabledItem = page.locator('ion-picker-column-internal .picker-item[data-value="b"]');
expect(disabledItem).toHaveClass(/picker-item-disabled/);
expect(disabledItem).not.toHaveClass(/picker-item-active/);
await expect(disabledItem).toHaveClass(/picker-item-disabled/);
await expect(disabledItem).not.toHaveClass(/picker-item-active/);
});
});

View File

@ -1,3 +1,4 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('tap click utility', () => {
@ -14,8 +15,9 @@ test.describe('tap click utility', () => {
if (box) {
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
await page.mouse.down();
await page.waitForChanges();
}
await page.waitForSelector('button.ion-activated');
await expect(button).toHaveClass(/ion-activated/);
});
});

View File

@ -113,22 +113,26 @@ test.describe('overlays: focus', () => {
<ion-button id="open-modal">Show Modal</ion-button>
<ion-modal trigger="open-modal">
<ion-content>
<ion-input autofocus="true"></ion-input>
<input />
</ion-content>
</ion-modal>
`);
const ionModalDidPresent = await page.spyOnEvent('ionModalDidPresent');
const ionModalWillPresent = await page.spyOnEvent('ionModalWillPresent');
const button = page.locator('ion-button');
const input = page.locator('ion-input');
const input = page.locator('input');
await button.click();
await input.evaluate((el: HTMLIonInputElement) => el.setFocus());
await ionModalWillPresent.next();
await input.evaluate((el: HTMLInputElement) => el.focus());
await ionModalDidPresent.next();
await page.waitForChanges();
await expect(page.locator('ion-input input')).toBeFocused();
await expect(input).toBeFocused();
});
test('should not select a hidden focusable element', async ({ page, browserName }) => {