Skip to content

Fix Go tests workflow and compatibility issues #3

Fix Go tests workflow and compatibility issues

Fix Go tests workflow and compatibility issues #3

name: Playwright E2E Tests
on:
workflow_dispatch: # Manual trigger only, as it requires browser downloads
push:
branches: [ main ]
paths:
- 'ui/**'
- 'tests/**'
pull_request:
branches: [ main ]
paths:
- 'ui/**'
- 'tests/**'
jobs:
test:
name: Run Playwright E2E tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
cache: true
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Create test configuration
run: |
cat > test_e2e_config.js << EOL
// @ts-check

Check failure on line 45 in .github/workflows/playwright-e2e-tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/playwright-e2e-tests.yml

Invalid workflow file

You have an error in your yaml syntax on line 45
const { defineConfig } = require('@playwright/test');
module.exports = defineConfig({
testDir: './tests',
timeout: 30 * 1000,
expect: {
timeout: 5000
},
fullyParallel: true,
forbidOnly: true,
retries: 2,
workers: 1,
reporter: [['html'], ['line']],
use: {
actionTimeout: 0,
baseURL: 'http://localhost:8080',
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: {
browserName: 'chromium',
},
}
],
webServer: {
command: 'go run ./cmd/test_api/test_api_server.go',
port: 8080,
reuseExistingServer: false,
},
});
EOL
- name: Build Go code
run: go build -v ./config/... ./module/...
- name: Run Playwright E2E tests
run: npx playwright test tests/ui/workflow-ui.spec.js --config test_e2e_config.js
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30