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>
This commit is contained in:
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" }, use: { crypto: "rust" },
}, },
], ],
snapshotDir: "playwright/snapshots",
snapshotPathTemplate: "{snapshotDir}/{testFilePath}/{arg}-{platform}{ext}",
}); });

View file

@ -2,5 +2,5 @@
/html-report/ /html-report/
/synapselogs/ /synapselogs/
# Only commit snapshots from Linux # Only commit snapshots from Linux
/e2e/*/*-snapshots/*.png /snapshots/*/*.png
!/e2e/*/*-snapshots/*-linux.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: If you have access to docker then you can use the following:
```shell ```shell
docker build playwright -t matrix-react-sdk-playwright
docker run \ docker run \
--rm \ --rm \
--network host \ --network host \
-v $(pwd)/../:/work/ \ -v $(pwd)/../:/work/ \
-v playwright-ew-node-modules:/work/element-web/node_modules \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/:/tmp/ \ -v /tmp/:/tmp/ \
-w /work/matrix-react-sdk \ -it matrix-react-sdk-playwright
-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"
``` ```

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( await expect(
page.getByRole("dialog").getByRole("heading", { level: 2, name: "Download Element" }), page.getByRole("dialog").getByRole("heading", { level: 2, name: "Download Element" }),
).toBeVisible(); ).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 }) => { test("using find friends action should increase progress", async ({ page, homeserver }) => {