Преглед на файлове

meta: supplemental tests for #4537 (via #4828)

* `test/e2e` -> `test/e2e-selenium`

* add Cypress

* ESLint fixes

* MOAR cypress

* `integration` -> `tests`

* wire Cypress up to a hot e2e server

* add failing tests for #4537

* Update package.json
bubble
kyle преди 6 години
committed by GitHub
родител
ревизия
b4f1886306
No known key found for this signature in database GPG ключ ID: 4AEE18F83AFDEB23
променени са 3 файла, в които са добавени 88 реда и са изтрити 4 реда
  1. +27
    -0
      test/e2e-cypress/static/documents/features/deep-linking.openapi.yaml
  2. +19
    -1
      test/e2e-cypress/static/documents/features/deep-linking.swagger.yaml
  3. +42
    -3
      test/e2e-cypress/tests/deep-linking.js

+ 27
- 0
test/e2e-cypress/static/documents/features/deep-linking.openapi.yaml Целия файл

@@ -0,0 +1,27 @@
openapi: "3.0.0"

paths:
/:
get:
operationId: "myOperation"
tags: ["myTag"]
summary: an operation
responses:
'200':
description: a pet to be returned
content:
application/json:
schema:
type: object
/withSpaces:
post:
operationId: "my Operation"
tags: ["my Tag"]
summary: an operation
responses:
'200':
description: a pet to be returned
content:
application/json:
schema:
type: object

+ 19
- 1
test/e2e-cypress/static/documents/features/deep-linking.swagger.yaml Целия файл

@@ -1 +1,19 @@
swagger: "2.0"
swagger: "2.0"

paths:
/:
get:
operationId: "myOperation"
tags: ["myTag"]
summary: an operation
responses:
"200":
description: ok
/withSpaces:
post:
operationId: "my Operation"
tags: ["my Tag"]
summary: an operation
responses:
"200":
description: ok

+ 42
- 3
test/e2e-cypress/tests/deep-linking.js Целия файл

@@ -1,5 +1,44 @@
describe("The Home Page", function () {
it("successfully loads", function () {
cy.visit("/")
describe("Deep linking feature", () => {
describe("in Swagger 2", () => {
beforeEach(() => {
cy.visit("/?deepLinking=true&url=/documents/features/deep-linking.swagger.yaml")
})
it("should generate an element ID and URL fragment for an operation", () => {
cy.get(".opblock-get")
.should("exist")
.should("have.id", "operations-myTag-myOperation")
.click()
.window()
.should("have.deep.property", "location.hash", "#/myTag/myOperation")
})
it("should generate an element ID and URL fragment for an operation with spaces", () => {
cy.get(".opblock-post")
.should("exist")
.should("have.id", "operations-my_Tag-my_Operation")
.click()
.window()
.should("have.deep.property", "location.hash", "#/my%20Tag/my%20Operation")
})
})
describe("in OpenAPI 3", () => {
beforeEach(() => {
cy.visit("/?deepLinking=true&url=/documents/features/deep-linking.openapi.yaml")
})
it("should generate an element ID and URL fragment for an operation", () => {
cy.get(".opblock-get")
.should("exist")
.should("have.id", "operations-myTag-myOperation")
.click()
.window()
.should("have.deep.property", "location.hash", "#/myTag/myOperation")
})
it("should generate an element ID and URL fragment for an operation with spaces", () => {
cy.get(".opblock-post")
.should("exist")
.should("have.id", "operations-my_Tag-my_Operation")
.click()
.window()
.should("have.deep.property", "location.hash", "#/my%20Tag/my%20Operation")
})
})
})

Зареждане…
Отказ
Запис