Skip to content

Commit d650d38

Browse files
authored
Fix e2e (#7664)
* Fix e2e At first, bump cypress from 9.7.0 to 10.0.0 * Enable e2e test on workflow * Bump cypress to 10.1.0 * Bump cypress to 10.2.0 * Bump cypress to 10.8.0 * Bump cypress to 10.11.0 * Bump cypress/webpack-preprocessor to 5.14.0 * Bump cypress/webpack-preprocessor to 5.15.7 * Bump cypress to 11.2.0 * Bump cypress to 12.8.1 and cypress/webpack-preprocessor 5.17.0 * Bump babel staffs to latest * Bump webpack-bundle-analyzer and webpack-dev-server to latest * Fix typo * Switch build target from ES2022 to ES2021 Because cypress does not seem to support ES2022. * [DNM] Check `make serve` * Change localhost to 127.0.0.1 in proxy.conf.json and proxy-https.conf.json * Revert Check `make serve` * Change `localhost` to `127.0.0.1` settings for cypress in package.json * Set interval for wait-on to 5sec * Set 127.0.0.1 instead of localhost for cypress in package.json. Again. * Set testIsolation to false * Increase interval for `wait-on` to 10sec. Because it still outputs about 200 lines of useless log during starting up dashboard.
1 parent a571734 commit d650d38

File tree

12 files changed

+300
-357
lines changed

12 files changed

+300
-357
lines changed

.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ jobs:
7373
fail-on-severity: critical
7474
e2e:
7575
name: End-to-end tests
76-
if: ${{ false }}
7776
runs-on: ubuntu-latest
7877
env:
7978
NG_CLI_ANALYTICS: ci

modules/web/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ dist/
3434
!.yarn/releases
3535
!.yarn/sdks
3636
!.yarn/versions
37+
38+
# Cypress
39+
40+
cypress/screenshots

modules/web/cypress.config.cjs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2017 The Kubernetes Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
const { defineConfig } = require('cypress');
16+
17+
module.exports = defineConfig({
18+
"e2e": {
19+
"baseUrl": "http://localhost:8080",
20+
"supportFile": "./cypress/support/index.ts",
21+
"video": false,
22+
"chromeWebSecurity": false,
23+
"screenshotOnRunFailure": true,
24+
"videoCompression": false,
25+
"pageLoadTimeout": 10000,
26+
"viewportHeight": 1080,
27+
"viewportWidth": 1920,
28+
"testIsolation": false,
29+
},
30+
});

modules/web/cypress.json

-11
This file was deleted.

modules/web/cypress/integration/specs/nav.spec.ts renamed to modules/web/cypress/e2e/nav.cy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*
1616
*/
17-
import {NavbarPage} from '../../pages/navbarPage';
17+
import {NavbarPage} from '../pages/navbarPage';
1818

1919
describe('Navbar', () => {
2020
before(() => {

modules/web/cypress/integration/specs/userpanel.spec.ts renamed to modules/web/cypress/e2e/userpanel.cy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*
1616
*/
17-
import {UserpanelPage} from '../../pages/userpanelPage';
17+
import {UserpanelPage} from '../pages/userpanelPage';
1818

1919
describe('Userpanel', () => {
2020
before(() => {

modules/web/cypress/support/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@
1717
before(() => {
1818
cy.clearCookies();
1919
});
20+
21+
afterEach(() => {
22+
cy.screenshot();
23+
});

modules/web/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"check:ts": "gts lint",
3131
"test": "npx jest -c jest.config.js",
3232
"coverage": "npx jest -c jest.config.js --coverage",
33-
"cypress": "wait-on -v http-get://localhost:9000/api/v1/node http://localhost:8000/config http://localhost:8080 && npx cypress run",
33+
"cypress": "wait-on -v -i 10000 http-get://127.0.0.1:9000/api/v1/node http://127.0.0.1:8000/config http://127.0.0.1:8080 && npx cypress run",
3434
"e2e": "concurrently -kill-others --success first \"yarn start\" \"yarn cypress\"",
35-
"e2e:headed": "concurrently -kill-others --success first \"yarn start:e2e\" \"wait-on http://localhost:8080 && npx cypress run --headed\"",
35+
"e2e:headed": "concurrently -kill-others --success first \"yarn start:e2e\" \"wait-on -i 10000 http://127.0.0.1:8080 && npx cypress run --headed\"",
3636
"analyze": "ng build --stats-json && webpack-bundle-analyzer dist/stats.json"
3737
},
3838
"lint-staged": {
@@ -88,10 +88,10 @@
8888
"@angular/cli": "15.1.5",
8989
"@angular/compiler-cli": "15.1.4",
9090
"@angular/language-service": "15.1.4",
91-
"@babel/core": "7.19.1",
92-
"@babel/preset-env": "7.19.1",
93-
"@babel/register": "7.18.9",
94-
"@cypress/webpack-preprocessor": "5.12.2",
91+
"@babel/core": "7.21.3",
92+
"@babel/preset-env": "7.20.2",
93+
"@babel/register": "7.21.0",
94+
"@cypress/webpack-preprocessor": "5.17.0",
9595
"@types/d3": "7.4.0",
9696
"@types/d3-scale": "4.0.2",
9797
"@types/file-saver": "2.0.5",
@@ -105,7 +105,7 @@
105105
"@typescript-eslint/parser": "5.38.0",
106106
"codelyzer": "6.0.2",
107107
"concurrently": "7.6.0",
108-
"cypress": "9.7.0",
108+
"cypress": "12.8.1",
109109
"cypress-fail-fast": "5.0.1",
110110
"del": "6.1.1",
111111
"eslint": "8.33.0",
@@ -145,8 +145,8 @@
145145
"ts-node": "10.9.1",
146146
"typescript": "4.9.5",
147147
"wait-on": "6.0.1",
148-
"webpack-bundle-analyzer": "4.7.0",
149-
"webpack-dev-server": "4.11.1"
148+
"webpack-bundle-analyzer": "4.8.0",
149+
"webpack-dev-server": "4.13.1"
150150
},
151151
"overrides": {
152152
"colors": "1.4.0"

modules/web/proxy-https.conf.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"/api": {
3-
"target": "https://localhost:9001",
3+
"target": "https://127.0.0.1:9001",
44
"secure": false,
55
"ws": true,
66
"changeOrigin": true
77
},
88
"/config": {
9-
"target": "https://localhost:8001",
9+
"target": "https://127.0.0.1:8001",
1010
"secure": false,
1111
"ws": true,
1212
"changeOrigin": true
1313
},
1414
"/systembanner": {
15-
"target": "https://localhost:8001",
15+
"target": "https://127.0.0.1:8001",
1616
"secure": false,
1717
"ws": true,
1818
"changeOrigin": true

modules/web/proxy.conf.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"/api": {
3-
"target": "http://localhost:9000",
3+
"target": "http://127.0.0.1:9000",
44
"secure": false
55
},
66
"/config": {
7-
"target": "http://localhost:8000",
7+
"target": "http://127.0.0.1:8000",
88
"secure": false
99
},
1010
"/systembanner": {
11-
"target": "http://localhost:8000",
11+
"target": "http://127.0.0.1:8000",
1212
"secure": false
1313
}
1414
}

modules/web/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
]
1818
},
1919
"outDir": ".tmp/out-tsc",
20-
"moduleResolution": "Node",
21-
"target": "ES2022",
20+
"moduleResolution": "node",
21+
"target": "ES2021",
2222
"module": "ES2020",
2323
"sourceMap": true,
2424
"emitDecoratorMetadata": true,

0 commit comments

Comments
 (0)