Skip to content

Commit

Permalink
Playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienClairembault committed Feb 7, 2025
1 parent 12e04c0 commit 5c5bc1a
Show file tree
Hide file tree
Showing 24 changed files with 2,396 additions and 309 deletions.
2 changes: 2 additions & 0 deletions .github/actions/docker-compose-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ services:
image: "ghcr.io/glpi-project/${PHP_IMAGE:-githubactions-php-apache:8.3}"
environment:
CODE_COVERAGE: "${CODE_COVERAGE:-false}"
CI: true
PLAYWRIGHT_BROWSERS_PATH: /opt/pw-browsers
volumes:
- type: "bind"
source: "${APPLICATION_ROOT}"
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,18 @@ jobs:
with:
name: cypress-screenshots
path: tests/cypress/screenshots
# Playwright specific steps
- name: Install dependencies
run: docker compose exec -T app npm ci
- name: Install Playwright Browsers
run: docker compose exec -T --user=root app sudo -E npx playwright install chromium --with-deps
- name: Run type checks
run: docker compose exec -T app npx tsc -p tsconfig.json --noEmit
- name: Run Playwright tests
run: docker compose exec -T app npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,11 @@ phpstan.neon
/phpunit/coverage/
*.phar
.env

# Playwright
node_modules/
/tests/playwright/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/

27 changes: 26 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import globals from "globals";
import vue from "eslint-plugin-vue";
import js from "@eslint/js";
import cypress from "eslint-plugin-cypress/flat";
import playwright from 'eslint-plugin-playwright';
import tsParser from "@typescript-eslint/parser";

export default [
{
Expand All @@ -19,10 +21,24 @@ export default [
"public/lib/*",
"tests/config/*",
"vendor/*",
"**/*.min.js"
"**/*.min.js",
],
},
js.configs.recommended,
{
files: ["tests/playwright/**/*.ts"],
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
ecmaVersion: 'latest',
sourceType: "module"
},
globals: {
...globals.node,
}
},
},
{
languageOptions: {
ecmaVersion: 13,
Expand Down Expand Up @@ -161,5 +177,14 @@ export default [
"rules": {
"prefer-template": "off",
}
},
{
...playwright.configs['flat/recommended'],
files: ['tests/playwright/**'],
rules: {
...playwright.configs['flat/recommended'].rules,
"playwright/no-force-option": "error",
"playwright/no-raw-locators": "error",
},
}
];
Loading

0 comments on commit 5c5bc1a

Please sign in to comment.