diff --git a/.github/workflows/task-ui.yml b/.github/workflows/task-ui.yml new file mode 100644 index 00000000..9f2501a5 --- /dev/null +++ b/.github/workflows/task-ui.yml @@ -0,0 +1,24 @@ +name: Task management UI +on: + push: + paths: ['web/templates/index.html', 'web/static/js/tasks.js', 'web/static/js/long-tasks.js', 'web/static/js/router.js', 'web/static/js/auth.js', 'web/static/js/modal.js', 'web/static/js/rbac-guards.js', 'web/static/css/**', 'web/static/i18n/**', 'scripts/long-tasks-browser.test.cjs', 'scripts/task-controls-browser.test.cjs', 'scripts/helpers/task-ui-fixture.cjs', '.github/workflows/task-ui.yml'] + pull_request: + paths: ['web/templates/index.html', 'web/static/js/tasks.js', 'web/static/js/long-tasks.js', 'web/static/js/router.js', 'web/static/js/auth.js', 'web/static/js/modal.js', 'web/static/js/rbac-guards.js', 'web/static/css/**', 'web/static/i18n/**', 'scripts/long-tasks-browser.test.cjs', 'scripts/task-controls-browser.test.cjs', 'scripts/helpers/task-ui-fixture.cjs', '.github/workflows/task-ui.yml'] +permissions: + contents: read +jobs: + browser: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '22' + - name: Install isolated browser test dependencies + run: | + npm install --prefix "$RUNNER_TEMP/task-ui-deps" --no-save --ignore-scripts --package-lock=false playwright@1.65.0 + "$RUNNER_TEMP/task-ui-deps/node_modules/.bin/playwright" install --with-deps chromium + - name: Test real task page entrypoints and controls + run: | + NODE_PATH="$RUNNER_TEMP/task-ui-deps/node_modules" node --test scripts/long-tasks-browser.test.cjs scripts/task-controls-browser.test.cjs diff --git a/scripts/helpers/task-ui-fixture.cjs b/scripts/helpers/task-ui-fixture.cjs new file mode 100644 index 00000000..ff2c9ebd --- /dev/null +++ b/scripts/helpers/task-ui-fixture.cjs @@ -0,0 +1,103 @@ +const fs = require('node:fs'); +const path = require('node:path'); +const http = require('node:http'); +const { chromium } = require('playwright'); +const root = path.join(__dirname, '../..'); +const read = file => fs.readFileSync(path.join(root, file), 'utf8'); +const template = read('web/templates/index.html'); +function div(id) { + const start = template.indexOf(`