Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c1f631c
chore(test): configure ui testing in playwright config
amir78729 Mar 19, 2025
a405850
test(buttons): add ui tests
amir78729 Mar 19, 2025
0c9be44
fix(web-components): resolve playwright.config.ts lint issue
amir78729 Mar 19, 2025
2a8e775
test(button): add android screenshots
amir78729 Mar 19, 2025
373bdb1
ci(test): update workflows
amir78729 Mar 25, 2025
07e23a0
test: add html report in ci
amir78729 Mar 25, 2025
bac2507
ci: update workflow messages
amir78729 Mar 25, 2025
fef3ad9
ci(wip): update condition of updating snapshots for test
amir78729 Mar 25, 2025
3055592
ci(wip): update condition of updating snapshots for test
amir78729 Mar 25, 2025
36cb833
ci: format names
amir78729 Mar 25, 2025
03c5ec3
ci: wrap condition of updateing snapshots workflow on ${{ }}
amir78729 Mar 25, 2025
820745a
ci(wip): update condition of updating snapshots for test
amir78729 Mar 25, 2025
830257d
ci: update test workflow message
amir78729 Mar 25, 2025
6c8205c
ci: update test workflow message
amir78729 Mar 25, 2025
663c2ec
ci: update test workflow message
amir78729 Mar 25, 2025
3fa646d
ci(wip): update condition of updating snapshots for test
amir78729 Mar 25, 2025
187a11d
ci(wip): update condition of updating snapshots for test
amir78729 Mar 25, 2025
f3357ba
ci(wip): update condition of updating snapshots for test
amir78729 Mar 25, 2025
c7877f0
ci(wip): update condition of updating snapshots for test
amir78729 Mar 25, 2025
cb0b5cf
chore: resolve conflicts
amir78729 Mar 31, 2025
bea386b
fix: setup pnpm in workflow
amir78729 Mar 31, 2025
3fc7ebf
Merge branch 'main' of github.com:Tap30/web-components into test/ui/b…
amir78729 Apr 5, 2025
d093cff
fix: update snapshot workflow
amir78729 Apr 5, 2025
4795015
fix: update screenshot path
amir78729 Apr 7, 2025
4e8035d
test: update screenshot paths
amir78729 Apr 7, 2025
f105084
fix: remove --ui from test script
amir78729 Apr 7, 2025
afea604
fix: update screenshot path
amir78729 Apr 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 3 additions & 35 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:
- name: ☁️ checkout repository
uses: actions/checkout@v4

- name: "🔧 setup pnpm"
- name: 🔧 setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9

- name: "🔧 setup node"
- name: 🔧 setup node
uses: actions/setup-node@v4
with:
node-version: 20
Expand All @@ -74,36 +74,4 @@ jobs:
uses: google/wireit@setup-github-actions-caching/v2

- name: 🧪 run tests
run: |
pnpm test | tee output.log
if grep -q -e "Error: A snapshot doesn't exist at" -e "Screenshot comparison failed" output.log; then
echo "Playwright tests failed due to a snapshot issue."
echo "SNAPSHOT_DIFFERENCES=true" >> $GITHUB_ENV
exit 1
elif grep -q "failed" output.log; then
echo "Playwright tests failed due to a non-snapshot issue."
exit 1
fi

- name: 🗄️ archive artifacts
uses: actions/upload-artifact@v4
id: artifact-upload
if: ${{ !cancelled() }}
with:
name: playwright-report
path: packages/web-components/playwright-report/
retention-days: 30

- name: ✍️ comment on PR with report link
uses: thollander/actions-comment-pull-request@v3
if: ${{ failure() && env.SNAPSHOT_DIFFERENCES == 'true' }}
with:
message: |
> [!CAUTION]
> Playwright visual snapshot differences were detected.
> You can download the [report](${{ steps.artifact-upload.outputs.artifact-url }}) file.

To approve the snapshot changes and update the snapshots, please comment:
```
/approve-snapshots
```
run: pnpm test
66 changes: 0 additions & 66 deletions .github/workflows/update-snapshots.yml

This file was deleted.

14 changes: 10 additions & 4 deletions packages/web-components/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ export default defineConfig({
retries: process.env.CI ? 2 : undefined,
forbidOnly: !!process.env.CI,
reporter: process.env.CI
? [["github"], ["html", { open: "never" }]]
? [["github"]]
: [["list"], ["html", { open: "never" }]],
projects: [
{
name: "💻 Desktop",
name: "desktop",
use: devices["Desktop Chrome"],
},
// {
// name: "📱 iOS",
// name: "iOS",
// use: devices["iPhone X"],
// },
{
name: "📱 Android",
name: "android",
use: devices["Galaxy S9+"],
},
],
Expand All @@ -35,4 +35,10 @@ export default defineConfig({
timeout: 1000,
},
},
snapshotPathTemplate: `{testDir}/{testFileDir}/test-snapshots/{arg}{ext}`,
expect: {
toHaveScreenshot: {
maxDiffPixels: 100,
},
},
});
46 changes: 46 additions & 0 deletions packages/web-components/src/button/icon-button/icon-button.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,50 @@ describe("🧩 icon-button", () => {
await expect(spinner).toBeVisible();
await expect(root).toHaveAttribute("aria-busy", "true");
});

test("📸 should have correct ui in different variants, sizes and loading states", async ({
page,
}) => {
const sizeValues = ["sm", "md", "lg"];
const loadingValues = [true, false];
const variantValues = [
"primary",
"ghost",
"naked",
"elevated",
"destructive",
"brand",
];

for (const variant of variantValues) {
for (const size of sizeValues) {
for (const loading of loadingValues) {
await render(
page,
`
<tapsi-icon-button
label="test-button"
data-testid="test-button"
variant="${variant}"
size="${size}"
${loading ? "loading" : ""}
>
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M11.9996 22C10.7496 22 9.57878 21.7625 8.48711 21.2875C7.39544 20.8125 6.44544 20.1708 5.63711 19.3625C4.82878 18.5541 4.18711 17.6041 3.71211 16.5125C3.23711 15.4208 2.99961 14.25 2.99961 13C2.99961 11.75 3.23711 10.5791 3.71211 9.48748C4.18711 8.39581 4.82878 7.44581 5.63711 6.63748C6.44544 5.82914 7.39544 5.18748 8.48711 4.71248C9.57878 4.23748 10.7496 3.99998 11.9996 3.99998C13.2496 3.99998 14.4204 4.23748 15.5121 4.71248C16.6038 5.18748 17.5538 5.82914 18.3621 6.63748C19.1704 7.44581 19.8121 8.39581 20.2871 9.48748C20.7621 10.5791 20.9996 11.75 20.9996 13C20.9996 14.25 20.7621 15.4208 20.2871 16.5125C19.8121 17.6041 19.1704 18.5541 18.3621 19.3625C17.5538 20.1708 16.6038 20.8125 15.5121 21.2875C14.4204 21.7625 13.2496 22 11.9996 22ZM14.7996 17.2L16.1996 15.8L12.9996 12.6V7.99998H10.9996V13.4L14.7996 17.2ZM5.59961 2.34998L6.99961 3.74998L2.74961 7.99998L1.34961 6.59998L5.59961 2.34998ZM18.3996 2.34998L22.6496 6.59998L21.2496 7.99998L16.9996 3.74998L18.3996 2.34998ZM11.9996 20C13.9496 20 15.6038 19.3208 16.9621 17.9625C18.3204 16.6041 18.9996 14.95 18.9996 13C18.9996 11.05 18.3204 9.39581 16.9621 8.03748C15.6038 6.67914 13.9496 5.99998 11.9996 5.99998C10.0496 5.99998 8.39544 6.67914 7.03711 8.03748C5.67878 9.39581 4.99961 11.05 4.99961 13C4.99961 14.95 5.67878 16.6041 7.03711 17.9625C8.39544 19.3208 10.0496 20 11.9996 20Z" fill="currentColor"/>
</svg>
</tapsi-icon-button>
`,
);
const component = page.getByTestId("test-button");

const screenshot = `${["icon-button", size, variant, loading && "loading"].filter(Boolean).join("_")}.png`;

await expect(component).toHaveScreenshot(screenshot, {
animations: "disabled", // we disable animations because of the spinner
omitBackground: true,
});
}
}
}
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions packages/web-components/src/button/standard/button.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,48 @@
await expect(spinner).toBeVisible();
await expect(root).toHaveAttribute("aria-busy", "true");
});

test("📸 should have correct ui in different variants, sizes and loading states", async ({
page,
}) => {
const sizeValues = ["sm", "md", "lg"];
const loadingValues = [true, false];
const variantValues = [
"primary",
"ghost",
"naked",
"elevated",
"destructive",
"brand",
];

for (const variant of variantValues) {
for (const size of sizeValues) {
for (const loading of loadingValues) {
await render(
page,
`
<tapsi-button
label="test-button"
data-testid="test-button"
variant="${variant}"
size="${size}"
${loading ? "loading" : ""}
>
عنوان
</tapsi-button>
`,
);
const component = page.getByTestId("test-button");

const screenshot = `${["button", size, variant, loading && "loading"].filter(Boolean).join("_")}.png`;

await expect(component).toHaveScreenshot(screenshot, {

Check failure on line 249 in packages/web-components/src/button/standard/button.test.ts

View workflow job for this annotation

GitHub Actions / 🧪 Run tests

[android] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants

2) [android] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants, sizes and loading states Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toHaveScreenshot(expected) Expected an image 60px by 32px, received 61px by 32px. Expected: /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/test-snapshots/button-sm-primary-loading.png Received: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-android-retry2/button-sm-primary-loading-actual.png Diff: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-android-retry2/button-sm-primary-loading-diff.png Call log: - expect.toHaveScreenshot(button_sm_primary_loading.png) with timeout 5000ms - verifying given screenshot expectation - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - Expected an image 60px by 32px, received 61px by 32px. - waiting 100ms before taking screenshot - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - captured a stable screenshot - Expected an image 60px by 32px, received 61px by 32px. 247 | const screenshot = `${["button", size, variant, loading && "loading"].filter(Boolean).join("_")}.png`; 248 | > 249 | await expect(component).toHaveScreenshot(screenshot, { | ^ 250 | animations: "disabled", // we disable animations because of the spinner 251 | omitBackground: true, 252 | }); at /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/button.test.ts:249:35

Check failure on line 249 in packages/web-components/src/button/standard/button.test.ts

View workflow job for this annotation

GitHub Actions / 🧪 Run tests

[android] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants

2) [android] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants, sizes and loading states Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toHaveScreenshot(expected) Expected an image 60px by 32px, received 61px by 32px. Expected: /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/test-snapshots/button-sm-primary-loading.png Received: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-android-retry1/button-sm-primary-loading-actual.png Diff: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-android-retry1/button-sm-primary-loading-diff.png Call log: - expect.toHaveScreenshot(button_sm_primary_loading.png) with timeout 5000ms - verifying given screenshot expectation - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - Expected an image 60px by 32px, received 61px by 32px. - waiting 100ms before taking screenshot - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - captured a stable screenshot - Expected an image 60px by 32px, received 61px by 32px. 247 | const screenshot = `${["button", size, variant, loading && "loading"].filter(Boolean).join("_")}.png`; 248 | > 249 | await expect(component).toHaveScreenshot(screenshot, { | ^ 250 | animations: "disabled", // we disable animations because of the spinner 251 | omitBackground: true, 252 | }); at /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/button.test.ts:249:35

Check failure on line 249 in packages/web-components/src/button/standard/button.test.ts

View workflow job for this annotation

GitHub Actions / 🧪 Run tests

[android] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants

2) [android] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants, sizes and loading states Error: expect(locator).toHaveScreenshot(expected) Expected an image 60px by 32px, received 61px by 32px. Expected: /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/test-snapshots/button-sm-primary-loading.png Received: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-android/button-sm-primary-loading-actual.png Diff: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-android/button-sm-primary-loading-diff.png Call log: - expect.toHaveScreenshot(button_sm_primary_loading.png) with timeout 5000ms - verifying given screenshot expectation - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - Expected an image 60px by 32px, received 61px by 32px. - waiting 100ms before taking screenshot - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - captured a stable screenshot - Expected an image 60px by 32px, received 61px by 32px. 247 | const screenshot = `${["button", size, variant, loading && "loading"].filter(Boolean).join("_")}.png`; 248 | > 249 | await expect(component).toHaveScreenshot(screenshot, { | ^ 250 | animations: "disabled", // we disable animations because of the spinner 251 | omitBackground: true, 252 | }); at /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/button.test.ts:249:35

Check failure on line 249 in packages/web-components/src/button/standard/button.test.ts

View workflow job for this annotation

GitHub Actions / 🧪 Run tests

[desktop] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants

1) [desktop] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants, sizes and loading states Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toHaveScreenshot(expected) Expected an image 60px by 32px, received 59px by 32px. Expected: /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/test-snapshots/button-sm-primary-loading.png Received: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-desktop-retry2/button-sm-primary-loading-actual.png Diff: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-desktop-retry2/button-sm-primary-loading-diff.png Call log: - expect.toHaveScreenshot(button_sm_primary_loading.png) with timeout 5000ms - verifying given screenshot expectation - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - Expected an image 60px by 32px, received 59px by 32px. - waiting 100ms before taking screenshot - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - captured a stable screenshot - Expected an image 60px by 32px, received 59px by 32px. 247 | const screenshot = `${["button", size, variant, loading && "loading"].filter(Boolean).join("_")}.png`; 248 | > 249 | await expect(component).toHaveScreenshot(screenshot, { | ^ 250 | animations: "disabled", // we disable animations because of the spinner 251 | omitBackground: true, 252 | }); at /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/button.test.ts:249:35

Check failure on line 249 in packages/web-components/src/button/standard/button.test.ts

View workflow job for this annotation

GitHub Actions / 🧪 Run tests

[desktop] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants

1) [desktop] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants, sizes and loading states Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toHaveScreenshot(expected) Expected an image 60px by 32px, received 59px by 32px. Expected: /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/test-snapshots/button-sm-primary-loading.png Received: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-desktop-retry1/button-sm-primary-loading-actual.png Diff: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-desktop-retry1/button-sm-primary-loading-diff.png Call log: - expect.toHaveScreenshot(button_sm_primary_loading.png) with timeout 5000ms - verifying given screenshot expectation - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - Expected an image 60px by 32px, received 59px by 32px. - waiting 100ms before taking screenshot - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - captured a stable screenshot - Expected an image 60px by 32px, received 59px by 32px. 247 | const screenshot = `${["button", size, variant, loading && "loading"].filter(Boolean).join("_")}.png`; 248 | > 249 | await expect(component).toHaveScreenshot(screenshot, { | ^ 250 | animations: "disabled", // we disable animations because of the spinner 251 | omitBackground: true, 252 | }); at /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/button.test.ts:249:35

Check failure on line 249 in packages/web-components/src/button/standard/button.test.ts

View workflow job for this annotation

GitHub Actions / 🧪 Run tests

[desktop] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants

1) [desktop] › src/button/standard/button.test.ts:214:3 › 🧩 button › 📸 should have correct ui in different variants, sizes and loading states Error: expect(locator).toHaveScreenshot(expected) Expected an image 60px by 32px, received 59px by 32px. Expected: /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/test-snapshots/button-sm-primary-loading.png Received: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-desktop/button-sm-primary-loading-actual.png Diff: /home/runner/work/web-components/web-components/packages/web-components/test-results/button-standard-button-🧩--58ed5-ts-sizes-and-loading-states-desktop/button-sm-primary-loading-diff.png Call log: - expect.toHaveScreenshot(button_sm_primary_loading.png) with timeout 5000ms - verifying given screenshot expectation - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - Expected an image 60px by 32px, received 59px by 32px. - waiting 100ms before taking screenshot - waiting for getByTestId('test-button') - locator resolved to <tapsi-button size="sm" loading="" tabindex="0" variant="primary" label="test-button" data-testid="test-button">↵ عنوان↵ </tapsi-button> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - captured a stable screenshot - Expected an image 60px by 32px, received 59px by 32px. 247 | const screenshot = `${["button", size, variant, loading && "loading"].filter(Boolean).join("_")}.png`; 248 | > 249 | await expect(component).toHaveScreenshot(screenshot, { | ^ 250 | animations: "disabled", // we disable animations because of the spinner 251 | omitBackground: true, 252 | }); at /home/runner/work/web-components/web-components/packages/web-components/src/button/standard/button.test.ts:249:35
animations: "disabled", // we disable animations because of the spinner
omitBackground: true,
});
}
}
}
});
});
Loading