Compare commits

...

48 Commits

Author SHA1 Message Date
Michael Telatynski
3d2361257a Merge branch 'develop' of https://github.com/vector-im/element-web into t3chguy/playwright-tenbin
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

# Conflicts:
#	.github/workflows/end-to-end-tests.yaml
#	package.json
#	playwright/e2e/crypto/backups-mas.spec.ts
#	playwright/e2e/csAPI.ts
#	playwright/e2e/login/utils.ts
#	playwright/e2e/right-panel/right-panel.spec.ts
#	playwright/e2e/spotlight/spotlight.spec.ts
#	playwright/element-web-test.ts
#	playwright/pages/client.ts
#	playwright/plugins/homeserver/index.ts
#	playwright/plugins/homeserver/synapse/legacyOAuthHomeserver.ts
#	playwright/plugins/oauth_server/index.ts
#	playwright/services.ts
#	playwright/testcontainers/HomeserverContainer.ts
#	playwright/testcontainers/dendrite.ts
#	playwright/testcontainers/mas.ts
#	playwright/testcontainers/synapse.ts
#	playwright/testcontainers/utils.ts
#	yarn.lock
2025-03-17 14:16:06 +00:00
Michael Telatynski
ed874c36c2 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-13 15:44:59 +00:00
Michael Telatynski
990b4b914d Merge branch 't3chguy/flaky-tests-10jan' of https://github.com/vector-im/element-web into t3chguy/playwright-tenbin 2025-01-13 15:22:21 +00:00
Michael Telatynski
2cd40884a1 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-13 15:11:34 +00:00
Michael Telatynski
0124584caa Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-13 14:46:11 +00:00
Michael Telatynski
0aea827f10 Merge remote-tracking branch 'origin/t3chguy/flaky-tests-10jan' into t3chguy/flaky-tests-10jan 2025-01-13 12:06:58 +00:00
Michael Telatynski
7de0dddd34 Merge branch 't3chguy/flaky-playwright-13jan' of https://github.com/vector-im/element-web into t3chguy/flaky-tests-10jan
# Conflicts:
#	playwright/services.ts
#	playwright/stale-screenshot-reporter.ts
#	playwright/testcontainers/mas.ts
#	playwright/testcontainers/synapse.ts
2025-01-13 12:06:49 +00:00
Michael Telatynski
d27b55841f Fix another flaky test
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-13 12:02:00 +00:00
Michael Telatynski
7fbf9ef269 Fix mas config
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-13 11:47:32 +00:00
Michael Telatynski
d7a1c307da Fix flaky tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-13 11:10:59 +00:00
Michael Telatynski
c25a2f4859 Merge branch 'develop' into t3chguy/flaky-tests-10jan 2025-01-13 11:05:04 +00:00
Michael Telatynski
84dfc5d22d Fix flaky tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-13 10:43:56 +00:00
Michael Telatynski
c8e46251f5 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-13 08:57:08 +00:00
Michael Telatynski
5e9066ec8c Deflake more tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-13 08:22:20 +00:00
Michael Telatynski
c1c98d37fc delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-13 07:41:44 +00:00
Michael Telatynski
344a7a07e3 Merge branch 't3chguy/flaky-tests-10jan2' of https://github.com/vector-im/element-web into t3chguy/flaky-tests-10jan 2025-01-13 07:41:06 +00:00
Michael Telatynski
6e36a1ff9c Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 19:02:03 +00:00
Michael Telatynski
f03ad7b8ab Delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 18:42:42 +00:00
Michael Telatynski
6a62ae50e8 Wipe mailhog between test runs
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 18:40:14 +00:00
Michael Telatynski
ad0b86c1eb Fix playwright flaky tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 18:17:20 +00:00
Michael Telatynski
0f6f047159 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 18:09:29 +00:00
Michael Telatynski
1a98f8cead Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 18:07:43 +00:00
Michael Telatynski
71f06cd258 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 17:51:40 +00:00
Michael Telatynski
8b3ffb4b3f Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 13:59:18 +00:00
Michael Telatynski
548d45af88 Fix missing _request
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 13:17:58 +00:00
Michael Telatynski
8f68dbb4f3 Fix more flakes
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 12:51:32 +00:00
Michael Telatynski
db47e68903 Clean mailhog between tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 11:48:37 +00:00
Michael Telatynski
c25c8a3b9a Deflake more tests using existing username
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 11:48:26 +00:00
Michael Telatynski
b7b650e0fc Deflake spotlight when homeserver is reused
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 11:38:12 +00:00
Michael Telatynski
3eeb2216f9 Clean up public rooms between tests on reused homeserver
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 11:37:49 +00:00
Michael Telatynski
b203e4b2a5 Fix stale-screenshot-reporter.ts
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 11:37:20 +00:00
Michael Telatynski
1b8f62abe2 Avoid reusing user1234
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 11:37:11 +00:00
Michael Telatynski
45607bb72f Docs
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 11:36:20 +00:00
Michael Telatynski
6d34a29061 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-10 10:01:40 +00:00
Michael Telatynski
c7394cd572 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 17:26:31 +00:00
Michael Telatynski
fb08be7608 Fix sharding
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 17:09:41 +00:00
Michael Telatynski
eea3db2650 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 17:00:24 +00:00
Michael Telatynski
d8eb4ce173 Yay?
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 16:28:44 +00:00
Michael Telatynski
100094482a Fix sharding
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 15:56:43 +00:00
Michael Telatynski
b1a9202036 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 15:27:53 +00:00
Michael Telatynski
d00ac8e279 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 15:09:54 +00:00
Michael Telatynski
e519d2c048 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 14:49:22 +00:00
Michael Telatynski
0fafd04048 merge-multiple broken
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 14:30:01 +00:00
Michael Telatynski
cc2a94d904 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 14:18:52 +00:00
Michael Telatynski
8477d09d36 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 14:04:45 +00:00
Michael Telatynski
034e11abe7 Use @tenbin/jest
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 13:59:27 +00:00
Michael Telatynski
6a7aa172c4 Fix import
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 13:36:51 +00:00
Michael Telatynski
b394f5e186 Speed up playwright runs by sharding using tenbin
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-01-09 13:26:43 +00:00
6 changed files with 114 additions and 22 deletions

View File

@@ -54,6 +54,17 @@ jobs:
with:
repository: element-hq/element-web
# Restore playwright-results.json file, which records the execution time of each test file.
# The splitTests function uses this file for sharding.
# We do this in the build stage to ensure it remains consistent if a playwright test got manually restarted
- name: Restore playwright-results.json
uses: actions/cache/restore@v4
with:
path: playwright-results.json
key: playwright-results
restore-keys: |
playwright-results-*
- uses: actions/setup-node@v4
with:
cache: "yarn"
@@ -77,15 +88,17 @@ jobs:
env:
CI_PACKAGE: true
VERSION: "${{ steps.layered_build.outputs.VERSION }}"
run: |
yarn build
run: yarn build
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: webapp
path: webapp
name: build
path: |
webapp
playwright-results.json
retention-days: 1
if-no-files-found: error
- name: Calculate runner variables
id: runner-vars
@@ -128,6 +141,8 @@ jobs:
project: Dendrite
- runAllTests: false
project: Pinecone
env:
SHARD_BLOB_NAME: blob-report-${{ matrix.project }}-${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
@@ -137,8 +152,7 @@ jobs:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: webapp
path: webapp
name: build
- uses: actions/setup-node@v4
with:
@@ -174,63 +188,77 @@ jobs:
- name: Run Playwright tests
run: |
yarn playwright test \
--shard "${{ matrix.runner }}/${{ needs.build.outputs.num-runners }}" \
--project="${{ matrix.project }}" \
${{ (github.event_name == 'pull_request' && matrix.runAllTests == false ) && '--grep-invert @mergequeue' || '' }}
env:
SHARD: "${{ matrix.runner }}/${{ needs.build.outputs.num-runners }}"
PLAYWRIGHT_BLOB_OUTPUT_FILE: ${{ env.SHARD_BLOB_NAME }}.zip
- name: Upload blob report to GitHub Actions Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: all-blob-reports-${{ matrix.project }}-${{ matrix.runner }}
path: blob-report
name: ${{ env.SHARD_BLOB_NAME }}
path: ${{ env.SHARD_BLOB_NAME }}.zip
retention-days: 1
if-no-files-found: error
complete:
name: end-to-end-tests
report:
name: Report results
needs: playwright
if: always()
if: ${{ !cancelled() && inputs.skip != true }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
if: inputs.skip != true
with:
persist-credentials: false
repository: element-hq/element-web
- uses: actions/setup-node@v4
if: inputs.skip != true
with:
cache: "yarn"
node-version: "lts/*"
- name: Install dependencies
if: inputs.skip != true
run: yarn install --frozen-lockfile
- name: Download blob reports from GitHub Actions Artifacts
if: inputs.skip != true
uses: actions/download-artifact@v4
with:
pattern: all-blob-reports-*
pattern: blob-report-*
path: all-blob-reports
merge-multiple: true
- name: Merge into HTML Report
if: inputs.skip != true
run: yarn playwright merge-reports --reporter=html,./playwright/flaky-reporter.ts,./playwright/stale-screenshot-reporter.ts ./all-blob-reports
run: yarn playwright merge-reports --reporter=html,json,./playwright/flaky-reporter.ts,./playwright/stale-screenshot-reporter.ts ./all-blob-reports
env:
# Only pass creds to the flaky-reporter on main branch runs
GITHUB_TOKEN: ${{ github.ref_name == 'develop' && secrets.ELEMENT_BOT_TOKEN || '' }}
PLAYWRIGHT_JSON_OUTPUT_NAME: playwright-results.json
- name: Cache playwright-results.json
uses: actions/cache/save@v4
with:
path: playwright-results.json
key: playwright-results-${{ github.run_id }}
# Upload the HTML report even if one of our reporters fails, this can happen when stale screenshots are detected
- name: Upload HTML report
if: always() && inputs.skip != true
if: always()
uses: actions/upload-artifact@v4
with:
name: html-report
path: playwright-report
retention-days: 14
if-no-files-found: error
- if: needs.playwright.result != 'skipped' && needs.playwright.result != 'success'
complete:
name: end-to-end-tests
needs:
- playwright
- report
if: ${{ !cancelled() }}
runs-on: ubuntu-24.04
steps:
- if: needs.playwright.result == 'failure' || needs.report.result == 'failure'
run: exit 1

View File

@@ -64,6 +64,16 @@ jobs:
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2
# Restore tenbin-report.json file, which records the execution time of each test file.
# @tenbin/jest/sequencer uses this file for sharding.
- name: Restore tenbin-report.json
uses: actions/cache/restore@v4
with:
path: tenbin-report.json
key: tenbin-report
restore-keys: |
tenbin-report-*
- name: Run tests
run: |
yarn test \
@@ -78,6 +88,13 @@ jobs:
# tell jest to use coloured output
FORCE_COLOR: true
# @tenbin/jest/reporter generates tenbin-report.json for each shard.
- name: Upload tenbin-report.json
uses: actions/upload-artifact@v4
with:
name: tenbin-report-${{ matrix.runner }}
path: tenbin-report.json
- name: Move coverage files into place
if: env.ENABLE_COVERAGE == 'true'
run: mv coverage/lcov.info coverage/${{ steps.setupNode.outputs.node-version }}-${{ matrix.runner }}.lcov.info
@@ -112,3 +129,16 @@ jobs:
context: SonarCloud Code Analysis
sha: ${{ github.sha }}
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
# Download, merge & upload tenbin-report.json
- uses: actions/download-artifact@v4
with:
path: tenbin-report
pattern: tenbin-report-*
- name: Merge tenbin-report
run: jq -s add tenbin-report/**/tenbin-report.json > tenbin-report.json
- name: Cache tenbin-report.json
uses: actions/cache/save@v4
with:
path: tenbin-report.json
key: tenbin-report-${{ github.run_id }}

View File

@@ -54,11 +54,12 @@ const config: Config = {
testResultsProcessor: "@casualbot/jest-sonar-reporter",
prettierPath: null,
moduleDirectories: ["node_modules", "test/test-utils"],
testSequencer: "@tenbin/jest/sequencer",
};
// if we're running under GHA, enable the GHA reporter
if (env["GITHUB_ACTIONS"] !== undefined) {
const reporters: Config["reporters"] = [["github-actions", { silent: false }], "summary"];
const reporters: Config["reporters"] = [["github-actions", { silent: false }], "summary", "@tenbin/jest/reporter"];
// if we're running against the develop branch, also enable the slow test reporter
if (env["GITHUB_REF"] == "refs/heads/develop") {

View File

@@ -184,6 +184,8 @@
"@sentry/webpack-plugin": "^3.0.0",
"@stylistic/eslint-plugin": "^3.0.0",
"@svgr/webpack": "^8.0.0",
"@tenbin/jest": "^0.5.0",
"@tenbin/playwright": "^0.5.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",

View File

@@ -7,6 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import { defineConfig, devices } from "@playwright/test";
import { splitTests } from "@tenbin/playwright";
import { type WorkerOptions } from "./playwright/services";
@@ -93,4 +94,11 @@ export default defineConfig<WorkerOptions>({
snapshotDir: "playwright/snapshots",
snapshotPathTemplate: "{snapshotDir}/{testFilePath}/{arg}-{platform}{ext}",
forbidOnly: !!process.env.CI,
testMatch: process.env.SHARD
? splitTests({
shard: process.env.SHARD,
pattern: ["playwright/e2e/**/*.spec.ts"],
reportFile: "playwright-results.json",
})
: undefined,
});

View File

@@ -2763,6 +2763,29 @@
"@svgr/plugin-jsx" "8.1.0"
"@svgr/plugin-svgo" "8.1.0"
"@tenbin/core@0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@tenbin/core/-/core-0.5.0.tgz#394f74d90e618e9c15a1f376871a5247b06e35d7"
integrity sha512-QawJTsn1svoLDJipr0dDl/L3npkiMmA1pO5OfveoV6/hajQSrEI0QJtxg/kXMyi0P+EUJ55KL0BVsDkh78OvZA==
"@tenbin/jest@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@tenbin/jest/-/jest-0.5.0.tgz#5f89396de18d5aa1f78d91926cf8941be89aa2e5"
integrity sha512-CWjyHGMzibiQWJYXuXEsiPgEmXPjoPfRJItTFbvNEmW4lWazuMsQcihxs4ZpyCUq8LxDDMFYf2Egt7ZMjsTEQA==
dependencies:
"@jest/test-sequencer" "^29.7.0"
"@tenbin/core" "0.5.0"
picocolors "^1.1.0"
"@tenbin/playwright@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@tenbin/playwright/-/playwright-0.5.0.tgz#8203d3419144fb812430663cc6362658df462abd"
integrity sha512-ApHQnl7a4avRa89CmDA+3C01MIxavV4HPtEmgXMvc8zg5AbFlmb+bu2VPQMtqfm4u4UgY0J/oO8SLjBABF5VCw==
dependencies:
"@tenbin/core" "0.5.0"
glob "^11.0.0"
picocolors "^1.1.0"
"@testcontainers/postgresql@^10.18.0":
version "10.19.0"
resolved "https://registry.yarnpkg.com/@testcontainers/postgresql/-/postgresql-10.19.0.tgz#e1ff9fbfee76c23bc899865524ee8e2ee297bdf2"