|
1 | 1 | import { expect } from '@playwright/test'; |
2 | 2 | import { configs, test } from '@utils/test/playwright'; |
3 | 3 |
|
| 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 | + |
4 | 45 | /** |
5 | 46 | * Functionality is the same across modes & directions |
6 | 47 | */ |
|
0 commit comments