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 29, 2024
1 parent cbd0cac commit 0b8e135
Show file tree
Hide file tree
Showing 13 changed files with 551 additions and 137 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"
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,34 @@ If you want to run the application locally in the production mode, use `spring-b

### Running Integration Tests

Integration tests are implemented using [Vaadin TestBench](https://vaadin.com/testbench). The tests take a few minutes to run and are therefore included in a separate Maven profile. We recommend running tests with a production build to minimize the chance of development time toolchains affecting test stability. To run the tests using Google Chrome, execute
Integration tests are implemented using [Playwright](https://playwright.dev). The tests take a few minutes to run and are therefore included in a separate Maven profile. We recommend running tests with a production build to minimize the chance of development time toolchains affecting test stability.

`mvn verify -Pit,production`
Since Playwright supports either Java or TypeScript, tests for Flow views are implemented in Java whereas Hilla views are tested in TS

and make sure you have a valid TestBench license installed.
To run the tests using Google Chrome for both Flow and Hilla views run:

```
mvn verify -Pit,production
```

For running tests in headed mode run:

```
mvn verify -Pit,production -Dheadless=false
```


If you prefer run only Hilla tests, just execute:

```
npm test
```

Or for interacting with the playwright UI Test:

```
npm test -- --ui
```

## Structure

Expand All @@ -59,3 +82,4 @@ Vaadin web applications are full-stack and include both client-side and server-s
|     `Application.java` | Server entrypoint |
|     `FlowView.java` | Server-side view for 'ADMIN' |
|     `GreetService.java` | Back-end service example |

124 changes: 108 additions & 16 deletions package-lock.json

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

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
},
"devDependencies": {
"@babel/preset-react": "7.24.1",
"@playwright/test": "^1.44.0",
"@rollup/plugin-replace": "5.0.5",
"@rollup/pluginutils": "5.1.0",
"@types/node": "^20.12.12",
"@types/react": "18.3.2",
"@types/react-dom": "18.3.0",
"@vaadin/hilla-generator-cli": "24.4.0-beta3",
Expand Down Expand Up @@ -119,7 +121,7 @@
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
},
"hash": "d8ddc9c76a424746a892d48a8b7f4e86d3c037945ee968d39a4befa10b38b7ce"
"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"
}
}
Loading

0 comments on commit 0b8e135

Please sign in to comment.