-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/ifpen/chalk-it
- Loading branch information
Showing
28 changed files
with
6,656 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
|
||
name: 'Run e2e Tests' | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- ready_for_review | ||
paths: | ||
- 'front-end/**' | ||
- 'e2e/**' | ||
|
||
|
||
jobs: | ||
e2e-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
lfs: 'true' | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.12.x | ||
cache: npm | ||
cache-dependency-path: '**/package-lock.json' | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' | ||
- run: pip install -r requirements.txt | ||
|
||
- run: npm install -g bower | ||
- run: bower install | ||
working-directory: ./front-end | ||
|
||
- name: Install build dependencies | ||
run: npm ci | ||
working-directory: ./front-end | ||
|
||
- name: Build | ||
run: | | ||
echo "" >> .env.prod | ||
echo "URL_LOCAL_SERVER=api/" >> .env.prod | ||
npm run build | ||
working-directory: ./front-end | ||
|
||
- name: Build | ||
id: build | ||
working-directory: ./front-end/build | ||
run: | | ||
cd `ls | head` | ||
BUILD_DIR="`pwd`" | ||
echo BUILD_DIR="$BUILD_DIR" >> $GITHUB_OUTPUT | ||
- uses: browser-actions/setup-chrome@v1 | ||
|
||
- name: Install test dependencies | ||
run: npm ci | ||
working-directory: ./e2e | ||
|
||
- name: Run e2e tests | ||
working-directory: ./e2e | ||
env: | ||
BROWSER_LIST: chrome | ||
LOG_LEVEL: info | ||
CHALKIT_DIR: ${{ steps.build.outputs.BUILD_DIR }} | ||
run: | | ||
echo CHALKIT_DIR="$CHALKIT_DIR" | ||
echo BROWSER_LIST="chrome" | ||
npm run test | ||
- name: Upload test outputs | ||
uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: e2e-test-outputs | ||
path: | | ||
./e2e/outputs/ | ||
./e2e/mochawesome-report/ | ||
retention-days: 5 | ||
if-no-files-found: error | ||
|
||
- uses: phoenix-actions/test-reporting@v13 | ||
if: always() | ||
with: | ||
name: E2e Tests Report | ||
path: ./e2e/mochawesome-report/mochawesome.json | ||
reporter: mochawesome-json | ||
fail-on-error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.png filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mochawesome-report/ | ||
outputs/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"printWidth": 120, | ||
"singleQuote": true, | ||
"useTabs": false, | ||
"tabWidth": 2, | ||
"semi": true, | ||
"bracketSpacing": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# End-to-end testing of Chalk'it | ||
|
||
## Setup | ||
|
||
```sh | ||
npm i | ||
``` | ||
|
||
Either create a `.env` file or define environment variables to configure the tests. A the very least, `CHALKIT_DIR` must be set to point to a valid Chalk'it build. | ||
|
||
## e2e testing | ||
|
||
```sh | ||
npm run test | ||
``` | ||
|
||
Readable reports are generated with mochawesome. With the default setup, ouputs (logs, screenshots, etc.) are stored in `outputs`. | ||
|
||
## Adding tests | ||
|
||
Tests using reference dashboards and expected screenshots are defined in `dashboard-display.spec.ts`. Inputs are stored in `resources`. | ||
|
||
Screenshots for dashboard `dashboard.xprjson` are named `dashboard-BROWSER.png`. | ||
|
||
For new tests, run the tests once, check the screenshots in `outputs` and copy them to `resources`. | ||
|
||
Also remember to format using prettier (`npm run prettier`). |
Oops, something went wrong.