Skip to content

Commit

Permalink
feat!: replace Testbench tests with Playwright Java & TS (v24.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed May 28, 2024
1 parent e5dd2a0 commit 477735a
Show file tree
Hide file tree
Showing 10 changed files with 2,257 additions and 1,773 deletions.
43 changes: 22 additions & 21 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
name: Verify
on:
push:
branches: [v24.4]
workflow_dispatch:
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
verify:
timeout-minutes: 60
runs-on: ubuntu-latest
permissions:
# for EnricoMi/publish-unit-test-result-action
issues: read
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- uses: actions/setup-java@v3
node-version: 'lts/*'
- uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- name: Set TB License
run: |
TBL=${{ secrets.TB_LICENSE }}
[ -z "$TBL" ] && echo "No TB license provided" && exit 1
mkdir -p ~/.vaadin/
echo '{"username":"'`echo $TBL | cut -d / -f1`'","proKey":"'`echo $TBL | cut -d / -f2`'"}' > ~/.vaadin/proKey
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- uses: nanasess/setup-chromedriver@master
- name: Install browsers
run: |
npm install --ci
npx playwright install chromium --with-deps
npx playwright install-deps
- name: Verify
run: |
mvn -B -V -ntp verify -Dcom.vaadin.testbench.Parameters.headless -Pit,production
./mvnw -B -V -ntp verify -Pit,production
- uses: actions/upload-artifact@v4
with:
name: tests-report
path: target/**-reports
retention-days: 30
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: "**/target/*-reports/TEST*.xml"
check_run_annotations: all tests, skipped tests
check_run_annotations_branch: v24.4
files: "target/*-reports/TEST*.xml"
3,424 changes: 1,823 additions & 1,601 deletions package-lock.json

Large diffs are not rendered by default.

115 changes: 60 additions & 55 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,53 @@
"type": "module",
"dependencies": {
"@polymer/polymer": "3.5.1",
"@vaadin/bundles": "24.4.0-beta2",
"@vaadin/bundles": "24.4.0-beta3",
"@vaadin/common-frontend": "0.0.19",
"@vaadin/hilla-file-router": "24.4.0-beta2",
"@vaadin/hilla-frontend": "24.4.0-beta2",
"@vaadin/hilla-lit-form": "24.4.0-beta2",
"@vaadin/hilla-react-auth": "24.4.0-beta2",
"@vaadin/hilla-react-crud": "24.4.0-beta2",
"@vaadin/hilla-react-form": "24.4.0-beta2",
"@vaadin/hilla-react-i18n": "24.4.0-beta2",
"@vaadin/hilla-react-signals": "24.4.0-beta2",
"@vaadin/polymer-legacy-adapter": "24.4.0-beta2",
"@vaadin/react-components": "24.4.0-beta2",
"@vaadin/react-components-pro": "24.4.0-beta2",
"@vaadin/hilla-file-router": "24.4.0-beta3",
"@vaadin/hilla-frontend": "24.4.0-beta3",
"@vaadin/hilla-lit-form": "24.4.0-beta3",
"@vaadin/hilla-react-auth": "24.4.0-beta3",
"@vaadin/hilla-react-crud": "24.4.0-beta3",
"@vaadin/hilla-react-form": "24.4.0-beta3",
"@vaadin/hilla-react-i18n": "24.4.0-beta3",
"@vaadin/hilla-react-signals": "24.4.0-beta3",
"@vaadin/polymer-legacy-adapter": "24.4.0-beta3",
"@vaadin/react-components": "24.4.0-beta3",
"@vaadin/react-components-pro": "24.4.0-beta3",
"@vaadin/router": "1.7.5",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.4.0-beta2",
"@vaadin/vaadin-material-styles": "24.4.0-beta2",
"@vaadin/vaadin-themable-mixin": "24.4.0-beta2",
"@vaadin/vaadin-lumo-styles": "24.4.0-beta3",
"@vaadin/vaadin-material-styles": "24.4.0-beta3",
"@vaadin/vaadin-themable-mixin": "24.4.0-beta3",
"@vaadin/vaadin-usage-statistics": "2.1.2",
"construct-style-sheets-polyfill": "3.1.0",
"date-fns": "2.29.3",
"lit": "3.1.3",
"proj4": "2.11.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.23.0"
"react-router-dom": "6.23.1"
},
"devDependencies": {
"@babel/preset-react": "7.24.1",
"@playwright/test": "^1.44.0",
"@rollup/plugin-replace": "5.0.5",
"@rollup/pluginutils": "5.1.0",
"@types/react": "18.3.1",
"@types/node": "^20.12.12",
"@types/react": "18.3.2",
"@types/react-dom": "18.3.0",
"@vaadin/hilla-generator-cli": "24.4.0-beta2",
"@vaadin/hilla-generator-core": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-backbone": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-barrel": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-client": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-model": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-push": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-subtypes": "24.4.0-beta2",
"@vaadin/hilla-generator-utils": "24.4.0-beta2",
"@vaadin/hilla-generator-cli": "24.4.0-beta3",
"@vaadin/hilla-generator-core": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-backbone": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-barrel": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-client": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-model": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-push": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-subtypes": "24.4.0-beta3",
"@vaadin/hilla-generator-utils": "24.4.0-beta3",
"@vitejs/plugin-react": "4.2.1",
"async": "3.2.5",
"glob": "10.3.12",
"glob": "10.3.15",
"rollup-plugin-brotli": "3.1.0",
"rollup-plugin-visualizer": "5.12.0",
"strip-css-comments": "5.0.0",
Expand All @@ -63,51 +65,51 @@
"vaadin": {
"dependencies": {
"@polymer/polymer": "3.5.1",
"@vaadin/bundles": "24.4.0-beta2",
"@vaadin/bundles": "24.4.0-beta3",
"@vaadin/common-frontend": "0.0.19",
"@vaadin/hilla-file-router": "24.4.0-beta2",
"@vaadin/hilla-frontend": "24.4.0-beta2",
"@vaadin/hilla-lit-form": "24.4.0-beta2",
"@vaadin/hilla-react-auth": "24.4.0-beta2",
"@vaadin/hilla-react-crud": "24.4.0-beta2",
"@vaadin/hilla-react-form": "24.4.0-beta2",
"@vaadin/hilla-react-i18n": "24.4.0-beta2",
"@vaadin/hilla-react-signals": "24.4.0-beta2",
"@vaadin/polymer-legacy-adapter": "24.4.0-beta2",
"@vaadin/react-components": "24.4.0-beta2",
"@vaadin/react-components-pro": "24.4.0-beta2",
"@vaadin/hilla-file-router": "24.4.0-beta3",
"@vaadin/hilla-frontend": "24.4.0-beta3",
"@vaadin/hilla-lit-form": "24.4.0-beta3",
"@vaadin/hilla-react-auth": "24.4.0-beta3",
"@vaadin/hilla-react-crud": "24.4.0-beta3",
"@vaadin/hilla-react-form": "24.4.0-beta3",
"@vaadin/hilla-react-i18n": "24.4.0-beta3",
"@vaadin/hilla-react-signals": "24.4.0-beta3",
"@vaadin/polymer-legacy-adapter": "24.4.0-beta3",
"@vaadin/react-components": "24.4.0-beta3",
"@vaadin/react-components-pro": "24.4.0-beta3",
"@vaadin/router": "1.7.5",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.4.0-beta2",
"@vaadin/vaadin-material-styles": "24.4.0-beta2",
"@vaadin/vaadin-themable-mixin": "24.4.0-beta2",
"@vaadin/vaadin-lumo-styles": "24.4.0-beta3",
"@vaadin/vaadin-material-styles": "24.4.0-beta3",
"@vaadin/vaadin-themable-mixin": "24.4.0-beta3",
"@vaadin/vaadin-usage-statistics": "2.1.2",
"construct-style-sheets-polyfill": "3.1.0",
"date-fns": "2.29.3",
"lit": "3.1.3",
"proj4": "2.11.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.23.0"
"react-router-dom": "6.23.1"
},
"devDependencies": {
"@babel/preset-react": "7.24.1",
"@rollup/plugin-replace": "5.0.5",
"@rollup/pluginutils": "5.1.0",
"@types/react": "18.3.1",
"@types/react": "18.3.2",
"@types/react-dom": "18.3.0",
"@vaadin/hilla-generator-cli": "24.4.0-beta2",
"@vaadin/hilla-generator-core": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-backbone": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-barrel": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-client": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-model": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-push": "24.4.0-beta2",
"@vaadin/hilla-generator-plugin-subtypes": "24.4.0-beta2",
"@vaadin/hilla-generator-utils": "24.4.0-beta2",
"@vaadin/hilla-generator-cli": "24.4.0-beta3",
"@vaadin/hilla-generator-core": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-backbone": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-barrel": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-client": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-model": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-push": "24.4.0-beta3",
"@vaadin/hilla-generator-plugin-subtypes": "24.4.0-beta3",
"@vaadin/hilla-generator-utils": "24.4.0-beta3",
"@vitejs/plugin-react": "4.2.1",
"async": "3.2.5",
"glob": "10.3.12",
"glob": "10.3.15",
"rollup-plugin-brotli": "3.1.0",
"rollup-plugin-visualizer": "5.12.0",
"strip-css-comments": "5.0.0",
Expand All @@ -119,7 +121,7 @@
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
},
"hash": "e102ae076309d7e960989b388098e6f65f73fe8bd21b02705ec1fba45340161d"
"hash": "3319bf050746b28ac401caea5b7cb87a1733a059e792fe2fd11d8b96a2b17e3c"
},
"overrides": {
"@vaadin/bundles": "$@vaadin/bundles",
Expand Down Expand Up @@ -149,5 +151,8 @@
"@vaadin/vaadin-themable-mixin": "$@vaadin/vaadin-themable-mixin",
"@vaadin/vaadin-lumo-styles": "$@vaadin/vaadin-lumo-styles",
"@vaadin/vaadin-material-styles": "$@vaadin/vaadin-material-styles"
},
"scripts": {
"test": "npx playwright install chromium && npx playwright test"
}
}
85 changes: 85 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { defineConfig, devices } from '@playwright/test';

const isMaven = !!process.env.MAVEN_CMD_LINE_ARGS;

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './src/test/frontend/views',
outputDir: './target/playwright-reports/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: isMaven,
/* Retry on CI only */
retries: isMaven ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: isMaven ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
['html', { outputFolder: 'target/playwright-reports/html', open: !isMaven }],
['junit', { outputFile: 'target/playwright-reports/TEST-frontend-report.xml' }]
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* 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',
use: { ...devices['Desktop Chrome'] },
},

// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },

// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],

/* Run your local dev server before starting the tests */
webServer: {
command: "./mvnw -B -ntp -Dspring-boot.run.jvmArguments='-Dvaadin.launch-browser=false'",
url: "http://127.0.0.1:8080",
reuseExistingServer: isMaven,
stdout: "pipe",
stderr: "pipe",
},
});
Loading

0 comments on commit 477735a

Please sign in to comment.