chore(deps-dev): update cypress to v12 (#8889)

This update required changing the configuration
and test directory structure. Some tests needed
to be amended as well to compensate for new
Cypress APIs.
This commit is contained in:
Vladimír Gorej
2023-06-07 10:25:32 +02:00
committed by GitHub
parent f30d89af1b
commit 3e81a4f897
80 changed files with 68 additions and 83 deletions

View File

@@ -56,7 +56,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
containers: ['+(a11y|security|bugs)/**/*.js', 'features/**/+(o|d)*.js', 'features/**/m*.js', 'features/**/!(o|d|m)*.js'] containers: ['+(a11y|security|bugs)/**/*cy.js', 'features/**/+(o|d)*.cy.js', 'features/**/m*.cy.js', 'features/**/!(o|d|m)*.cy.js']
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -80,4 +80,4 @@ jobs:
run: npm ci run: npm ci
- name: Cypress Test - name: Cypress Test
run: npx start-server-and-test cy:start http://localhost:3204 'npm run cy:run -- --spec "test/e2e-cypress/tests/${{ matrix.containers }}"' run: npx start-server-and-test cy:start http://localhost:3204 'npm run cy:run -- --spec "test/e2e-cypress/e2e/${{ matrix.containers }}"'

19
cypress.config.js Normal file
View File

@@ -0,0 +1,19 @@
const { defineConfig } = require("cypress")
const startOAuthServer = require("./test/e2e-cypress/support/helpers/oauth2-server")
module.exports = defineConfig({
fileServerFolder: "test/e2e-cypress/static",
fixturesFolder: "test/e2e-cypress/fixtures",
screenshotsFolder: "test/e2e-cypress/screenshots",
videosFolder: "test/e2e-cypress/videos",
video: false,
e2e: {
baseUrl: "http://localhost:3230/",
supportFile: "test/e2e-cypress/support/e2e.js",
specPattern: "test/e2e-cypress/e2e/**/*.cy.{js,jsx}",
setupNodeEvents: () => {
startOAuthServer()
},
},
})

View File

@@ -1,11 +0,0 @@
{
"fileServerFolder": "test/e2e-cypress/static",
"fixturesFolder": "test/e2e-cypress/fixtures",
"integrationFolder": "test/e2e-cypress/tests",
"pluginsFile": "test/e2e-cypress/plugins/index.js",
"screenshotsFolder": "test/e2e-cypress/screenshots",
"supportFile": "test/e2e-cypress/support/index.js",
"videosFolder": "test/e2e-cypress/videos",
"baseUrl": "http://localhost:3230/",
"video": false
}

56
package-lock.json generated
View File

@@ -77,7 +77,7 @@
"cross-env": "=7.0.3", "cross-env": "=7.0.3",
"css-loader": "=6.7.4", "css-loader": "=6.7.4",
"cssnano": "=6.0.1", "cssnano": "=6.0.1",
"cypress": "=9.5.1", "cypress": "=12.13.0",
"dedent": "^0.7.0", "dedent": "^0.7.0",
"deepmerge": "^4.3.1", "deepmerge": "^4.3.1",
"enzyme": "=3.11.0", "enzyme": "=3.11.0",
@@ -9639,9 +9639,9 @@
} }
}, },
"node_modules/cypress": { "node_modules/cypress": {
"version": "9.5.1", "version": "12.13.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-9.5.1.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.13.0.tgz",
"integrity": "sha512-H7lUWB3Svr44gz1rNnj941xmdsCljXoJa2cDneAltjI9leKLMQLm30x6jLlpQ730tiVtIbW5HdUmBzPzwzfUQg==", "integrity": "sha512-QJlSmdPk+53Zhy69woJMySZQJoWfEWun3X5OOenGsXjRPVfByVTHorxNehbzhZrEzH9RDUDqVcck0ahtlS+N/Q==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
@@ -9659,12 +9659,12 @@
"check-more-types": "^2.24.0", "check-more-types": "^2.24.0",
"cli-cursor": "^3.1.0", "cli-cursor": "^3.1.0",
"cli-table3": "~0.6.1", "cli-table3": "~0.6.1",
"commander": "^5.1.0", "commander": "^6.2.1",
"common-tags": "^1.8.0", "common-tags": "^1.8.0",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"debug": "^4.3.2", "debug": "^4.3.4",
"enquirer": "^2.3.6", "enquirer": "^2.3.6",
"eventemitter2": "^6.4.3", "eventemitter2": "6.4.7",
"execa": "4.1.0", "execa": "4.1.0",
"executable": "^4.1.1", "executable": "^4.1.1",
"extract-zip": "2.0.1", "extract-zip": "2.0.1",
@@ -9677,7 +9677,7 @@
"listr2": "^3.8.3", "listr2": "^3.8.3",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"log-symbols": "^4.0.0", "log-symbols": "^4.0.0",
"minimist": "^1.2.5", "minimist": "^1.2.8",
"ospath": "^1.2.2", "ospath": "^1.2.2",
"pretty-bytes": "^5.6.0", "pretty-bytes": "^5.6.0",
"proxy-from-env": "1.0.0", "proxy-from-env": "1.0.0",
@@ -9692,7 +9692,7 @@
"cypress": "bin/cypress" "cypress": "bin/cypress"
}, },
"engines": { "engines": {
"node": ">=12.0.0" "node": "^14.0.0 || ^16.0.0 || >=18.0.0"
} }
}, },
"node_modules/cypress/node_modules/@types/node": { "node_modules/cypress/node_modules/@types/node": {
@@ -9787,9 +9787,9 @@
"dev": true "dev": true
}, },
"node_modules/cypress/node_modules/commander": { "node_modules/cypress/node_modules/commander": {
"version": "5.1.0", "version": "6.2.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
"integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">= 6" "node": ">= 6"
@@ -11855,9 +11855,9 @@
} }
}, },
"node_modules/eventemitter2": { "node_modules/eventemitter2": {
"version": "6.4.9", "version": "6.4.7",
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.9.tgz", "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz",
"integrity": "sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg==", "integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==",
"dev": true "dev": true
}, },
"node_modules/eventemitter3": { "node_modules/eventemitter3": {
@@ -37933,9 +37933,9 @@
"dev": true "dev": true
}, },
"cypress": { "cypress": {
"version": "9.5.1", "version": "12.13.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-9.5.1.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.13.0.tgz",
"integrity": "sha512-H7lUWB3Svr44gz1rNnj941xmdsCljXoJa2cDneAltjI9leKLMQLm30x6jLlpQ730tiVtIbW5HdUmBzPzwzfUQg==", "integrity": "sha512-QJlSmdPk+53Zhy69woJMySZQJoWfEWun3X5OOenGsXjRPVfByVTHorxNehbzhZrEzH9RDUDqVcck0ahtlS+N/Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"@cypress/request": "^2.88.10", "@cypress/request": "^2.88.10",
@@ -37952,12 +37952,12 @@
"check-more-types": "^2.24.0", "check-more-types": "^2.24.0",
"cli-cursor": "^3.1.0", "cli-cursor": "^3.1.0",
"cli-table3": "~0.6.1", "cli-table3": "~0.6.1",
"commander": "^5.1.0", "commander": "^6.2.1",
"common-tags": "^1.8.0", "common-tags": "^1.8.0",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"debug": "^4.3.2", "debug": "^4.3.4",
"enquirer": "^2.3.6", "enquirer": "^2.3.6",
"eventemitter2": "^6.4.3", "eventemitter2": "6.4.7",
"execa": "4.1.0", "execa": "4.1.0",
"executable": "^4.1.1", "executable": "^4.1.1",
"extract-zip": "2.0.1", "extract-zip": "2.0.1",
@@ -37970,7 +37970,7 @@
"listr2": "^3.8.3", "listr2": "^3.8.3",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"log-symbols": "^4.0.0", "log-symbols": "^4.0.0",
"minimist": "^1.2.5", "minimist": "^1.2.8",
"ospath": "^1.2.2", "ospath": "^1.2.2",
"pretty-bytes": "^5.6.0", "pretty-bytes": "^5.6.0",
"proxy-from-env": "1.0.0", "proxy-from-env": "1.0.0",
@@ -38044,9 +38044,9 @@
"dev": true "dev": true
}, },
"commander": { "commander": {
"version": "5.1.0", "version": "6.2.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
"integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
"dev": true "dev": true
}, },
"execa": { "execa": {
@@ -39548,9 +39548,9 @@
} }
}, },
"eventemitter2": { "eventemitter2": {
"version": "6.4.9", "version": "6.4.7",
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.9.tgz", "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz",
"integrity": "sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg==", "integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==",
"dev": true "dev": true
}, },
"eventemitter3": { "eventemitter3": {

View File

@@ -129,7 +129,7 @@
"cross-env": "=7.0.3", "cross-env": "=7.0.3",
"css-loader": "=6.7.4", "css-loader": "=6.7.4",
"cssnano": "=6.0.1", "cssnano": "=6.0.1",
"cypress": "=9.5.1", "cypress": "=12.13.0",
"dedent": "^0.7.0", "dedent": "^0.7.0",
"deepmerge": "^4.3.1", "deepmerge": "^4.3.1",
"enzyme": "=3.11.0", "enzyme": "=3.11.0",

View File

@@ -24,13 +24,9 @@ const clickLogoutAndReauthorise = () => {
describe("#4641: The Logout button in Authorize popup not clearing API Key", () => { describe("#4641: The Logout button in Authorize popup not clearing API Key", () => {
beforeEach(() => { beforeEach(() => {
cy.server() cy.intercept("GET", "/4641*", {
cy body: "OK",
.route({ }).as("request")
url: "/4641*",
response: "OK",
})
.as("request")
}) })
it("should include the given api key in requests", () => { it("should include the given api key in requests", () => {

View File

@@ -1,12 +1,11 @@
/** /**
* @prettier * @prettier
*/ */
const { const {
ParameterPrimitiveTestCases, ParameterPrimitiveTestCases,
RequestBodyPrimitiveTestCases, RequestBodyPrimitiveTestCases,
ResponsePrimitiveTestCases, ResponsePrimitiveTestCases,
} = require("../../helpers/multiple-examples") } = require("../../support/helpers/multiple-examples")
describe("OpenAPI 3.0 Multiple Examples - core features", () => { describe("OpenAPI 3.0 Multiple Examples - core features", () => {
describe("/String", () => { describe("/String", () => {
describe("in a parameter", () => { describe("in a parameter", () => {
@@ -607,7 +606,9 @@ describe("OpenAPI 3.0 Multiple Examples - core features", () => {
}, },
}) })
it("should display an error message when input validation fails", () => { it("should display an error message when input validation fails", () => {
cy.visit("/?url=/documents/features/multiple-examples-core.openapi.yaml") cy.visit(
"/?url=/documents/features/multiple-examples-core.openapi.yaml"
)
// Expand the operation // Expand the operation
.get("#operations-default-post_Object") .get("#operations-default-post_Object")
.click() .click()
@@ -615,7 +616,9 @@ describe("OpenAPI 3.0 Multiple Examples - core features", () => {
.get(".try-out__btn") .get(".try-out__btn")
.click() .click()
// Set an invalid value // Set an invalid value
.get(".parameters-container > div > table > tbody > tr > td.parameters-col_description > div:nth-child(2) > textarea") .get(
".parameters-container > div > table > tbody > tr > td.parameters-col_description > div:nth-child(2) > textarea"
)
.type("{{{{ [[[[ <<<< invalid JSON here.") .type("{{{{ [[[[ <<<< invalid JSON here.")
// Execute the operation // Execute the operation
.get(".execute") .get(".execute")

View File

@@ -1,10 +1,6 @@
describe("OAuth2 Application flow", function() { describe("OAuth2 Application flow", function() {
beforeEach(() => { beforeEach(() => {
cy.server() cy.intercept("POST", "**/oauth/*").as("tokenRequest")
cy.route({
url: "**/oauth/*",
method: "POST"
}).as("tokenRequest")
}) })
// https://github.com/swagger-api/swagger-ui/issues/6395 // https://github.com/swagger-api/swagger-ui/issues/6395

View File

@@ -1,10 +1,6 @@
describe("OAuth2 Password flow", function() { describe("OAuth2 Password flow", function() {
beforeEach(() => { beforeEach(() => {
cy.server() cy.intercept("POST", "**/oauth/*").as("tokenRequest")
cy.route({
url: "**/oauth/*",
method: "POST"
}).as("tokenRequest")
}) })
it("should make a password flow Authorization header request", () => { it("should make a password flow Authorization header request", () => {

View File

@@ -288,6 +288,7 @@ describe("OpenAPI 3.0 Additional JsonSchemaForm in a Parameter", () => {
.click() .click()
.get(".json-schema-form-item > input") .get(".json-schema-form-item > input")
.type("{selectall}spotted") .type("{selectall}spotted")
.blur()
// Assert against the input fields // Assert against the input fields
.get(".json-schema-form-item > input") .get(".json-schema-form-item > input")
.then((inputs) => { .then((inputs) => {
@@ -308,6 +309,7 @@ describe("OpenAPI 3.0 Additional JsonSchemaForm in a Parameter", () => {
.click() .click()
.get(".json-schema-form-item:last-of-type > input") .get(".json-schema-form-item:last-of-type > input")
.type("{selectall}spotted") .type("{selectall}spotted")
.blur()
// Assert against the input fields // Assert against the input fields
.get(".json-schema-form-item > input") .get(".json-schema-form-item > input")
.then((inputs) => { .then((inputs) => {
@@ -335,6 +337,7 @@ describe("OpenAPI 3.0 Additional JsonSchemaForm in a Parameter", () => {
.click() .click()
.get(".json-schema-form-item:last-of-type > input") .get(".json-schema-form-item:last-of-type > input")
.type("{selectall}spotted") .type("{selectall}spotted")
.blur()
// Assert against the input fields // Assert against the input fields
.get(".json-schema-form-item > input") .get(".json-schema-form-item > input")
.then((inputs) => { .then((inputs) => {
@@ -431,6 +434,7 @@ describe("OpenAPI 3.0 Additional JsonSchemaForm in a Parameter", () => {
.click() .click()
.get(".json-schema-form-item > input") .get(".json-schema-form-item > input")
.type("{selectall}spotted") .type("{selectall}spotted")
.blur()
// Assert against the input fields // Assert against the input fields
.get(".json-schema-form-item > input") .get(".json-schema-form-item > input")
.then((inputs) => { .then((inputs) => {
@@ -460,6 +464,7 @@ describe("OpenAPI 3.0 Additional JsonSchemaForm in a Parameter", () => {
.click() .click()
.get(".json-schema-form-item:last-of-type > input") .get(".json-schema-form-item:last-of-type > input")
.type("{selectall}spotted") .type("{selectall}spotted")
.blur()
// Assert against the input fields // Assert against the input fields
.get(".json-schema-form-item > input") .get(".json-schema-form-item > input")
.then((inputs) => { .then((inputs) => {

View File

@@ -1,19 +0,0 @@
const startOAuthServer = require("../helpers/oauth2-server")
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = (on, config) => {
startOAuthServer()
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}