Consolidate snapshots between Legacy & Rust crypto in the happy case (#11950)

* Consolidate snapshots between Legacy & Rust crypto in the happy case

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Improve user-onboarding-new screenshot

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/28217/head
Michael Telatynski 2023-11-28 10:22:25 +00:00 committed by GitHub
parent d47f856ba0
commit dbae856141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 22 additions and 7 deletions

View File

@ -46,4 +46,6 @@ export default defineConfig<TestOptions>({
use: { crypto: "rust" },
},
],
snapshotDir: "playwright/snapshots",
snapshotPathTemplate: "{snapshotDir}/{testFilePath}/{arg}-{platform}{ext}",
});

View File

@ -2,5 +2,5 @@
/html-report/
/synapselogs/
# Only commit snapshots from Linux
/e2e/*/*-snapshots/*.png
!/e2e/*/*-snapshots/*-linux.png
/snapshots/*/*.png
!/snapshots/*/*-linux.png

9
playwright/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM mcr.microsoft.com/playwright:v1.40.0-jammy
WORKDIR /work/matrix-react-sdk
VOLUME ["/work/element-web/node_modules"]
RUN apt-get update && apt-get -y install docker.io
COPY docker-entrypoint.sh /opt/docker-entrypoint.sh
ENTRYPOINT ["bash", "/opt/docker-entrypoint.sh"]

View File

@ -2,14 +2,12 @@ To update snapshots you will need to run Playwright on a Linux machine.
If you have access to docker then you can use the following:
```shell
docker build playwright -t matrix-react-sdk-playwright
docker run \
--rm \
--network host \
-v $(pwd)/../:/work/ \
-v playwright-ew-node-modules:/work/element-web/node_modules \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/:/tmp/ \
-w /work/matrix-react-sdk \
-it mcr.microsoft.com/playwright:v1.40.0-jammy \
sh -c "apt-get update && apt-get -y install docker.io && yarn --cwd ../element-web install && npx playwright test --update-snapshots --reporter line"
-it matrix-react-sdk-playwright
```

View File

@ -0,0 +1,6 @@
#!/bin/bash
set -e
yarn --cwd ../element-web install
npx playwright test --update-snapshots --reporter line --project='Legacy Crypto' $1

View File

@ -45,7 +45,7 @@ test.describe("User Onboarding (new user)", () => {
await expect(
page.getByRole("dialog").getByRole("heading", { level: 2, name: "Download Element" }),
).toBeVisible();
await expect(page.getByRole("dialog")).toHaveScreenshot();
await expect(page.locator(".mx_Dialog")).toHaveScreenshot();
});
test("using find friends action should increase progress", async ({ page, homeserver }) => {