test(searchbar): break up screenshot test (#26455)
@ -1,28 +1,11 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('searchbar: basic', () => {
|
||||
test.describe('searchbar: cancel button', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(`/src/components/searchbar/test/basic`);
|
||||
});
|
||||
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.setIonViewport();
|
||||
/**
|
||||
* The searchbar test template is rendering an ion-searchbar
|
||||
* that is animated. This requires the searchbar to render,
|
||||
* before the cancel button can be positioned correctly.
|
||||
*
|
||||
* We wait for changes to ensure the searchbar has rendered
|
||||
* correctly before capturing the screenshot.
|
||||
*/
|
||||
await page.waitForChanges();
|
||||
|
||||
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot(
|
||||
`searchbar-diff-${page.getSnapshotSettings()}.png`
|
||||
);
|
||||
});
|
||||
|
||||
test('should show cancel button on focus if show-cancel-button=focus', async ({ page }) => {
|
||||
const searchbar = page.locator('#basic');
|
||||
const cancelButton = searchbar.locator('.searchbar-cancel-button');
|
||||
@ -89,3 +72,76 @@ test.describe('searchbar: clear button', () => {
|
||||
await expect(nativeInput).toBeFocused();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('searchbar: rendering', () => {
|
||||
test('should render searchbar', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-searchbar></ion-searchbar>
|
||||
`);
|
||||
|
||||
const searchbar = page.locator('ion-searchbar');
|
||||
|
||||
expect(await searchbar.screenshot()).toMatchSnapshot(`searchbar-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
|
||||
test('should render cancel and clear buttons', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-searchbar show-cancel-button="always" show-clear-button="always"></ion-searchbar>
|
||||
`);
|
||||
|
||||
const searchbar = page.locator('ion-searchbar');
|
||||
|
||||
expect(await searchbar.screenshot()).toMatchSnapshot(`searchbar-buttons-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
|
||||
test('should render searchbar with color', async ({ page, skip }) => {
|
||||
skip.rtl();
|
||||
|
||||
await page.setContent(`
|
||||
<ion-searchbar color="danger" show-cancel-button="always" show-clear-button="always"></ion-searchbar>
|
||||
`);
|
||||
|
||||
const searchbar = page.locator('ion-searchbar');
|
||||
|
||||
expect(await searchbar.screenshot()).toMatchSnapshot(`searchbar-color-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
|
||||
test('should render disabled searchbar', async ({ page, skip }) => {
|
||||
skip.rtl();
|
||||
|
||||
await page.setContent(`
|
||||
<ion-searchbar disabled="true"></ion-searchbar>
|
||||
`);
|
||||
|
||||
const searchbar = page.locator('ion-searchbar');
|
||||
|
||||
expect(await searchbar.screenshot()).toMatchSnapshot(`searchbar-disabled-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
|
||||
test('should render custom search icon', async ({ page, skip }) => {
|
||||
skip.rtl();
|
||||
|
||||
await page.setContent(`
|
||||
<ion-searchbar search-icon="home"></ion-searchbar>
|
||||
`);
|
||||
|
||||
const icon = page.locator('ion-searchbar ion-icon.searchbar-search-icon');
|
||||
|
||||
expect(await icon.screenshot()).toMatchSnapshot(`searchbar-search-icon-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('searchbar: placeholder', () => {
|
||||
test.beforeEach(({ skip }) => {
|
||||
skip.rtl();
|
||||
skip.mode('ios');
|
||||
});
|
||||
test('should set placeholder', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-searchbar placeholder="My Placeholder"></ion-searchbar>
|
||||
`);
|
||||
|
||||
const nativeInput = page.locator('ion-searchbar input');
|
||||
await expect(nativeInput).toHaveAttribute('placeholder', 'My Placeholder');
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 365 KiB |
Before Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 362 KiB |
Before Width: | Height: | Size: 362 KiB |
Before Width: | Height: | Size: 135 KiB |
Before Width: | Height: | Size: 360 KiB |
Before Width: | Height: | Size: 335 KiB |
Before Width: | Height: | Size: 127 KiB |
Before Width: | Height: | Size: 329 KiB |
Before Width: | Height: | Size: 333 KiB |
Before Width: | Height: | Size: 127 KiB |
Before Width: | Height: | Size: 328 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 645 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 553 B |
After Width: | Height: | Size: 1.9 KiB |