diff --git a/README.md b/README.md index ffb516b90a..4569a1f8fe 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,6 @@ ![Static Analysis](https://github.com/matrix-org/matrix-react-sdk/actions/workflows/static_analysis.yaml/badge.svg) [![Knapsack Pro Parallel CI builds for Cypress Test - Legacy Crypto](https://img.shields.io/badge/Knapsack%20Pro-Parallel%20%2F%20Cypress%20Test%20--%20Legacy%20Crypto-%230074ff)](https://knapsackpro.com/dashboard/organizations/3882/projects/2469/test_suites/3724/builds?utm_campaign=organization-id-3882&utm_content=test-suite-id-3724&utm_medium=readme&utm_source=knapsack-pro-badge&utm_term=project-id-2469) [![Knapsack Pro Parallel CI builds for Cypress Test - Rust Crypto](https://img.shields.io/badge/Knapsack%20Pro-Parallel%20%2F%20Cypress%20Test%20--%20Rust%20Crypto-%230074ff)](https://knapsackpro.com/dashboard/organizations/3882/projects/2469/test_suites/3729/builds?utm_campaign=organization-id-3882&utm_content=test-suite-id-3729&utm_medium=readme&utm_source=knapsack-pro-badge&utm_term=project-id-2469) - - - [![Localazy](https://img.shields.io/endpoint?url=https%3A%2F%2Fconnect.localazy.com%2Fstatus%2Felement-web%2Fdata%3Fcontent%3Dall%26title%3Dlocalazy%26logo%3Dtrue)](https://localazy.com/p/element-web) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=matrix-react-sdk&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=matrix-react-sdk) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=matrix-react-sdk&metric=coverage)](https://sonarcloud.io/summary/new_code?id=matrix-react-sdk) diff --git a/playwright.config.ts b/playwright.config.ts index 4c5c2bdfa5..fbc33869da 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -22,7 +22,6 @@ const baseURL = process.env["BASE_URL"] ?? "http://localhost:8080"; export default defineConfig({ use: { - headless: false, viewport: { width: 1280, height: 720 }, ignoreHTTPSErrors: true, video: "on-first-retry", diff --git a/playwright/.gitignore b/playwright/.gitignore index 7ee0f07a88..3ffefa9111 100644 --- a/playwright/.gitignore +++ b/playwright/.gitignore @@ -1,3 +1,6 @@ /test-results/ /html-report/ /synapselogs/ +# Only commit snapshots from Linux +/e2e/*/*-snapshots/*.png +!/e2e/*/*-snapshots/*-linux.png diff --git a/playwright/README.md b/playwright/README.md new file mode 100644 index 0000000000..0003828c88 --- /dev/null +++ b/playwright/README.md @@ -0,0 +1,15 @@ +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 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" +``` diff --git a/playwright/e2e/register/email.spec.ts b/playwright/e2e/register/email.spec.ts index 4f71bd4042..f00950cfdd 100644 --- a/playwright/e2e/register/email.spec.ts +++ b/playwright/e2e/register/email.spec.ts @@ -59,7 +59,7 @@ test.describe("Email Registration", async () => { }) => { await expect(page.getByRole("textbox", { name: "Username" })).toBeVisible(); // Hide the server text as it contains the randomly allocated Homeserver port - // const percyCSS = ".mx_ServerPicker_server { visibility: hidden !important; }"; // XXX: Percy + const screenshotOptions = { mask: [page.locator(".mx_ServerPicker_server")] }; await page.getByRole("textbox", { name: "Username" }).fill("alice"); await page.getByPlaceholder("Password", { exact: true }).fill("totally a great password"); @@ -68,7 +68,7 @@ test.describe("Email Registration", async () => { await page.getByRole("button", { name: "Register" }).click(); await expect(page.getByText("Check your email to continue")).toBeVisible(); - // cy.percySnapshot("Registration check your email", { percyCSS }); // XXX: Percy + await expect(page).toHaveScreenshot("registration_check_your_email.png", screenshotOptions); await checkA11y(); await expect(page.getByText("An error was encountered when sending the email")).not.toBeVisible(); diff --git a/playwright/e2e/register/email.spec.ts-snapshots/registration-check-your-email-Legacy-Crypto-linux.png b/playwright/e2e/register/email.spec.ts-snapshots/registration-check-your-email-Legacy-Crypto-linux.png new file mode 100644 index 0000000000..2c63adacd1 Binary files /dev/null and b/playwright/e2e/register/email.spec.ts-snapshots/registration-check-your-email-Legacy-Crypto-linux.png differ diff --git a/playwright/e2e/register/email.spec.ts-snapshots/registration-check-your-email-Rust-Crypto-linux.png b/playwright/e2e/register/email.spec.ts-snapshots/registration-check-your-email-Rust-Crypto-linux.png new file mode 100644 index 0000000000..2c63adacd1 Binary files /dev/null and b/playwright/e2e/register/email.spec.ts-snapshots/registration-check-your-email-Rust-Crypto-linux.png differ diff --git a/playwright/plugins/synapse/index.ts b/playwright/plugins/synapse/index.ts index 8095266e75..432fe006d7 100644 --- a/playwright/plugins/synapse/index.ts +++ b/playwright/plugins/synapse/index.ts @@ -114,7 +114,7 @@ export class Synapse implements Homeserver, HomeserverInstance { * one of the templates in the playwright/plugins/synapsedocker/templates * directory. * - * Any value in opts.variables that is set to `{{HOST_DOCKER_INTERNAL}}' + * Any value in `opts.variables` that is set to `{{HOST_DOCKER_INTERNAL}}' * will be replaced with 'host.docker.internal' (if we are on Docker) or * 'host.containers.internal' if we are on Podman. */