test(checkbox): migrate tests to Playwright (#25647)
12
core/src/components/checkbox/test/basic/checkbox.e2e.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
test.describe('checkbox: basic', () => {
|
||||||
|
test('should not have visual regressions', async ({ page }) => {
|
||||||
|
await page.goto(`/src/components/checkbox/test/basic`);
|
||||||
|
|
||||||
|
await page.setIonViewport();
|
||||||
|
|
||||||
|
expect(await page.screenshot()).toMatchSnapshot(`checkbox-basic-${page.getSnapshotSettings()}.png`);
|
||||||
|
});
|
||||||
|
});
|
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 107 KiB |
@ -1,10 +0,0 @@
|
|||||||
import { newE2EPage } from '@stencil/core/testing';
|
|
||||||
|
|
||||||
test('checkbox: basic', async () => {
|
|
||||||
const page = await newE2EPage({
|
|
||||||
url: '/src/components/checkbox/test/basic?ionic:_testing=true',
|
|
||||||
});
|
|
||||||
|
|
||||||
const compare = await page.compareScreenshot();
|
|
||||||
expect(compare).toMatchScreenshot();
|
|
||||||
});
|
|
@ -44,7 +44,7 @@
|
|||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label>Secondary</ion-label>
|
<ion-label>Secondary, disabled</ion-label>
|
||||||
<ion-checkbox disabled checked color="secondary"></ion-checkbox>
|
<ion-checkbox disabled checked color="secondary"></ion-checkbox>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
@ -64,7 +64,7 @@
|
|||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label>Dark</ion-label>
|
<ion-label>Dark, --size</ion-label>
|
||||||
<ion-checkbox checked color="dark" style="--size: 100px"></ion-checkbox>
|
<ion-checkbox checked color="dark" style="--size: 100px"></ion-checkbox>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
@ -83,11 +83,6 @@
|
|||||||
<ion-checkbox checked color="medium" slot="start"></ion-checkbox>
|
<ion-checkbox checked color="medium" slot="start"></ion-checkbox>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-item>
|
|
||||||
<ion-label>Dark</ion-label>
|
|
||||||
<ion-checkbox checked color="dark" slot="start" style="--size: 100px"></ion-checkbox>
|
|
||||||
</ion-item>
|
|
||||||
|
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label>Checkmark width</ion-label>
|
<ion-label>Checkmark width</ion-label>
|
||||||
<ion-checkbox checked color="dark" slot="start" style="--checkmark-width: 7"></ion-checkbox>
|
<ion-checkbox checked color="dark" slot="start" style="--checkmark-width: 7"></ion-checkbox>
|
||||||
@ -109,33 +104,5 @@
|
|||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</ion-app>
|
</ion-app>
|
||||||
|
|
||||||
<script>
|
|
||||||
const inputs = document.querySelectorAll('ion-checkbox');
|
|
||||||
|
|
||||||
for (var i = 0; i < inputs.length; i++) {
|
|
||||||
const input = inputs[i];
|
|
||||||
|
|
||||||
input.addEventListener('ionBlur', function () {
|
|
||||||
console.log('Listen ionBlur: fired');
|
|
||||||
});
|
|
||||||
|
|
||||||
input.addEventListener('ionFocus', function () {
|
|
||||||
console.log('Listen ionFocus: fired');
|
|
||||||
});
|
|
||||||
|
|
||||||
input.addEventListener('ionChange', function (ev) {
|
|
||||||
console.log('Listen ionChange: fired', ev.detail);
|
|
||||||
});
|
|
||||||
|
|
||||||
input.addEventListener('click', function () {
|
|
||||||
console.log('Listen click: fired');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const clickItem = () => {
|
|
||||||
console.log('Item click: fired');
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
test.describe('checkbox: indeterminate', () => {
|
||||||
|
test('should not have visual regressions', async ({ page }) => {
|
||||||
|
await page.goto(`/src/components/checkbox/test/indeterminate`);
|
||||||
|
|
||||||
|
await page.setIonViewport();
|
||||||
|
|
||||||
|
expect(await page.screenshot()).toMatchSnapshot(`checkbox-indeterminate-${page.getSnapshotSettings()}.png`);
|
||||||
|
});
|
||||||
|
});
|
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 67 KiB |
@ -1,10 +0,0 @@
|
|||||||
import { newE2EPage } from '@stencil/core/testing';
|
|
||||||
|
|
||||||
test('checkbox: indeterminate', async () => {
|
|
||||||
const page = await newE2EPage({
|
|
||||||
url: '/src/components/checkbox/test/indeterminate?ionic:_testing=true',
|
|
||||||
});
|
|
||||||
|
|
||||||
const compare = await page.compareScreenshot();
|
|
||||||
expect(compare).toMatchScreenshot();
|
|
||||||
});
|
|
@ -23,45 +23,6 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content id="content">
|
<ion-content id="content">
|
||||||
<ion-list-header>
|
|
||||||
<ion-label> Native </ion-label>
|
|
||||||
</ion-list-header>
|
|
||||||
|
|
||||||
<div class="ion-padding-start">
|
|
||||||
<!-- Default to unchecked -->
|
|
||||||
<label for="unchecked">Unchecked</label>
|
|
||||||
<input name="unchecked" id="unchecked" type="checkbox" />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<!-- Default to checked -->
|
|
||||||
<label for="checked">Checked</label>
|
|
||||||
<input name="checked" id="checked" type="checkbox" checked />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<!-- Default to indeterminate -->
|
|
||||||
<label for="indeterminate">Indeterminate</label>
|
|
||||||
<input name="indeterminate" id="indeterminate" type="checkbox" class="indeterminate" />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<!-- Default to checked / indeterminate -->
|
|
||||||
<label for="both">Checked / Indeterminate</label>
|
|
||||||
<input name="both" id="both" type="checkbox" checked class="indeterminate" />
|
|
||||||
<br />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ion-list-header>
|
|
||||||
<ion-label> Ionic </ion-label>
|
|
||||||
</ion-list-header>
|
|
||||||
<ion-item>
|
|
||||||
<ion-label>Unchecked</ion-label>
|
|
||||||
<ion-checkbox slot="end"></ion-checkbox>
|
|
||||||
</ion-item>
|
|
||||||
|
|
||||||
<ion-item>
|
|
||||||
<ion-label>Checked</ion-label>
|
|
||||||
<ion-checkbox slot="end" checked></ion-checkbox>
|
|
||||||
</ion-item>
|
|
||||||
|
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label>Indeterminate</ion-label>
|
<ion-label>Indeterminate</ion-label>
|
||||||
<ion-checkbox slot="end" indeterminate></ion-checkbox>
|
<ion-checkbox slot="end" indeterminate></ion-checkbox>
|
||||||
|
12
core/src/components/checkbox/test/standalone/checkbox.e2e.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
test.describe('checkbox: standalone', () => {
|
||||||
|
test('should not have visual regressions', async ({ page }) => {
|
||||||
|
await page.goto(`/src/components/checkbox/test/standalone`);
|
||||||
|
|
||||||
|
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot(
|
||||||
|
`checkbox-standalone-${page.getSnapshotSettings()}.png`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 85 KiB |
@ -1,10 +0,0 @@
|
|||||||
import { newE2EPage } from '@stencil/core/testing';
|
|
||||||
|
|
||||||
test('checkbox: standalone', async () => {
|
|
||||||
const page = await newE2EPage({
|
|
||||||
url: '/src/components/checkbox/test/standalone?ionic:_testing=true',
|
|
||||||
});
|
|
||||||
|
|
||||||
const compare = await page.compareScreenshot();
|
|
||||||
expect(compare).toMatchScreenshot();
|
|
||||||
});
|
|