Skip to content

Commit e3587b0

Browse files
committed
test(input-otp): add snapshots
1 parent b4ae95b commit e3587b0

File tree

25 files changed

+41
-0
lines changed

25 files changed

+41
-0
lines changed

core/src/components/input-otp/test/bottom-content/input-otp.e2e.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,47 @@
11
import { expect } from '@playwright/test';
22
import { configs, test } from '@utils/test/playwright';
33

4+
/**
5+
* Rendering is different across modes
6+
*/
7+
configs({ modes: ['ios', 'md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
8+
test.describe(title('input-otp: helper text rendering'), () => {
9+
test('should not have visual regressions when rendering helper text with no description', async ({ page }) => {
10+
await page.setContent(`<ion-input-otp helper-text="Helper text"></ion-input-otp>`, config);
11+
12+
const bottomEl = page.locator('ion-input-otp');
13+
await expect(bottomEl).toHaveScreenshot(screenshot(`input-otp-helper-text-no-description`));
14+
});
15+
test('should not have visual regressions when rendering helper text with description', async ({ page }) => {
16+
await page.setContent(`<ion-input-otp helper-text="Helper text">Description</ion-input-otp>`, config);
17+
18+
const bottomEl = page.locator('ion-input-otp');
19+
await expect(bottomEl).toHaveScreenshot(screenshot(`input-otp-helper-text-description`));
20+
});
21+
});
22+
23+
test.describe(title('input: error text rendering'), () => {
24+
test('should not have visual regressions when rendering error text with no description', async ({ page }) => {
25+
await page.setContent(
26+
`<ion-input-otp class="ion-invalid ion-touched" error-text="Error text"></ion-input-otp>`,
27+
config
28+
);
29+
30+
const bottomEl = page.locator('ion-input-otp');
31+
await expect(bottomEl).toHaveScreenshot(screenshot(`input-otp-error-text-no-description`));
32+
});
33+
test('should not have visual regressions when rendering error text with description', async ({ page }) => {
34+
await page.setContent(
35+
`<ion-input-otp class="ion-invalid ion-touched" error-text="Error text">Description</ion-input-otp>`,
36+
config
37+
);
38+
39+
const bottomEl = page.locator('ion-input-otp');
40+
await expect(bottomEl).toHaveScreenshot(screenshot(`input-otp-error-text-description`));
41+
});
42+
});
43+
});
44+
445
/**
546
* Functionality is the same across modes & directions
647
*/
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)