Skip to content

Commit 437ef16

Browse files
test(select): migrate to toHaveScreenshot (#28088)
Issue number: N/A --------- <!-- 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. --> Several tests for this component are still using Playwright's old `toMatchSnapshot` assertion. It's now recommended to use the newer `toHaveScreenshot` assertion. This new assertion reduces the size of each screenshot and brings anti-flake improvements such as disabling animations by default. We previously migrated most of our codebase to use `toHaveScreenshot`, but it looks like we missed the tests that were written during the development of Ionic 7 in a separate branch off `main`. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Migrate component tests to use `toHaveScreenshot`. Note: There should be no layout changes to any of the screenshots. The only difference between the old and new screenshots should be image and file size. ## 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. --> --------- Co-authored-by: ionitron <[email protected]>
1 parent 7babf61 commit 437ef16

File tree

229 files changed

+43
-57
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+43
-57
lines changed

core/src/components/select/test/card/select.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
1818
);
1919

2020
const card = page.locator('ion-card');
21-
expect(await card.screenshot()).toMatchSnapshot(screenshot(`select-card`));
21+
await expect(card).toHaveScreenshot(screenshot(`select-card`));
2222
});
2323
});
2424
});
-3.5 KB
-3.37 KB

core/src/components/select/test/color/select.e2e.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
1515
);
1616

1717
const select = page.locator('ion-select');
18-
expect(await select.screenshot({ animations: 'disabled' })).toMatchSnapshot(screenshot(`select-no-fill-color`));
18+
await expect(select).toHaveScreenshot(screenshot(`select-no-fill-color`));
1919
});
2020
});
2121
test.describe('input: fill solid', () => {
@@ -30,7 +30,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
3030
);
3131

3232
const select = page.locator('ion-select');
33-
expect(await select.screenshot({ animations: 'disabled' })).toMatchSnapshot(screenshot(`select-solid-color`));
33+
await expect(select).toHaveScreenshot(screenshot(`select-solid-color`));
3434
});
3535
});
3636
test.describe('input: fill outline', () => {
@@ -45,7 +45,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
4545
);
4646

4747
const select = page.locator('ion-select');
48-
expect(await select.screenshot({ animations: 'disabled' })).toMatchSnapshot(screenshot(`select-outline-color`));
48+
await expect(select).toHaveScreenshot(screenshot(`select-outline-color`));
4949
});
5050
});
5151
});
-3.71 KB
-3.74 KB
-4.35 KB
-4.45 KB
-3.92 KB
-4.05 KB

0 commit comments

Comments
 (0)