-
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(textarea): migrate tests to playwright (#25512)
- Loading branch information
1 parent
6d52219
commit ffb0311
Showing
82 changed files
with
154 additions
and
89 deletions.
There are no files selected for viewing
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,30 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@utils/test/playwright'; | ||
|
||
test.describe('textarea: a11y', () => { | ||
test('does not set a default aria-labelledby when there is not a neighboring ion-label', async ({ page }) => { | ||
await page.setContent(`<ion-textarea></ion-textarea>`); | ||
|
||
await page.setIonViewport(); | ||
|
||
const textarea = page.locator('ion-textarea textarea'); | ||
const ariaLabelledBy = await textarea.getAttribute('aria-labelledby'); | ||
|
||
expect(ariaLabelledBy).toBe(null); | ||
}); | ||
|
||
test('set a default aria-labelledby when a neighboring ion-label exist', async ({ page }) => { | ||
await page.setContent(` | ||
<ion-item> | ||
<ion-label>A11y Test</ion-label> | ||
<ion-textarea></ion-textarea> | ||
</ion-item> | ||
`); | ||
|
||
const label = page.locator('ion-label'); | ||
const textarea = page.locator('ion-textarea textarea'); | ||
const ariaLabelledBy = await textarea.getAttribute('aria-labelledby'); | ||
|
||
expect(ariaLabelledBy).toBe(await label.getAttribute('id')); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
core/src/components/textarea/test/autogrow/textarea.e2e.ts
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,50 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@utils/test/playwright'; | ||
|
||
test.describe('textarea: autogrow', () => { | ||
test.skip('should not have visual regressions', async ({ page }) => { | ||
await page.goto(`/src/components/textarea/test/autogrow`); | ||
|
||
await page.waitForChanges(); | ||
|
||
await page.setIonViewport(); | ||
|
||
expect(await page.screenshot()).toMatchSnapshot(`textarea-autogrow-diff-${page.getSnapshotSettings()}.png`); | ||
}); | ||
|
||
test('should grow when typing', async ({ page }) => { | ||
await page.setContent( | ||
` | ||
<ion-app> | ||
<ion-content> | ||
<ion-list> | ||
<ion-item> | ||
<ion-textarea auto-grow="true"></ion-textarea> | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> | ||
</ion-app>` | ||
); | ||
|
||
const textarea = await page.waitForSelector('ion-textarea'); | ||
|
||
await textarea.click(); | ||
|
||
await textarea.type('Now, this is a story all about how'); | ||
|
||
await page.setIonViewport(); | ||
|
||
expect(await textarea.screenshot()).toMatchSnapshot(`textarea-autogrow-initial-${page.getSnapshotSettings()}.png`); | ||
|
||
await textarea.type( | ||
[ | ||
`\nMy life got flipped-turned upside down`, | ||
`And I'd like to take a minute`, | ||
`Just sit right there`, | ||
`I'll tell you how I became the prince of a town called Bel-Air`, | ||
].join('\n') | ||
); | ||
|
||
expect(await textarea.screenshot()).toMatchSnapshot(`textarea-autogrow-after-${page.getSnapshotSettings()}.png`); | ||
}); | ||
}); |
Binary file added
BIN
+60.3 KB
...xtarea.e2e.ts-snapshots/textarea-autogrow-after-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
+15.8 KB
...tarea.e2e.ts-snapshots/textarea-autogrow-after-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
+47.2 KB
...xtarea.e2e.ts-snapshots/textarea-autogrow-after-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
+59.8 KB
...xtarea.e2e.ts-snapshots/textarea-autogrow-after-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
+15.9 KB
...tarea.e2e.ts-snapshots/textarea-autogrow-after-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
+47.2 KB
...xtarea.e2e.ts-snapshots/textarea-autogrow-after-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
+56.3 KB
...extarea.e2e.ts-snapshots/textarea-autogrow-after-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
+13.7 KB
...xtarea.e2e.ts-snapshots/textarea-autogrow-after-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
+40.5 KB
...extarea.e2e.ts-snapshots/textarea-autogrow-after-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
+56.1 KB
...extarea.e2e.ts-snapshots/textarea-autogrow-after-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
+13.4 KB
...xtarea.e2e.ts-snapshots/textarea-autogrow-after-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
+40.4 KB
...extarea.e2e.ts-snapshots/textarea-autogrow-after-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
+13 KB
...area.e2e.ts-snapshots/textarea-autogrow-initial-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
+4.19 KB
...rea.e2e.ts-snapshots/textarea-autogrow-initial-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
+8.88 KB
...area.e2e.ts-snapshots/textarea-autogrow-initial-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
+12.9 KB
...area.e2e.ts-snapshots/textarea-autogrow-initial-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
+4.1 KB
...rea.e2e.ts-snapshots/textarea-autogrow-initial-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
+8.89 KB
...area.e2e.ts-snapshots/textarea-autogrow-initial-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
+10.6 KB
...tarea.e2e.ts-snapshots/textarea-autogrow-initial-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.75 KB
...area.e2e.ts-snapshots/textarea-autogrow-initial-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
+8.06 KB
...tarea.e2e.ts-snapshots/textarea-autogrow-initial-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
+10.6 KB
...tarea.e2e.ts-snapshots/textarea-autogrow-initial-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.69 KB
...area.e2e.ts-snapshots/textarea-autogrow-initial-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
+8.07 KB
...tarea.e2e.ts-snapshots/textarea-autogrow-initial-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.
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
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,51 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@utils/test/playwright'; | ||
|
||
test.describe('textarea: basic', () => { | ||
test('should not have visual regressions', async ({ page }) => { | ||
await page.goto(`/src/components/textarea/test/basic`); | ||
|
||
/** | ||
* The auto grow implementation uses a requestAnimationFrame to append styles to the textarea | ||
* on load. We need to wait for changes otherwise the screenshot can be taken before the | ||
* styles are applied. | ||
*/ | ||
await page.waitForChanges(); | ||
|
||
await page.setIonViewport(); | ||
|
||
expect(await page.screenshot()).toMatchSnapshot(`textarea-diff-${page.getSnapshotSettings()}.png`); | ||
}); | ||
|
||
test.describe('with floating labels', () => { | ||
/** | ||
* Verifies the display of a floating label above an `ion-textarea`. | ||
* Captures a screenshot of the initial state (without a value) and verifies | ||
* that the label translates correctly after the value is set. | ||
*/ | ||
test('should not have visual regressions', async ({ page }) => { | ||
await page.setContent(` | ||
<ion-item> | ||
<ion-label position="floating">Floating Label</ion-label> | ||
<ion-textarea></ion-textarea> | ||
</ion-item>`); | ||
|
||
const item = page.locator('ion-item'); | ||
const textarea = page.locator('ion-textarea'); | ||
|
||
expect(await item.screenshot()).toMatchSnapshot( | ||
`textarea-floating-label-initial-${page.getSnapshotSettings()}.png` | ||
); | ||
|
||
await textarea.evaluate((el: HTMLIonTextareaElement) => { | ||
el.value = 'Updated value'; | ||
}); | ||
|
||
await page.waitForChanges(); | ||
|
||
await page.setIonViewport(); | ||
|
||
expect(await item.screenshot()).toMatchSnapshot(`textarea-floating-label-diff-${page.getSnapshotSettings()}.png`); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+120 KB
...t/basic/textarea.e2e.ts-snapshots/textarea-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
+46.6 KB
.../basic/textarea.e2e.ts-snapshots/textarea-diff-ios-ltr-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+106 KB
...t/basic/textarea.e2e.ts-snapshots/textarea-diff-ios-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+120 KB
...t/basic/textarea.e2e.ts-snapshots/textarea-diff-ios-rtl-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+46.7 KB
.../basic/textarea.e2e.ts-snapshots/textarea-diff-ios-rtl-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+106 KB
...t/basic/textarea.e2e.ts-snapshots/textarea-diff-ios-rtl-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+114 KB
...st/basic/textarea.e2e.ts-snapshots/textarea-diff-md-ltr-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+43.4 KB
...t/basic/textarea.e2e.ts-snapshots/textarea-diff-md-ltr-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+96.9 KB
...st/basic/textarea.e2e.ts-snapshots/textarea-diff-md-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+114 KB
...st/basic/textarea.e2e.ts-snapshots/textarea-diff-md-rtl-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+43.2 KB
...t/basic/textarea.e2e.ts-snapshots/textarea-diff-md-rtl-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+96.9 KB
...st/basic/textarea.e2e.ts-snapshots/textarea-diff-md-rtl-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.4 KB
...a.e2e.ts-snapshots/textarea-floating-label-diff-ios-ltr-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+4.87 KB
....e2e.ts-snapshots/textarea-floating-label-diff-ios-ltr-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.3 KB
...a.e2e.ts-snapshots/textarea-floating-label-diff-ios-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.9 KB
...a.e2e.ts-snapshots/textarea-floating-label-diff-ios-rtl-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+4.93 KB
....e2e.ts-snapshots/textarea-floating-label-diff-ios-rtl-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.3 KB
...a.e2e.ts-snapshots/textarea-floating-label-diff-ios-rtl-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.8 KB
...ea.e2e.ts-snapshots/textarea-floating-label-diff-md-ltr-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+3.76 KB
...a.e2e.ts-snapshots/textarea-floating-label-diff-md-ltr-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.66 KB
...ea.e2e.ts-snapshots/textarea-floating-label-diff-md-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+12.2 KB
...ea.e2e.ts-snapshots/textarea-floating-label-diff-md-rtl-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+3.87 KB
...a.e2e.ts-snapshots/textarea-floating-label-diff-md-rtl-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.65 KB
...ea.e2e.ts-snapshots/textarea-floating-label-diff-md-rtl-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.95 KB
...2e.ts-snapshots/textarea-floating-label-initial-ios-ltr-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+3.13 KB
...e.ts-snapshots/textarea-floating-label-initial-ios-ltr-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.12 KB
...2e.ts-snapshots/textarea-floating-label-initial-ios-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.13 KB
...2e.ts-snapshots/textarea-floating-label-initial-ios-rtl-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+3.13 KB
...e.ts-snapshots/textarea-floating-label-initial-ios-rtl-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.11 KB
...2e.ts-snapshots/textarea-floating-label-initial-ios-rtl-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.49 KB
...e2e.ts-snapshots/textarea-floating-label-initial-md-ltr-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.67 KB
...2e.ts-snapshots/textarea-floating-label-initial-md-ltr-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.35 KB
...e2e.ts-snapshots/textarea-floating-label-initial-md-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.49 KB
...e2e.ts-snapshots/textarea-floating-label-initial-md-rtl-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.66 KB
...2e.ts-snapshots/textarea-floating-label-initial-md-rtl-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.34 KB
...e2e.ts-snapshots/textarea-floating-label-initial-md-rtl-Mobile-Safari-linux.png
Oops, something went wrong.
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
15 changes: 15 additions & 0 deletions
15
core/src/components/textarea/test/standalone/textarea.e2e.ts
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,15 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@utils/test/playwright'; | ||
|
||
test.describe('textarea: standalone', () => { | ||
/** | ||
* Verifies `ion-textarea` visual display when used outside of an `ion-app` component. | ||
*/ | ||
test('should not have visual regressions', async ({ page }) => { | ||
await page.goto(`/src/components/textarea/test/standalone`); | ||
|
||
await page.setIonViewport(); | ||
|
||
expect(await page.screenshot()).toMatchSnapshot(`textarea-standalone-diff-${page.getSnapshotSettings()}.png`); | ||
}); | ||
}); |
Binary file added
BIN
+116 KB
...tarea.e2e.ts-snapshots/textarea-standalone-diff-ios-ltr-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.4 KB
...area.e2e.ts-snapshots/textarea-standalone-diff-ios-ltr-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+70.7 KB
...tarea.e2e.ts-snapshots/textarea-standalone-diff-ios-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+117 KB
...tarea.e2e.ts-snapshots/textarea-standalone-diff-ios-rtl-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.1 KB
...area.e2e.ts-snapshots/textarea-standalone-diff-ios-rtl-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+70.4 KB
...tarea.e2e.ts-snapshots/textarea-standalone-diff-ios-rtl-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+114 KB
...xtarea.e2e.ts-snapshots/textarea-standalone-diff-md-ltr-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.6 KB
...tarea.e2e.ts-snapshots/textarea-standalone-diff-md-ltr-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+68.9 KB
...xtarea.e2e.ts-snapshots/textarea-standalone-diff-md-ltr-Mobile-Safari-linux.png
Oops, something went wrong.
Binary file added
BIN
+114 KB
...xtarea.e2e.ts-snapshots/textarea-standalone-diff-md-rtl-Mobile-Chrome-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.4 KB
...tarea.e2e.ts-snapshots/textarea-standalone-diff-md-rtl-Mobile-Firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+68.9 KB
...xtarea.e2e.ts-snapshots/textarea-standalone-diff-md-rtl-Mobile-Safari-linux.png
Oops, something went wrong.