Skip to content

Commit

Permalink
chore(deps-dev): update cypress to v12 (#8889)
Browse files Browse the repository at this point in the history
This update required changing the configuration
and test directory structure. Some tests needed
to be amended as well to compensate for new
Cypress APIs.
  • Loading branch information
char0n committed Jun 7, 2023
1 parent f30d89a commit 3e81a4f
Show file tree
Hide file tree
Showing 80 changed files with 68 additions and 83 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
strategy:
fail-fast: false
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:
- uses: actions/checkout@v3
Expand All @@ -80,4 +80,4 @@ jobs:
run: npm ci

- 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 changes: 19 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -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()
},
},
})
11 changes: 0 additions & 11 deletions cypress.json

This file was deleted.

56 changes: 28 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"cross-env": "=7.0.3",
"css-loader": "=6.7.4",
"cssnano": "=6.0.1",
"cypress": "=9.5.1",
"cypress": "=12.13.0",
"dedent": "^0.7.0",
"deepmerge": "^4.3.1",
"enzyme": "=3.11.0",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ const clickLogoutAndReauthorise = () => {

describe("#4641: The Logout button in Authorize popup not clearing API Key", () => {
beforeEach(() => {
cy.server()
cy
.route({
url: "/4641*",
response: "OK",
})
.as("request")
cy.intercept("GET", "/4641*", {
body: "OK",
}).as("request")
})

it("should include the given api key in requests", () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/**
* @prettier
*/

const {
ParameterPrimitiveTestCases,
RequestBodyPrimitiveTestCases,
ResponsePrimitiveTestCases,
} = require("../../helpers/multiple-examples")
} = require("../../support/helpers/multiple-examples")
describe("OpenAPI 3.0 Multiple Examples - core features", () => {
describe("/String", () => {
describe("in a parameter", () => {
Expand Down Expand Up @@ -607,15 +606,19 @@ describe("OpenAPI 3.0 Multiple Examples - core features", () => {
},
})
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
.get("#operations-default-post_Object")
.click()
// Switch to Try-It-Out
.get(".try-out__btn")
.click()
// 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.")
// Execute the operation
.get(".execute")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
describe("OAuth2 Application flow", function() {
beforeEach(() => {
cy.server()
cy.route({
url: "**/oauth/*",
method: "POST"
}).as("tokenRequest")
cy.intercept("POST", "**/oauth/*").as("tokenRequest")
})

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

it("should make a password flow Authorization header request", () => {
Expand Down Expand Up @@ -119,4 +115,4 @@ describe("OAuth2 Password flow", function() {
.get(".live-responses-table .response-col_status")
.contains("200")
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ describe("OpenAPI 3.0 Additional JsonSchemaForm in a Parameter", () => {
.click()
.get(".json-schema-form-item > input")
.type("{selectall}spotted")
.blur()
// Assert against the input fields
.get(".json-schema-form-item > input")
.then((inputs) => {
Expand All @@ -308,6 +309,7 @@ describe("OpenAPI 3.0 Additional JsonSchemaForm in a Parameter", () => {
.click()
.get(".json-schema-form-item:last-of-type > input")
.type("{selectall}spotted")
.blur()
// Assert against the input fields
.get(".json-schema-form-item > input")
.then((inputs) => {
Expand Down Expand Up @@ -335,6 +337,7 @@ describe("OpenAPI 3.0 Additional JsonSchemaForm in a Parameter", () => {
.click()
.get(".json-schema-form-item:last-of-type > input")
.type("{selectall}spotted")
.blur()
// Assert against the input fields
.get(".json-schema-form-item > input")
.then((inputs) => {
Expand Down Expand Up @@ -431,6 +434,7 @@ describe("OpenAPI 3.0 Additional JsonSchemaForm in a Parameter", () => {
.click()
.get(".json-schema-form-item > input")
.type("{selectall}spotted")
.blur()
// Assert against the input fields
.get(".json-schema-form-item > input")
.then((inputs) => {
Expand Down Expand Up @@ -460,6 +464,7 @@ describe("OpenAPI 3.0 Additional JsonSchemaForm in a Parameter", () => {
.click()
.get(".json-schema-form-item:last-of-type > input")
.type("{selectall}spotted")
.blur()
// Assert against the input fields
.get(".json-schema-form-item > input")
.then((inputs) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 0 additions & 19 deletions test/e2e-cypress/plugins/index.js

This file was deleted.

File renamed without changes.

0 comments on commit 3e81a4f

Please sign in to comment.