Skip to content

Commit 0f5ce8e

Browse files
test(range): migrate to toHaveScreenshot (#28089)
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 abc8118 commit 0f5ce8e

File tree

166 files changed

+26
-26
lines changed

Some content is hidden

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

166 files changed

+26
-26
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
1616
);
1717

1818
const range = page.locator('ion-range');
19-
expect(await range.screenshot()).toMatchSnapshot(screenshot(`range-color`));
19+
await expect(range).toHaveScreenshot(screenshot(`range-color`));
2020
});
2121
});
2222
});
-7.44 KB
-7.75 KB
-5.08 KB
-5.35 KB

core/src/components/range/test/custom/range.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
77
await page.goto(`/src/components/range/test/custom`, config);
88

99
const range = page.locator('ion-range');
10-
expect(await range.screenshot()).toMatchSnapshot(screenshot(`range-custom`));
10+
await expect(range).toHaveScreenshot(screenshot(`range-custom`));
1111
});
1212
});
1313
});
-8.45 KB
-4.54 KB
-2.44 KB
-1.49 KB

0 commit comments

Comments
 (0)