Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ifpen/chalk-it
Browse files Browse the repository at this point in the history
  • Loading branch information
bengaid committed Apr 3, 2024
2 parents e4be61d + 972646f commit 68539ea
Show file tree
Hide file tree
Showing 28 changed files with 6,656 additions and 8 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/e2e-tests.yml
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
1 change: 1 addition & 0 deletions e2e/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.png filter=lfs diff=lfs merge=lfs -text
3 changes: 3 additions & 0 deletions e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mochawesome-report/
outputs/
.env
8 changes: 8 additions & 0 deletions e2e/.prettierrc.json
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
}
27 changes: 27 additions & 0 deletions e2e/README.md
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`).
Loading

0 comments on commit 68539ea

Please sign in to comment.