Skip to content

Commit 2e8cadf

Browse files
mathis-marcotteMathis Marcotte
andauthored
adding frontend tests workflow (#212)
* init for frontend test workflow * added wait-on package --------- Co-authored-by: Mathis Marcotte <[email protected]>
1 parent 17ab249 commit 2e8cadf

File tree

5 files changed

+337
-27
lines changed

5 files changed

+337
-27
lines changed

.github/workflows/frontend_tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: JWA Frontend Tests
2+
on:
3+
pull_request:
4+
types:
5+
- 'opened'
6+
- 'synchronize'
7+
- 'reopened'
8+
9+
jobs:
10+
run-ui-tests:
11+
name: UI tests with Cypress
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Setup node version to 12
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 12
20+
21+
- name: Install Kubeflow common library dependecies
22+
run: |
23+
cd frontend/common/kubeflow-common-lib
24+
npm i
25+
npm run build
26+
npm link ./dist/kubeflow
27+
- name: Install JWA dependencies
28+
run: |
29+
cd frontend/jupyter
30+
npm i
31+
npm link kubeflow
32+
- name: Serve UI & run Cypress tests in Chrome and Firefox
33+
run: |
34+
cd frontend/jupyter
35+
npm start & npx wait-on http://localhost:4200
36+
npm run ui-test-ci-all

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ The following can be pasted in a script and executed. This uses the latest node
6666
cd frontend/common/kubeflow-common-lib
6767
npm i
6868
npm run build
69-
cd dist/kubeflow
70-
npm link
69+
npm link ./dist/kubeflow
7170
72-
cd ../../../../jupyter
71+
cd ../../jupyter
7372
npm i
7473
npm link kubeflow --legacy-peer-deps
7574
KF_USER_ID=user npm start
@@ -80,7 +79,7 @@ For the kubecost data to be retrievable, the following will need to be executed
8079
### Running intergration tests
8180

8281
We use [Cypress](https://www.cypress.io/) to make our end-to-end tests.
83-
To run integration tests locally, first make sure that the jupyter-apis app is up and running. Then, from the `jupyter-apis/frontend/jupyter` directory, run either `npm run e2e` to open the Cypress UI, or `npm run e2e-ci` to run the cypress tests just in the terminal.
82+
To run integration tests locally, first make sure that the jupyter-apis app is up and running. Then, from the `jupyter-apis/frontend/jupyter` directory, run either `npm run ui-test` to open the Cypress UI, or `npm run ui-test-ci` to run the cypress tests just in the terminal.
8483

8584
### Connecting a Kubeflow Cluster
8685

frontend/jupyter/package-lock.json

Lines changed: 208 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/jupyter/package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"build:fr": "npm run copyLibAssets && ng build --prod --base-href /jupyter/ --deploy-url static/ --configuration=fr",
99
"build:watch": "npm run copyLibAssets && ng build --watch --deploy-url static/ --outputPath ../backend/apps/default/static/ --outputHashing all",
1010
"build:watch:rok": "npm run copyLibAssets && ng build --watch --deploy-url static/ --outputPath ../backend/apps/rok/static/ --outputHashing all --configuration=rok",
11+
"serve": "npm run copyLibAssets && ng serve --proxy-config=src/proxy.conf.json",
1112
"serve:rok": "npm run copyLibAssets && ng serve --configuration=rok --proxy-config=src/proxy.conf.rok.json",
1213
"copyLibAssets": "cp -r ./node_modules/kubeflow/assets/* ./src/assets/",
1314
"format:check": "prettier --check 'src/**/*.{js,ts,html,scss,css}' || node scripts/check-format-error.js",
@@ -16,9 +17,12 @@
1617
"start:fr": "ng serve --configuration=fr --base-href / --deploy-url / --proxy-config proxy.config.js",
1718
"i18n:extract": "ng extract-i18n --output-path i18n",
1819
"test": "ng test",
19-
"e2e": "cypress open",
20-
"e2e-ci": "cypress run",
21-
"lint": "ng lint"
20+
"test:prod": "ng test --browsers=ChromeHeadless --watch=false",
21+
"ui-test": "cypress open",
22+
"ui-test-ci": "cypress run",
23+
"ui-test-ci-all": "cypress run --browser=chrome && cypress run --browser=firefox",
24+
"lint-check": "ng lint",
25+
"lint": "ng lint --fix"
2226
},
2327
"private": true,
2428
"dependencies": {
@@ -71,6 +75,7 @@
7175
"protractor": "~7.0.0",
7276
"ts-node": "^10.4.0",
7377
"tslint": "~6.1.0",
74-
"typescript": "~4.2.4"
78+
"typescript": "~4.2.4",
79+
"wait-on": "^7.0.1"
7580
}
7681
}

0 commit comments

Comments
 (0)