Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ services:
volumes:
- ../:/var/www/html/apps-extra/libresign:ro
playwright:
# Keep the browser image aligned with the version installed by npm ci.
# NCDD's default image is shared and may target a different Playwright.
image: mcr.microsoft.com/playwright:v1.65.0-noble
volumes:
- ../:/var/www/html/apps-extra/libresign
41 changes: 41 additions & 0 deletions .devcontainer/tests/playwright-version.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

const assert = require('node:assert/strict')
const { readFileSync } = require('node:fs')
const { resolve } = require('node:path')

const root = resolve(__dirname, '../..')
const manifest = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8'))
const lock = JSON.parse(readFileSync(resolve(root, 'package-lock.json'), 'utf8'))
const compose = readFileSync(resolve(root, '.devcontainer/docker-compose.yml'), 'utf8')

const installed = lock.packages['node_modules/@playwright/test']?.version
assert.ok(installed, 'The lockfile must include @playwright/test')
assert.equal(
lock.packages[''].devDependencies['@playwright/test'],
manifest.devDependencies['@playwright/test'],
'Update the Playwright manifest and lockfile together',
)

for (const dependency of ['playwright', 'playwright-core']) {
assert.equal(
lock.packages[`node_modules/${dependency}`]?.version,
installed,
`${dependency} must match @playwright/test in the lockfile`,
)
}

const playwrightService = compose.match(/^ {2}playwright:\s*\n((?:^ {4}.*\n|^\s*\n)*)/m)?.[1]
assert.ok(playwrightService, 'Missing Playwright service in devcontainer Compose override')
const image = playwrightService.match(/^ {4}image:\s*(\S+)\s*$/m)?.[1]
assert.ok(image, 'Pin the Playwright image in the devcontainer Compose override')
assert.equal(
image,
`mcr.microsoft.com/playwright:v${installed}-noble`,
'Playwright Docker image must match package-lock.json',
)

console.log(`Playwright package and Dev Container image match: ${installed}`)
6 changes: 6 additions & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ on:
paths:
- '.devcontainer/**'
- '.github/workflows/devcontainer.yml'
- 'package.json'
- 'package-lock.json'
push:
branches:
- main
paths:
- '.devcontainer/**'
- '.github/workflows/devcontainer.yml'
- 'package.json'
- 'package-lock.json'
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -51,6 +55,8 @@ jobs:
sh -n .devcontainer/prepare.sh
bash -n .devcontainer/setup.sh
node --check .devcontainer/tests/playwright-smoke.cjs
node --check .devcontainer/tests/playwright-version.cjs
node .devcontainer/tests/playwright-version.cjs

! jq -e '
((.forwardPorts // [])[]? | strings | contains(":")) or
Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@nextcloud/stylelint-config": "^3.2.1",
"@nextcloud/vite-config": "^3.0.0-beta.1",
"@pinia/testing": "^2.0.2",
"@playwright/test": "^1.64.1",
"@playwright/test": "^1.65.0",
"@stryker-mutator/core": "^10.1.1",
"@stryker-mutator/vitest-runner": "^10.1.1",
"@testing-library/dom": "^10.4.2",
Expand Down
Loading