Skip to content

Commit 3fc9ebc

Browse files
authored
Merge pull request #9165 from nextcloud/backport/collectives-599/stable35
[stable35] Backport version comparison stack (#9047-#9050)
2 parents a0cbcae + 4b154ac commit 3fc9ebc

68 files changed

Lines changed: 10257 additions & 99 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/playwright.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,21 @@ jobs:
5555
npm run build --if-present
5656
5757
- name: Install Playwright Browsers
58-
run: npx playwright install chromium --only-shell
58+
run: npx playwright install --with-deps chromium webkit
5959

6060
- name: Run Playwright tests
6161
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
62+
env:
63+
TEXT_COMPARISON_E2E: '1'
6264

6365
- name: Upload results
6466
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
6567
if: ${{ !cancelled() }}
6668
with:
6769
name: playwright-report_shard${{ matrix.shardIndex }}
68-
path: test-results/
70+
path: |
71+
test-results/
72+
blob-report/
6973
retention-days: 7
7074

7175
summary:

package-lock.json

Lines changed: 28 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"@tiptap/vue-3": "^3.30.5",
8080
"@vueuse/shared": "^14.4.0",
8181
"debounce": "^3.0.0",
82+
"diff": "^8.0.4",
8283
"escape-html": "^1.0.3",
8384
"highlight.js": "^11.12.0",
8485
"katex": "^0.18.4",
@@ -108,6 +109,7 @@
108109
"yjs": "^13.6.32"
109110
},
110111
"devDependencies": {
112+
"@axe-core/playwright": "^4.13.0",
111113
"@nextcloud/babel-config": "^1.3.0",
112114
"@nextcloud/browserslist-config": "^3.1.2",
113115
"@nextcloud/e2e-test-server": "^0.5.1",

playwright.config.ts

Lines changed: 77 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,57 @@
22
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5+
/* eslint-disable jsdoc/require-jsdoc */
56

67
import type { ReporterDescription } from '@playwright/test'
78

89
import { defineConfig, devices } from '@playwright/test'
910

11+
const COMPARISON_E2E = process.env.TEXT_COMPARISON_E2E === '1'
12+
const COMPARISON_TESTS = /playwright\/comparison\/.*\.spec\.ts/
13+
const COMPARISON_BASE_URL = process.env.TEXT_COMPARISON_BASE_URL || process.env.baseURL || 'http://localhost:8089/index.php/'
14+
const EXTERNAL_COMPARISON_SERVER = Boolean(process.env.TEXT_COMPARISON_BASE_URL || process.env.baseURL)
15+
16+
function comparisonProjects() {
17+
if (!COMPARISON_E2E) {
18+
return []
19+
}
20+
return [{
21+
name: 'comparison-chromium',
22+
testMatch: COMPARISON_TESTS,
23+
grepInvert: /@memory/,
24+
use: {
25+
...devices['Desktop Chrome'],
26+
baseURL: COMPARISON_BASE_URL,
27+
ignoreHTTPSErrors: true,
28+
screenshot: 'only-on-failure' as const,
29+
trace: 'retain-on-failure' as const,
30+
},
31+
}, {
32+
name: 'comparison-webkit',
33+
testMatch: COMPARISON_TESTS,
34+
grepInvert: /@memory/,
35+
use: {
36+
...devices['Desktop Safari'],
37+
baseURL: COMPARISON_BASE_URL,
38+
ignoreHTTPSErrors: true,
39+
screenshot: 'only-on-failure' as const,
40+
trace: 'retain-on-failure' as const,
41+
},
42+
}, {
43+
name: 'comparison-chromium-memory',
44+
testMatch: COMPARISON_TESTS,
45+
grep: /@memory/,
46+
use: {
47+
...devices['Desktop Chrome'],
48+
baseURL: COMPARISON_BASE_URL,
49+
ignoreHTTPSErrors: true,
50+
screenshot: 'only-on-failure' as const,
51+
trace: 'retain-on-failure' as const,
52+
},
53+
}]
54+
}
55+
1056
/**
1157
* Used locally - i.e. if `CI` is not set as an environment variable.
1258
*/
@@ -24,55 +70,62 @@ const CI_CONFIG = {
2470
// blob (so we can merge reports and download them for inspection),
2571
// dot (so we have a quick overview in the logs while the tests are running)
2672
// github (to have annotations in the PR)
27-
reporter: [['blob'], ['line'], ['github']] as ReporterDescription[],
73+
reporter: [
74+
['blob'],
75+
['json', { outputFile: 'test-results/results.json' }],
76+
['line'],
77+
['github'],
78+
] as ReporterDescription[],
2879
retries: 1,
2980
timeout: 45_000,
3081
// we shard to speed up the tests so no parallelism in workers
3182
workers: 1,
3283
} as const
3384

85+
function comparisonWebServer() {
86+
if (EXTERNAL_COMPARISON_SERVER) {
87+
return undefined
88+
}
89+
return {
90+
command: 'npm run start:nextcloud',
91+
gracefulShutdown: {
92+
signal: 'SIGTERM' as const,
93+
timeout: 10000,
94+
},
95+
reuseExistingServer: false,
96+
stderr: 'pipe' as const,
97+
stdout: 'pipe' as const,
98+
timeout: 5 * 60 * 1000,
99+
wait: {
100+
stdout: /Nextcloud is now ready to use/,
101+
},
102+
}
103+
}
104+
34105
/**
35106
* See https://playwright.dev/docs/test-configuration.
36107
*/
37108
export default defineConfig({
38109
testDir: './playwright',
39110
...(process.env.CI ? CI_CONFIG : LOCAL_CONFIG),
111+
workers: COMPARISON_E2E ? 1 : undefined,
40112
use: {
41113
// Base URL to use in actions like `await page.goto('./')`.
42-
baseURL: process.env.baseURL ?? 'http://localhost:8089/index.php/',
114+
baseURL: COMPARISON_BASE_URL,
43115
// record traces but only keep them when the test fails
44116
trace: 'on-first-retry',
45117
},
46118

47119
projects: [
48120
{
49121
name: 'chromium',
122+
testIgnore: COMPARISON_TESTS,
50123
use: {
51124
...devices['Desktop Chrome'],
52125
},
53126
},
127+
...comparisonProjects(),
54128
],
55129

56-
webServer: {
57-
// Don't set `url` as it would take precedence over `wait.stdout` and tests start too early
58-
// url: 'http://127.0.0.1:8089',
59-
// Starts the Nextcloud docker container
60-
command: 'npm run start:nextcloud',
61-
// we use sigterm to notify the script to stop the container
62-
// if it does not respond, we force kill it after 10 seconds
63-
gracefulShutdown: {
64-
signal: 'SIGTERM',
65-
timeout: 10000,
66-
},
67-
// `start-nextcloud-server.mjs` only starts the server if not reachable yet.
68-
reuseExistingServer: false,
69-
stderr: 'pipe',
70-
stdout: 'pipe',
71-
// max. 5 minutes for creating the container
72-
timeout: 5 * 60 * 1000,
73-
wait: {
74-
// we wait for this line to appear in the output of the webserver until consider it done
75-
stdout: /Nextcloud is now ready to use/,
76-
},
77-
},
130+
webServer: comparisonWebServer(),
78131
})

0 commit comments

Comments
 (0)