From 33bfe740f4b41197e374b8a1ca46c692a23f079c Mon Sep 17 00:00:00 2001 From: Reguel Wermelinger Date: Thu, 11 Jan 2024 09:11:48 +0100 Subject: [PATCH] test --- .github/workflows/playwright.yml | 24 ------------------------ .gitignore | 3 --- build/Dockerfile | 8 +++++++- build/Jenkinsfile | 12 ++++++++++++ playwright.config.ts | 15 --------------- 5 files changed, 19 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/playwright.yml diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml deleted file mode 100644 index dbf3a62..0000000 --- a/.github/workflows/playwright.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Playwright Tests -on: - push: -jobs: - test: - timeout-minutes: 60 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install dependencies - run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps chromium - - name: Run Playwright tests - run: npx playwright test - - uses: actions/upload-artifact@v3 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 diff --git a/.gitignore b/.gitignore index d72e0c8..5d33c51 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ dist/ node_modules/ target/ -/test-results/ /playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/build/Dockerfile b/build/Dockerfile index 128c63b..f8be148 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,3 +1,9 @@ -FROM node:18.17.1-bookworm +FROM mcr.microsoft.com/playwright:v1.40.1-jammy + +RUN apt-get update &&\ + apt-get install software-properties-common -y &&\ + apt-add-repository universe -y &&\ + apt-get update &&\ + apt-get install openjdk-17-jdk maven -y USER node diff --git a/build/Jenkinsfile b/build/Jenkinsfile index 80abc36..ed50638 100644 --- a/build/Jenkinsfile +++ b/build/Jenkinsfile @@ -23,6 +23,18 @@ pipeline { } } } + stage('NPM:test') { + steps { + script { + catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { + docker.build('node', '-f build/Dockerfile .').inside { + sh 'npm run test' + } + } + archiveArtifacts artifacts: 'playwright-report/**', allowEmptyArchive: false + } + } + } stage('Deploy') { when { expression { isReleaseOrMasterBranch() && currentBuild.changeSets.size() > 0 } diff --git a/playwright.config.ts b/playwright.config.ts index 214f9b5..bd588f4 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,34 +1,20 @@ import { defineConfig, devices } from '@playwright/test'; -/** - * Read environment variables from file. - * https://github.com/motdotla/dotenv - */ -// require('dotenv').config(); - /** * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ testDir: './tests', - /* Run tests in files in parallel */ fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, - /* Retry on CI only */ retries: process.env.CI ? 2 : 0, - /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: 'html', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { baseURL: 'http://localhost:5173', - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', }, - /* Configure projects for major browsers */ projects: [ { name: 'chromium', @@ -36,7 +22,6 @@ export default defineConfig({ }, ], - /* Run your local dev server before starting the tests */ webServer: { command: 'npm run start', url: 'http://localhost:5173',