Skip to content

Commit fe86d9a

Browse files
authored
test(note): migrate to generators (ionic-team#27333)
Issue number: N/A --------- <!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> <!-- Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation for details. --> <!-- 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. --> Note tests use legacy syntax ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Note tests use modern syntax ## 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. -->
1 parent f5e668c commit fe86d9a

38 files changed

Lines changed: 99 additions & 75 deletions

File tree

core/src/components/note/test/basic/note.e2e-legacy.ts

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import { expect } from '@playwright/test';
2+
import { configs, test } from '@utils/test/playwright';
3+
4+
/**
5+
* Note has no custom RTL logic
6+
*/
7+
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
8+
test.describe(title('note: rendering'), () => {
9+
test('should not have visual regressions', async ({ page }) => {
10+
await page.setContent(
11+
`
12+
<ion-note>99</ion-note>
13+
`,
14+
config
15+
);
16+
const note = page.locator('ion-note');
17+
await expect(note).toHaveScreenshot(screenshot(`note-diff`));
18+
});
19+
20+
test('should render color correctly', async ({ page }) => {
21+
await page.setContent(
22+
`
23+
<ion-note color="danger">99</ion-note>
24+
`,
25+
config
26+
);
27+
const note = page.locator('ion-note');
28+
await expect(note).toHaveScreenshot(screenshot(`note-color`));
29+
});
30+
});
31+
});
32+
33+
/**
34+
* Only MD ion-item has ion-note specific logic
35+
*/
36+
configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
37+
test.describe(title('note: item'), () => {
38+
test('should not have visual regressions when in the start slot of an item', async ({ page }) => {
39+
await page.setContent(
40+
`
41+
<ion-item>
42+
<ion-label>Label</ion-label>
43+
<ion-note slot="start">Start Note</ion-note>
44+
</ion-item>
45+
`,
46+
config
47+
);
48+
const item = page.locator('ion-item');
49+
await expect(item).toHaveScreenshot(screenshot(`note-item-start`));
50+
});
51+
52+
test('should not have visual regressions when in the end slot of an item', async ({ page }) => {
53+
await page.setContent(
54+
`
55+
<ion-item>
56+
<ion-label>Label</ion-label>
57+
<ion-note slot="end">End Note</ion-note>
58+
</ion-item>
59+
`,
60+
config
61+
);
62+
const item = page.locator('ion-item');
63+
await expect(item).toHaveScreenshot(screenshot(`note-item-end`));
64+
});
65+
});
66+
});
67+
68+
/**
69+
* Only MD ion-item-divider has ion-note specific logic
70+
*/
71+
configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
72+
test.describe(title('note: item-divider'), () => {
73+
test('should not have visual regressions when in the start slot of an item-divider', async ({ page }) => {
74+
await page.setContent(
75+
`
76+
<ion-item-divider>
77+
<ion-note slot="start">Start Note</ion-note>
78+
</ion-item-divider>
79+
`,
80+
config
81+
);
82+
const itemDivider = page.locator('ion-item-divider');
83+
await expect(itemDivider).toHaveScreenshot(screenshot(`note-item-divider-start`));
84+
});
85+
86+
test('should not have visual regressions when in the end slot of an item-divider', async ({ page }) => {
87+
await page.setContent(
88+
`
89+
<ion-item-divider>
90+
<ion-note slot="start">End Note</ion-note>
91+
</ion-item-divider>
92+
`,
93+
config
94+
);
95+
const itemDivider = page.locator('ion-item-divider');
96+
await expect(itemDivider).toHaveScreenshot(screenshot(`note-item-divider-end`));
97+
});
98+
});
99+
});

core/src/components/note/test/basic/note.e2e-legacy.ts-snapshots/note-color-ios-ltr-Mobile-Chrome-linux.png renamed to core/src/components/note/test/basic/note.e2e.ts-snapshots/note-color-ios-ltr-Mobile-Chrome-linux.png

File renamed without changes.

core/src/components/note/test/basic/note.e2e-legacy.ts-snapshots/note-color-ios-ltr-Mobile-Firefox-linux.png renamed to core/src/components/note/test/basic/note.e2e.ts-snapshots/note-color-ios-ltr-Mobile-Firefox-linux.png

File renamed without changes.

core/src/components/note/test/basic/note.e2e-legacy.ts-snapshots/note-color-ios-ltr-Mobile-Safari-linux.png renamed to core/src/components/note/test/basic/note.e2e.ts-snapshots/note-color-ios-ltr-Mobile-Safari-linux.png

File renamed without changes.

core/src/components/note/test/basic/note.e2e-legacy.ts-snapshots/note-color-md-ltr-Mobile-Chrome-linux.png renamed to core/src/components/note/test/basic/note.e2e.ts-snapshots/note-color-md-ltr-Mobile-Chrome-linux.png

File renamed without changes.

core/src/components/note/test/basic/note.e2e-legacy.ts-snapshots/note-color-md-ltr-Mobile-Firefox-linux.png renamed to core/src/components/note/test/basic/note.e2e.ts-snapshots/note-color-md-ltr-Mobile-Firefox-linux.png

File renamed without changes.

core/src/components/note/test/basic/note.e2e-legacy.ts-snapshots/note-color-md-ltr-Mobile-Safari-linux.png renamed to core/src/components/note/test/basic/note.e2e.ts-snapshots/note-color-md-ltr-Mobile-Safari-linux.png

File renamed without changes.

core/src/components/note/test/basic/note.e2e-legacy.ts-snapshots/note-diff-ios-ltr-Mobile-Chrome-linux.png renamed to core/src/components/note/test/basic/note.e2e.ts-snapshots/note-diff-ios-ltr-Mobile-Chrome-linux.png

File renamed without changes.

core/src/components/note/test/basic/note.e2e-legacy.ts-snapshots/note-diff-ios-ltr-Mobile-Firefox-linux.png renamed to core/src/components/note/test/basic/note.e2e.ts-snapshots/note-diff-ios-ltr-Mobile-Firefox-linux.png

File renamed without changes.

0 commit comments

Comments
 (0)