Skip to content

Commit

Permalink
feat!: replace Testbench tests with Playwright Java & TS
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed May 28, 2024
1 parent 0a7d42a commit f93e813
Show file tree
Hide file tree
Showing 13 changed files with 521 additions and 97 deletions.
45 changes: 23 additions & 22 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]
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
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
files: "target/*-reports/TEST*.xml"
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
# Flow-Hilla Hybrid Example

This project demonstrates how to use [Vaadin Flow](https://vaadin.com/flow) and [Hilla](https://hilla.dev) together in a single app.
This project demonstrates how to use [Vaadin Flow](https://vaadin.com/flow) and [Hilla](https://hilla.dev) together in a single app.

[Hilla](https://hilla.dev/docs/react) is a framework by Vaadin for building reactive web applications on Java backends. It seamlessly integrates a [React](https://reactjs.org/) TypeScript frontend with a [Spring Boot](https://spring.io/projects/spring-boot) backend.


## Running the Application
There are two ways to run the application : using `mvn spring-boot:run` or by running the `Application` class directly from your IDE.
There are two ways to run the application : using `mvn` or by running the `Application` class directly from your IDE.


## Running Tests
You can run both: Flow and Hilla tests by executing:

```
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
```
135 changes: 127 additions & 8 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 @@ -91,8 +91,10 @@
},
"devDependencies": {
"@lit-labs/react": "^1.1.0",
"@playwright/test": "^1.44.0",
"@rollup/plugin-replace": "5.0.4",
"@rollup/pluginutils": "5.0.5",
"@types/node": "^20.12.12",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.8",
"@vitejs/plugin-react": "4.2.0",
Expand Down Expand Up @@ -301,6 +303,9 @@
"workbox-core": "7.0.0",
"workbox-precaching": "7.0.0"
},
"hash": "4eedfc6b727124381fdd3f2585a5cf36006e85965cd4f5aaa0d41909222d8394"
"hash": "e6e1da02739799a7df86efe433474f3313a9fe6dd502747a6741f8295684976c"
},
"scripts": {
"test": "npx playwright install chromium && npx playwright test"
}
}
Loading

0 comments on commit f93e813

Please sign in to comment.