-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(header): migrate to playwright (#26112)
- Loading branch information
1 parent
1320948
commit 8ac3b8b
Showing
52 changed files
with
349 additions
and
457 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import AxeBuilder from '@axe-core/playwright'; | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@utils/test/playwright'; | ||
|
||
test.describe('header: a11y', () => { | ||
test.beforeEach(async ({ skip }) => { | ||
skip.rtl(); | ||
skip.mode('md'); | ||
}); | ||
|
||
test('should not have accessibility violations', async ({ page }) => { | ||
await page.goto(`/src/components/header/test/a11y`); | ||
|
||
const headers = page.locator('ion-header'); | ||
await expect(headers.first()).toHaveAttribute('role', 'banner'); | ||
await expect(headers.last()).toHaveAttribute('role', 'none'); | ||
|
||
const results = await new AxeBuilder({ page }).analyze(); | ||
expect(results.violations).toEqual([]); | ||
}); | ||
|
||
test('should allow for custom role', async ({ page }) => { | ||
/** | ||
* Note: This example should not be used in production. | ||
* This only serves to check that `role` can be customized. | ||
*/ | ||
await page.setContent(` | ||
<ion-header role="heading"></ion-header> | ||
`); | ||
const header = page.locator('ion-header'); | ||
|
||
await expect(header).toHaveAttribute('role', 'heading'); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@utils/test/playwright'; | ||
|
||
test.describe('header: basic', () => { | ||
test.describe('header: rendering', () => { | ||
test('should not have visual regressions with basic header', async ({ page }) => { | ||
await page.setContent(` | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>Header - Default</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
`); | ||
|
||
const header = page.locator('ion-header'); | ||
expect(await header.screenshot()).toMatchSnapshot(`header-diff-${page.getSnapshotSettings()}.png`); | ||
}); | ||
}); | ||
|
||
test.describe('header: feature rendering', () => { | ||
test.beforeEach(({ skip }) => { | ||
skip.rtl(); | ||
}); | ||
|
||
test('should not have visual regressions with no border', async ({ page }) => { | ||
await page.setContent(` | ||
<ion-header class="ion-no-border"> | ||
<ion-toolbar> | ||
<ion-title>Header - No Border</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
`); | ||
|
||
const header = page.locator('ion-header'); | ||
expect(await header.screenshot()).toMatchSnapshot(`header-no-border-diff-${page.getSnapshotSettings()}.png`); | ||
}); | ||
|
||
test('should not have visual regressions with translucent header', async ({ page, skip }) => { | ||
skip.mode('md', 'Translucent effect is only available in iOS mode.'); | ||
skip.browser('firefox', 'Firefox has some issues rendering translucent effects on Linux.'); | ||
|
||
await page.setContent(` | ||
<ion-header translucent="true"> | ||
<div style="position: absolute; top: 0; left: 0; right: 0; bottom: 0"> | ||
<img style="transform: rotate(145deg) scale(1.5)" src="/src/components/header/test/img.jpg" /> | ||
</div> | ||
<ion-toolbar> | ||
<ion-title>Header - Translucent</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
`); | ||
|
||
const header = page.locator('ion-header'); | ||
expect(await header.screenshot()).toMatchSnapshot(`header-translucent-diff-${page.getSnapshotSettings()}.png`); | ||
}); | ||
|
||
test('should not have visual regressions with translucent header with color', async ({ page, skip }) => { | ||
skip.mode('md', 'Translucent effect is only available in iOS mode.'); | ||
skip.browser('firefox', 'Firefox has some issues rendering translucent effects on Linux.'); | ||
|
||
await page.setContent(` | ||
<ion-header translucent="true"> | ||
<div style="position: absolute; top: 0; left: 0; right: 0; bottom: 0"> | ||
<img style="transform: rotate(145deg) scale(1.5)" src="/src/components/header/test/img.jpg" /> | ||
</div> | ||
<ion-toolbar color="tertiary"> | ||
<ion-title>Header - Translucent</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
`); | ||
|
||
const header = page.locator('ion-header'); | ||
expect(await header.screenshot()).toMatchSnapshot( | ||
`header-translucent-color-diff-${page.getSnapshotSettings()}.png` | ||
); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+5.81 KB
.../test/basic/header.e2e.ts-snapshots/header-diff-ios-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.89 KB
...test/basic/header.e2e.ts-snapshots/header-diff-ios-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.69 KB
.../test/basic/header.e2e.ts-snapshots/header-diff-ios-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.81 KB
.../test/basic/header.e2e.ts-snapshots/header-diff-ios-rtl-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.89 KB
...test/basic/header.e2e.ts-snapshots/header-diff-ios-rtl-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.69 KB
.../test/basic/header.e2e.ts-snapshots/header-diff-ios-rtl-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.16 KB
...r/test/basic/header.e2e.ts-snapshots/header-diff-md-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.86 KB
.../test/basic/header.e2e.ts-snapshots/header-diff-md-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.16 KB
...r/test/basic/header.e2e.ts-snapshots/header-diff-md-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.15 KB
...r/test/basic/header.e2e.ts-snapshots/header-diff-md-rtl-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.04 KB
.../test/basic/header.e2e.ts-snapshots/header-diff-md-rtl-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.16 KB
...r/test/basic/header.e2e.ts-snapshots/header-diff-md-rtl-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.35 KB
...c/header.e2e.ts-snapshots/header-no-border-diff-ios-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.03 KB
.../header.e2e.ts-snapshots/header-no-border-diff-ios-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.13 KB
...c/header.e2e.ts-snapshots/header-no-border-diff-ios-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.9 KB
...ic/header.e2e.ts-snapshots/header-no-border-diff-md-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.06 KB
...c/header.e2e.ts-snapshots/header-no-border-diff-md-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.9 KB
...ic/header.e2e.ts-snapshots/header-no-border-diff-md-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+49.1 KB
....e2e.ts-snapshots/header-translucent-color-diff-ios-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+52.2 KB
....e2e.ts-snapshots/header-translucent-color-diff-ios-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+50.7 KB
...header.e2e.ts-snapshots/header-translucent-diff-ios-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+53.6 KB
...header.e2e.ts-snapshots/header-translucent-diff-ios-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+27.8 KB
...hots/header-condense-large-title-collapsed-diff-ios-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.89 KB
...ots/header-condense-large-title-collapsed-diff-ios-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.6 KB
...hots/header-condense-large-title-collapsed-diff-ios-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.58 KB
...pshots/header-condense-large-title-initial-diff-ios-ltr-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.91 KB
...shots/header-condense-large-title-initial-diff-ios-ltr-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.46 KB
...pshots/header-condense-large-title-initial-diff-ios-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@utils/test/playwright'; | ||
|
||
test.describe('header: fade', () => { | ||
test.beforeEach(({ skip }) => { | ||
skip.rtl(); | ||
}); | ||
|
||
test('should not have visual regressions with fade header', async ({ page, skip }) => { | ||
skip.mode('md', 'Translucent effect is only available in iOS mode.'); | ||
skip.browser('firefox', 'Firefox has some issues rendering translucent effects on Linux.'); | ||
|
||
await page.goto('/src/components/header/test/fade'); | ||
|
||
const header = page.locator('ion-header'); | ||
expect(await header.screenshot({ animations: 'disabled' })).toMatchSnapshot( | ||
`header-fade-not-blurred-diff-${page.getSnapshotSettings()}.png` | ||
); | ||
|
||
const content = page.locator('ion-content'); | ||
await content.evaluate((el: HTMLIonContentElement) => el.scrollToBottom(0)); | ||
await page.waitForChanges(); | ||
|
||
expect(await header.screenshot({ animations: 'disabled' })).toMatchSnapshot( | ||
`header-fade-blurred-diff-${page.getSnapshotSettings()}.png` | ||
); | ||
}); | ||
}); |
Binary file added
BIN
+27.8 KB
...eader.e2e.ts-snapshots/header-fade-blurred-diff-ios-ltr-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+22.6 KB
...eader.e2e.ts-snapshots/header-fade-blurred-diff-ios-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+41.6 KB
...r.e2e.ts-snapshots/header-fade-not-blurred-diff-ios-ltr-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+39.6 KB
...r.e2e.ts-snapshots/header-fade-not-blurred-diff-ios-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
Oops, something went wrong.