test(label): migrate to generators (#27325)
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. --> Label sliding tests use legacy syntax ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Label sliding 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,49 +0,0 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('label: rendering', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-label>My Label</ion-label>
|
||||
`);
|
||||
|
||||
const labelEl = page.locator('ion-label');
|
||||
|
||||
await expect(labelEl).toHaveScreenshot(`label-basic-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test('should not have visual regressions with fixed label', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-item>
|
||||
<ion-label>My Label</ion-label>
|
||||
</ion-item>
|
||||
`);
|
||||
|
||||
const itemEl = page.locator('ion-item');
|
||||
|
||||
await expect(itemEl).toHaveScreenshot(`label-fixed-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test('should not have visual regressions with stacked label', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-item>
|
||||
<ion-label position="stacked">My Label</ion-label>
|
||||
<ion-input></ion-input>
|
||||
</ion-item>
|
||||
`);
|
||||
|
||||
const itemEl = page.locator('ion-item');
|
||||
|
||||
await expect(itemEl).toHaveScreenshot(`label-stacked-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test('should not have visual regressions with floating label', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-item>
|
||||
<ion-label position="floating">My Label</ion-label>
|
||||
<ion-input></ion-input>
|
||||
</ion-item>
|
||||
`);
|
||||
|
||||
const itemEl = page.locator('ion-item');
|
||||
|
||||
await expect(itemEl).toHaveScreenshot(`label-floating-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
});
|
||||
63
core/src/components/label/test/basic/label.e2e.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs().forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('label: rendering'), () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-label>My Label</ion-label>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const labelEl = page.locator('ion-label');
|
||||
|
||||
await expect(labelEl).toHaveScreenshot(screenshot(`label-basic`));
|
||||
});
|
||||
test('should not have visual regressions with fixed label', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-item>
|
||||
<ion-label>My Label</ion-label>
|
||||
</ion-item>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const itemEl = page.locator('ion-item');
|
||||
|
||||
await expect(itemEl).toHaveScreenshot(screenshot(`label-fixed`));
|
||||
});
|
||||
test('should not have visual regressions with stacked label', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-item>
|
||||
<ion-label position="stacked">My Label</ion-label>
|
||||
<ion-input></ion-input>
|
||||
</ion-item>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const itemEl = page.locator('ion-item');
|
||||
|
||||
await expect(itemEl).toHaveScreenshot(screenshot(`label-stacked`));
|
||||
});
|
||||
test('should not have visual regressions with floating label', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-item>
|
||||
<ion-label position="floating">My Label</ion-label>
|
||||
<ion-input></ion-input>
|
||||
</ion-item>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const itemEl = page.locator('ion-item');
|
||||
|
||||
await expect(itemEl).toHaveScreenshot(screenshot(`label-floating`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -1,46 +0,0 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('label: rendering', () => {
|
||||
test.beforeEach(({ skip }) => {
|
||||
skip.rtl();
|
||||
});
|
||||
test('should not inherit color from content', async ({ page }) => {
|
||||
await page.goto(`/src/components/label/test/color`);
|
||||
|
||||
const item = page.locator('ion-item');
|
||||
|
||||
await expect(item).toHaveScreenshot(`item-color-inherit-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test('should set color directly', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-label color="danger">Label Text</ion-label>
|
||||
`);
|
||||
|
||||
const labelEl = page.locator('ion-label');
|
||||
|
||||
await expect(labelEl).toHaveScreenshot(`label-color-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test('should use contrast color when color is set on item', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-item color="danger">
|
||||
<ion-label>Label Text</ion-label>
|
||||
</ion-item>
|
||||
`);
|
||||
|
||||
const labelEl = page.locator('ion-label');
|
||||
|
||||
await expect(labelEl).toHaveScreenshot(`label-color-contrast-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test('should override color even if color set on item', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-item color="danger">
|
||||
<ion-label color="dark">Label Text</ion-label>
|
||||
</ion-item>
|
||||
`);
|
||||
|
||||
const labelEl = page.locator('ion-label');
|
||||
|
||||
await expect(labelEl).toHaveScreenshot(`label-color-override-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
});
|
||||
54
core/src/components/label/test/color/label.e2e.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('label: rendering'), () => {
|
||||
test('should not inherit color from content', async ({ page }) => {
|
||||
await page.goto(`/src/components/label/test/color`, config);
|
||||
|
||||
const item = page.locator('ion-item');
|
||||
|
||||
await expect(item).toHaveScreenshot(screenshot(`item-color-inherit`));
|
||||
});
|
||||
test('should set color directly', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-label color="danger">Label Text</ion-label>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const labelEl = page.locator('ion-label');
|
||||
|
||||
await expect(labelEl).toHaveScreenshot(screenshot(`label-color`));
|
||||
});
|
||||
test('should use contrast color when color is set on item', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-item color="danger">
|
||||
<ion-label>Label Text</ion-label>
|
||||
</ion-item>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const labelEl = page.locator('ion-label');
|
||||
|
||||
await expect(labelEl).toHaveScreenshot(screenshot(`label-color-contrast`));
|
||||
});
|
||||
test('should override color even if color set on item', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-item color="danger">
|
||||
<ion-label color="dark">Label Text</ion-label>
|
||||
</ion-item>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const labelEl = page.locator('ion-label');
|
||||
|
||||
await expect(labelEl).toHaveScreenshot(screenshot(`label-color-override`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@ -1,13 +0,0 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('label: rendering', () => {
|
||||
test.beforeEach(({ skip }) => {
|
||||
skip.rtl();
|
||||
});
|
||||
test('should inherit text overflow for headings', async ({ page }) => {
|
||||
await page.goto(`/src/components/label/test/headings`);
|
||||
|
||||
await expect(page).toHaveScreenshot(`item-headings-inherit-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
});
|
||||
12
core/src/components/label/test/headings/label.e2e.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('label: rendering'), () => {
|
||||
test('should inherit text overflow for headings', async ({ page }) => {
|
||||
await page.goto(`/src/components/label/test/headings`, config);
|
||||
|
||||
await expect(page).toHaveScreenshot(screenshot(`item-headings-inherit`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |