Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.

Commit 12a6625

Browse files
committed
Add vanilla-app e2e tests
1 parent 85fda68 commit 12a6625

File tree

14 files changed

+1224
-16
lines changed

14 files changed

+1224
-16
lines changed

.travis.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ cache:
77
directories:
88
- ~/.npm
99
- ~/.cache
10-
- node_modules
11-
- test-e2e/browser/node_modules
12-
- test-e2e/browser/react-app/node_modules
1310
- ~/.sonar/cache
1411

1512
addons:
@@ -25,15 +22,7 @@ script:
2522
- npm run lint
2623
- npm run test
2724
- npm run build
28-
- cd test-e2e/browser
29-
- cd react-app
30-
- npm ci
31-
- cd ..
32-
- npm ci
33-
- npm run cypress:install
34-
- npm run cypress:verify
35-
- npm run test:react-app:ci
36-
- cd ../..
25+
- npm run test:e2e:ci
3726
- npm run coveralls
3827
- 'if [ -n "$SONAR_TOKEN" ]; then sonar-scanner -Dsonar.login=${SONAR_TOKEN}; fi'
3928

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
"lint": "eslint index.js test src jest.config.js test-e2e/browser/react-app/src test-e2e/browser/cypress",
2828
"lint-staged": "lint-staged",
2929
"test": "jest",
30-
"coveralls": "cat ./coverage/lcov.info | coveralls"
30+
"coveralls": "cat ./coverage/lcov.info | coveralls",
31+
"test:e2e": "cd test-e2e/browser && npm run test:react-app:ci && npm run test:vanilla-app:ci",
32+
"test:e2e:ci": "cd test-e2e/browser && npm i && npm run cypress:install && npm run test:react-app:ci && npm run test:vanilla-app:ci"
3133
},
3234
"dependencies": {
3335
"@data-provider/axios": "^1.5.0",

test-e2e/browser/cypress/.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"es6": true
55
},
66
"globals": {
7+
"Cypress": true,
78
"cy": true,
89
"afterEach": true,
910
"after": true,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
import "./commands";
2+
3+
Cypress.on("uncaught:exception", () => {
4+
// returning false here prevents Cypress from
5+
// failing the test
6+
return false;
7+
});

test-e2e/browser/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
"cypress:verify": "cypress verify",
1010
"cypress:open": "cypress open",
1111
"cypress:run": "cypress run",
12-
"start:react-app": "cd react-app && npm run build-and-serve",
12+
"start:react-app": "cd react-app && npm i && npm run build-and-serve",
13+
"start:vanilla-app": "cd vanilla-app && npm i && npm run build-and-serve",
1314
"mocks:ci-and-start:react-app": "start-server-and-test mocks:ci http-get://localhost:3100/admin/about start:react-app",
14-
"test:react-app:ci": "start-server-and-test mocks:ci-and-start:react-app http-get://localhost:3000 cypress:run"
15+
"mocks:ci-and-start:vanilla-app": "start-server-and-test mocks:ci http-get://localhost:3100/admin/about start:vanilla-app",
16+
"test:react-app:ci": "start-server-and-test mocks:ci-and-start:react-app http-get://localhost:3000 cypress:run",
17+
"test:vanilla-app:ci": "start-server-and-test mocks:ci-and-start:vanilla-app http-get://localhost:3000 cypress:run"
1518
},
1619
"browserslist": {
1720
"production": [

test-e2e/browser/react-app/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="theme-color" content="#000000" />
77
<meta
88
name="description"
9-
content="user preferences mock app"
9+
content="admin-api-client react app tests"
1010
/>
1111
<title>React App</title>
1212
</head>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
3+
# See https://help.github.com/ignore-files/ for more about ignoring files.
4+
5+
#environment variables
6+
.env
7+
8+
# dependencies
9+
/node_modules
10+
/public/js
11+
12+
# tests
13+
/coverage
14+
/dist
15+
16+
# misc
17+
.DS_Store
18+
.env.local
19+
.env.development.local
20+
.env.test.local
21+
.env.production.local
22+
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# ides
28+
.idea
29+
.vs
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const path = require("path");
2+
const fsExtra = require("fs-extra");
3+
4+
const libPath = path.resolve(__dirname, "..", "..", "..", "..", "dist", "index.umd.js");
5+
const publicJsPath = path.resolve(__dirname, "..", "public", "js");
6+
7+
const copyLib = () => {
8+
return fsExtra.copy(libPath, path.resolve(publicJsPath, "admin-api-client.js"));
9+
};
10+
11+
copyLib();

0 commit comments

Comments
 (0)