Skip to content

Commit ca727b0

Browse files
authored
Cypress 7 (#206)
* cypress updated to v7
1 parent 873539e commit ca727b0

File tree

12 files changed

+974
-4294
lines changed

12 files changed

+974
-4294
lines changed

.github/workflows/workflow.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ jobs:
1616
- id: get-branch-name
1717
run: echo "::set-output name=branch_name::$(git symbolic-ref --short HEAD)"
1818
shell: bash
19-
20-
- name: Cypress run
19+
20+
- name: Run Component tests 🧪
2121
uses: cypress-io/github-action@v2
22+
with:
23+
command: npm run test:cy
2224
env:
2325
VRT_APIURL: "http://162.243.161.172:4200"
2426
VRT_PROJECT: "VRT"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
.pnp.js
77

88
# testing
9+
vrt.json
910
.nyc_output/
1011
/coverage
1112
/cypress/screenshots

cypress.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"video": false,
55
"screenshotOnRunFailure": false,
66
"retries": 0,
7-
"experimentalComponentTesting": true,
87
"componentFolder": "src",
98
"testFiles": "**/*.spec.*"
109
}

cypress/plugins/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
const {
22
addVisualRegressionTrackerPlugin,
33
} = require("@visual-regression-tracker/agent-cypress/dist/plugin");
4+
const injectReactScriptsDevServer = require("@cypress/react/plugins/react-scripts");
45

56
module.exports = async (on, config) => {
6-
require("cypress-react-unit-test/plugins/react-scripts")(on, config);
7+
injectReactScriptsDevServer(on, config);
78
addVisualRegressionTrackerPlugin(on, config);
89
return config;
910
};

cypress/support/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@
1515
// https://on.cypress.io/configuration
1616
// ***********************************************************
1717

18-
// Import commands.js using ES2015 syntax:
1918
import "./commands";
2019

21-
// Alternatively you can use CommonJS syntax:
22-
// require('./commands')
23-
require("cypress-react-unit-test/support");
2420

2521
before(() => {
2622
cy.vrtStart();

package-lock.json

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

package.json

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,25 @@
2525
"react-material-ui-form-validator": "^2.1.1",
2626
"react-router-dom": "^5.2.0",
2727
"react-scripts": "4.0.3",
28-
"socket.io-client": "^2.3.0",
29-
"typescript": "^3.9.7",
28+
"socket.io-client": "^2.4.0",
29+
"typescript": "^4.3.4",
3030
"use-image": "^1.0.6"
3131
},
3232
"scripts": {
3333
"start": "chmod +x ./env.sh && ./env.sh && cp env-config.js ./public/ && react-scripts start",
3434
"build": "react-scripts build",
35-
"test": "react-scripts test"
35+
"test": "react-scripts test",
36+
"test:cy": "cypress run-ct"
3637
},
3738
"eslintConfig": {
3839
"extends": "react-app"
3940
},
40-
"browserslist": {
41-
"production": [
42-
">0.2%",
43-
"not dead",
44-
"not op_mini all"
45-
],
46-
"development": [
47-
"last 1 chrome version",
48-
"last 1 firefox version",
49-
"last 1 safari version"
50-
]
51-
},
41+
"browserslist": [
42+
">0.3%",
43+
"not ie 11",
44+
"not dead",
45+
"not op_mini all"
46+
],
5247
"husky": {
5348
"hooks": {
5449
"pre-commit": "lint-staged"
@@ -60,6 +55,8 @@
6055
]
6156
},
6257
"devDependencies": {
58+
"@cypress/react": "^5.9.1",
59+
"@cypress/webpack-dev-server": "^1.4.0",
6360
"@types/jest": "^26.0.20",
6461
"@types/lodash": "^4.14.170",
6562
"@types/node": "^15.12.4",
@@ -69,8 +66,7 @@
6966
"@types/react-material-ui-form-validator": "^2.1.0",
7067
"@types/react-router-dom": "^5.1.5",
7168
"@types/socket.io-client": "^1.4.33",
72-
"@visual-regression-tracker/agent-cypress": "^4.7.3",
73-
"cypress": "^5.6.0",
74-
"cypress-react-unit-test": "^4.17.0"
69+
"@visual-regression-tracker/agent-cypress": "^5.0.0",
70+
"cypress": "^7.6.0"
7571
}
7672
}

src/_test/test.moun.helper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { mount } from "cypress-react-unit-test";
2+
import { mount } from "@cypress/react";
33
import {
44
ProjectProvider,
55
AuthProvider,
@@ -34,6 +34,6 @@ export const mountVrtComponent = ({
3434
</Route>
3535
</MemoryRouter>,
3636
{
37-
stylesheets: ["/__root/src/index.css"],
37+
stylesheets: ["/src/index.css"],
3838
}
3939
);

src/components/Filters.spec.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* global cy */
22
import React from "react";
3-
import { mount } from "cypress-react-unit-test";
3+
import { mount } from "@cypress/react";
44
import Filters from "./Filters";
55
import { TestStatus } from "../types/testStatus";
66

@@ -30,6 +30,7 @@ describe("Filters", () => {
3030
branchName: "master",
3131
baselineBranchName: "baselineBranchName",
3232
merge: false,
33+
tempIgnoreAreas: "[]",
3334
},
3435
]}
3536
queryState={["Some query", cy.stub()]}
@@ -42,6 +43,6 @@ describe("Filters", () => {
4243
/>
4344
);
4445

45-
cy.get("#cypress-root").vrtTrack("Filters");
46+
cy.get("#__cy_root").vrtTrack("Filters");
4647
});
4748
});

src/components/Header.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* global cy */
22
import React from "react";
3-
import { mount } from "cypress-react-unit-test";
3+
import { mount } from "@cypress/react";
44
import Header from "./Header";
55
import { AuthProvider } from "../contexts";
66
import { BrowserRouter } from "react-router-dom";
@@ -19,7 +19,7 @@ describe("Header", () => {
1919
</BrowserRouter>
2020
);
2121

22-
cy.get("#cypress-root").vrtTrack("Header. Guest");
22+
cy.get("#__cy_root").vrtTrack("Header. Guest");
2323
});
2424

2525
it("Logged", () => {
@@ -32,7 +32,7 @@ describe("Header", () => {
3232
</BrowserRouter>
3333
);
3434

35-
cy.get("#cypress-root").vrtTrack("Header. Logged");
35+
cy.get("#__cy_root").vrtTrack("Header. Logged");
3636
});
3737
});
3838
});

0 commit comments

Comments
 (0)