Files
swagger-ui/test/e2e-cypress/tests/features/info.js
Tim Lai 4557b2497b feat: OpenAPI 3.1 support (#8367)
- New top-level field - `webhooks`. This allows describing out-of-band webhooks that are available as part of the API.

- New top-level field - `jsonSchemaDialect`. This allows defining of a default `$schema` value for Schema Objects

- The Info Object has a new `summary` field.

- The License Object now has a new `identifier` field for SPDX licenses. This `identifier` field is mutually exclusive with the `url` field. Either can be used in OpenAPI 3.1 definitions.

- Components Object now has a new entry `pathItems`, to allow for reusable Path Item Objects to be defined within a valid OpenAPI document.

- `License` and `Contact` components are now exported and available via `getComponent`

- New version predicates and selectors for `isOpenAPI30` and `isOpenAPI31`. This avoids needing to change the usage of `isOAS3` selector.

- New OAS3 components: `Webhooks`

- New OAS3 wrapped components: `Info`, `License`
2023-02-03 14:06:56 -08:00

75 lines
2.5 KiB
JavaScript

describe("Render Info Component", () => {
describe("OpenAPI 2.x", () => {
const baseUrl = "/?url=/documents/features/info-openAPI2.yaml"
it("should render Info Description", () => {
cy.visit(baseUrl)
.get(".info .description")
.should("contains.text", "This is a sample")
})
it("should render Info Main anchor target xss link with safe `rel` attributes", () => {
cy.visit(baseUrl)
.get(".info .main > a")
.should("have.attr", "rel")
.and("include", "noopener")
.and("include", "noreferrer")
.get(".info .main > a")
.should("have.attr", "target")
.and("equal", "_blank")
})
it("should not render Info Summary (an OpenAPI 3.1 field)", () => {
cy.visit(baseUrl)
.get(".info__summary")
.should("not.exist")
})
})
describe("OpenAPI 3.0.x", () => {
const baseUrl = "/?url=/documents/features/info-openAPI30.yaml"
it("should render Info Description", () => {
cy.visit(baseUrl)
.get(".info .description")
.should("contains.text", "This is a sample")
})
it("should render Info Main anchor target xss link with safe `rel` attributes", () => {
cy.visit(baseUrl)
.get(".info .main > a")
.should("have.attr", "rel")
.and("include", "noopener")
.and("include", "noreferrer")
.get(".info .main > a")
.should("have.attr", "target")
.and("equal", "_blank")
})
it("should not render Info Summary (an OpenAPI 3.1 field)", () => {
cy.visit(baseUrl)
.get(".info__summary")
.should("not.exist")
})
})
describe("OpenAPI 3.1.x", () => {
const baseUrl = "/?url=/documents/features/info-openAPI31.yaml"
it("should render Info Description", () => {
cy.visit(baseUrl)
.get(".info .description")
.should("contains.text", "This is a sample")
})
it("should render Info Main anchor target xss link with safe `rel` attributes", () => {
cy.visit(baseUrl)
.get(".info .main > a")
.should("have.attr", "rel")
.and("include", "noopener")
.and("include", "noreferrer")
.get(".info .main > a")
.should("have.attr", "target")
.and("equal", "_blank")
})
it("should render Info Summary", () => {
cy.visit(baseUrl)
.get(".info__summary")
.should("exist")
.should("contains.text", "new 3.1.x specific field")
.get(".info .description")
.should("contains.text", "This is a sample")
})
})
})