Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright #41

Merged
merged 3 commits into from
Jan 11, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
node_modules/
target/
/playwright-report/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a hint for the 'nvm' binary ... with this I can go into this repo and execute nvm use ... and the version given in this .nvmrc will automatically installed and enabled.

8 changes: 7 additions & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions build/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
125 changes: 125 additions & 0 deletions package-lock.json

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

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
"type": "module",
"scripts": {
"start": "vite",
"build": "vite build"
"build": "vite build",
"test": "npx playwright test"
},
"dependencies": {
"swagger-ui": "^5.10.5",
"vite": "^5.0.11"
},
"devDependencies": {
"@playwright/test": "^1.40.1",
"@types/node": "^20.10.8",
"prettier": "^3.1.1"
}
}
32 changes: 32 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { defineConfig, devices } from '@playwright/test';

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
use: {
baseURL: 'http://localhost:5173',
trace: 'on-first-retry',
},

projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],

webServer: {
command: 'npm run start',
url: 'http://localhost:5173',
stdout: 'pipe',
stderr: 'pipe',
reuseExistingServer: !process.env.CI,
},
});
8 changes: 8 additions & 0 deletions tests/swagger.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test';

test('swagger ui renderer', async ({ page }) => {
await page.goto('/');

await expect(page).toHaveTitle(/API Browser/);
await expect(page.getByText('Authorize')).toBeVisible();
});
Comment on lines +3 to +8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a simple minimal test for swagger-ui-ivy ... in order to get fast feedback on braking changes supplied by dependabot updates