Skip to content

Commit 1539e32

Browse files
authored
Add update-snapshot VScode task (#6377)
1 parent fc75c36 commit 1539e32

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

.vscode/tasks.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@
4141
},
4242
"problemMatcher": []
4343
},
44+
{
45+
"label": "Update e2e snapshots (specific file)",
46+
"command": "bash",
47+
"type": "shell",
48+
"args": [
49+
"-c",
50+
"COMPONENT=\"${input:componentName}\"; if [[ \"$COMPONENT\" == *.test.ts ]]; then TEST_FILE=\"$COMPONENT\"; else TEST_FILE=\"e2e/components/$COMPONENT.test.ts\"; fi; if ! docker --version >/dev/null 2>&1; then echo \"Docker is required for this script to run. Install Docker Desktop from https://www.docker.com/products/docker-desktop/\"; exit 1; elif ! docker info >/dev/null 2>&1; then echo \"Docker installed but not running. Starting Docker Desktop...\"; open -a Docker && echo \"Waiting for Docker to start...\" && while ! docker info >/dev/null 2>&1; do sleep 2; done && echo \"Docker is now running\"; fi; ./script/test-e2e \"$TEST_FILE --update-snapshots\""
51+
],
52+
"group": "test",
53+
"presentation": {
54+
"echo": true,
55+
"reveal": "always",
56+
"focus": false,
57+
"panel": "new"
58+
},
59+
"options": {
60+
"cwd": "${workspaceFolder}"
61+
},
62+
"problemMatcher": []
63+
},
4464
],
4565
"inputs": [
4666
{

e2e/components/IconButton.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ test.describe('IconButton', () => {
8181
}
8282

8383
// Default state
84-
await expect(page).toHaveScreenshot(`IconButton.${story.title}.${theme}.png`, {
85-
animations: 'disabled',
86-
})
84+
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
85+
`IconButton.${story.title}.${theme}.png`,
86+
)
8787
})
8888
})
8989
}

0 commit comments

Comments
 (0)