Skip to content

Commit fbd4983

Browse files
committed
test(item-sliding): break test down
1 parent 03a4a77 commit fbd4983

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

core/src/components/item-sliding/test/icons/item-sliding.e2e.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import { configs, test, dragElementBy } from '@utils/test/playwright';
1010
*/
1111
configs({ modes: ['ionic-md', 'ios', 'md'] }).forEach(({ title, screenshot, config }) => {
1212
test.describe(title('item-sliding: icons'), () => {
13-
test('should not have visual regressions', async ({ page }) => {
13+
test.beforeEach(async ({ page }) => {
1414
await page.goto(`/src/components/item-sliding/test/icons`, config);
15+
});
1516

16-
const itemIDs = ['iconsOnly', 'iconsStart', 'iconsEnd', 'iconsTop', 'iconsBottom'];
17-
for (const itemID of itemIDs) {
18-
const item = page.locator(`#${itemID}`);
17+
['iconsOnly', 'iconsStart', 'iconsEnd', 'iconsTop', 'iconsBottom'].forEach((position) => {
18+
test(`${position} - should not have visual regressions`, async ({ page }) => {
19+
const item = page.locator(`#${position}`);
1920

2021
/**
2122
* Negative dragByX value to drag element from the right to the left
@@ -29,9 +30,9 @@ configs({ modes: ['ionic-md', 'ios', 'md'] }).forEach(({ title, screenshot, conf
2930
await page.waitForChanges();
3031

3132
// Convert camelCase ids to kebab-case for screenshot file names
32-
const itemIDKebab = itemID.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
33-
await expect(item).toHaveScreenshot(screenshot(`item-sliding-${itemIDKebab}`));
34-
}
33+
const positionKebab = position.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
34+
await expect(item).toHaveScreenshot(screenshot(`item-sliding-${positionKebab}`));
35+
});
3536
});
3637
});
3738
});

0 commit comments

Comments
 (0)