test(item-sliding): re-enable flaky tests (#28192)
Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Some of the tests for `item-sliding` were being skipped due to flakiness. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Updated the tests to use the stable function, `dragElementBy` to handle gestures, removing the gesture flakiness. - Separated the basic test to lessen the gesture complexity else it becomes flaky since it can't handle opening and closing and opening in the same test. - Tests are now checking all modes and all directions. - Updated a utils function with a warning regarding an open issue with RTL. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> N/A --------- Co-authored-by: ionitron <hi@ionicframework.com> Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
@ -1,18 +1,53 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, dragElementBy, test } from '@utils/test/playwright';
|
||||
|
||||
import { testSlidingItem } from '../test.utils';
|
||||
|
||||
/**
|
||||
* item-sliding doesn't have mode-specific styling
|
||||
* item-sliding doesn't have mode-specific styling,
|
||||
* but the child components, item-options and item-option, do.
|
||||
*
|
||||
* It is important to test all modes to ensure that the
|
||||
* child components are being rendered correctly.
|
||||
*/
|
||||
configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
|
||||
configs().forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('item-sliding: basic'), () => {
|
||||
test.fixme('should not have visual regressions', async ({ page }) => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(`/src/components/item-sliding/test/basic`, config);
|
||||
});
|
||||
test.describe('start options', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
const item = page.locator('#item2');
|
||||
|
||||
await testSlidingItem(page, 'item2', 'start', screenshot, true);
|
||||
await testSlidingItem(page, 'item2', 'end', screenshot);
|
||||
/**
|
||||
* Negative dragByX value to drag element from the right to the left
|
||||
* to reveal the options on the right side.
|
||||
* Positive dragByX value to drag element from the left to the right
|
||||
* to reveal the options on the left side.
|
||||
*/
|
||||
const dragByX = config.direction === 'rtl' ? -150 : 150;
|
||||
|
||||
await dragElementBy(item, page, dragByX);
|
||||
await page.waitForChanges();
|
||||
|
||||
await expect(item).toHaveScreenshot(screenshot('item-sliding-start'));
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('end options', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
const item = page.locator('#item2');
|
||||
|
||||
/**
|
||||
* Negative dragByX value to drag element from the right to the left
|
||||
* to reveal the options on the right side.
|
||||
* Positive dragByX value to drag element from the left to the right
|
||||
* to reveal the options on the left side.
|
||||
*/
|
||||
const dragByX = config.direction === 'rtl' ? 150 : -150;
|
||||
|
||||
await dragElementBy(item, page, dragByX);
|
||||
|
||||
await expect(item).toHaveScreenshot(screenshot('item-sliding-end'));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
@ -1,19 +1,36 @@
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test, dragElementBy } from '@utils/test/playwright';
|
||||
|
||||
import { testSlidingItem } from '../test.utils';
|
||||
|
||||
// TODO FW-3006
|
||||
/**
|
||||
* item-sliding doesn't have mode-specific styling
|
||||
* item-sliding doesn't have mode-specific styling,
|
||||
* but the child components, item-options and item-option, do.
|
||||
*
|
||||
* It is important to test all modes to ensure that the
|
||||
* child components are being rendered correctly.
|
||||
*/
|
||||
configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe.skip(title('item-sliding: icons'), () => {
|
||||
configs().forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('item-sliding: icons'), () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto(`/src/components/item-sliding/test/icons`, config);
|
||||
|
||||
const itemIDs = ['iconsOnly', 'iconsStart', 'iconsEnd', 'iconsTop', 'iconsBottom'];
|
||||
for (const itemID of itemIDs) {
|
||||
await testSlidingItem(page, itemID, itemID, screenshot);
|
||||
const item = page.locator(`#${itemID}`);
|
||||
|
||||
/**
|
||||
* Negative dragByX value to drag element from the right to the left
|
||||
* to reveal the options on the right side.
|
||||
* Positive dragByX value to drag element from the left to the right
|
||||
* to reveal the options on the left side.
|
||||
*/
|
||||
const dragByX = config.direction === 'rtl' ? 150 : -150;
|
||||
|
||||
await dragElementBy(item, page, dragByX);
|
||||
await page.waitForChanges();
|
||||
|
||||
// Convert camelCase ids to kebab-case for screenshot file names
|
||||
const itemIDKebab = itemID.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
||||
await expect(item).toHaveScreenshot(screenshot(`item-sliding-${itemIDKebab}`));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
@ -1,12 +1,11 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
import { configs, test, dragElementBy } from '@utils/test/playwright';
|
||||
/**
|
||||
* This behavior does not vary across modes/directions
|
||||
*/
|
||||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('item-sliding: scroll-target'), () => {
|
||||
// TODO FW-3006
|
||||
test.skip('should not scroll when the item-sliding is swiped in custom scroll target', async ({ page, skip }) => {
|
||||
test('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');
|
||||
|
||||
await page.goto(`/src/components/item-sliding/test/scroll-target`, config);
|
||||
@ -16,13 +15,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
||||
|
||||
expect(await scrollEl.evaluate((el: HTMLElement) => el.scrollTop)).toEqual(0);
|
||||
|
||||
const box = (await itemSlidingEl.boundingBox())!;
|
||||
const centerX = box.x + box.width / 2;
|
||||
const centerY = box.y + box.height / 2;
|
||||
|
||||
await page.mouse.move(centerX, centerY);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(centerX - 30, centerY);
|
||||
await dragElementBy(itemSlidingEl, page, -150, 0, undefined, undefined, false);
|
||||
|
||||
/**
|
||||
* Do not use scrollToBottom() or other scrolling methods
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import type { E2EPage, ScreenshotFn } from '@utils/test/playwright';
|
||||
|
||||
/**
|
||||
* Warning: This function will fail when in RTL mode.
|
||||
* TODO(FW-3711): Remove the `directions` config when this issue preventing
|
||||
* tests from passing in RTL mode is resolved.
|
||||
*/
|
||||
export const testSlidingItem = async (
|
||||
page: E2EPage,
|
||||
itemID: string,
|
||||
@ -23,6 +28,9 @@ export const testSlidingItem = async (
|
||||
}
|
||||
|
||||
// opening animation takes longer than waitForChanges accounts for
|
||||
// especially if another item sliding is already open,
|
||||
// so we wait to ensure the opened item is closed before
|
||||
// opening another
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await expect(item).toHaveScreenshot(screenshot(`item-sliding-${screenshotNameSuffix}`));
|
||||
|
||||