Some checks failed
Node.js CI / build (push) Failing after 2s
Node.js CI / e2e-tests (+(a11y|security|bugs)/**/*cy.js) (push) Failing after 2s
Node.js CI / e2e-tests (features/**/!(o|d|m)*.cy.js) (push) Failing after 2s
Node.js CI / e2e-tests (features/**/+(o|d)*.cy.js) (push) Failing after 2s
Node.js CI / e2e-tests (features/**/m*.cy.js) (push) Failing after 2s
CodeQL / Analyze (javascript) (push) Failing after 2m49s
Security scan for docker image / build (push) Failing after 51s
52 lines
1.3 KiB
JavaScript
Executable File
52 lines
1.3 KiB
JavaScript
Executable File
describe("OAuth2 Bearer flow", () => {
|
|
beforeEach(() => {
|
|
const staticResponse = {
|
|
statusCode: 200,
|
|
body: {
|
|
name: "not a random secret for test",
|
|
}
|
|
}
|
|
cy.intercept("GET", "/get*", staticResponse).as(
|
|
"tokenRequest"
|
|
)
|
|
})
|
|
|
|
it("should be focused on input field with aria-label", () => {
|
|
cy.visit(
|
|
"/?url=/documents/features/auth-bearer-flow.yaml"
|
|
)
|
|
.get("button.authorize")
|
|
.click()
|
|
cy.focused()
|
|
.should("have.attr", "aria-label").and("eq", "auth-bearer-value")
|
|
})
|
|
it("should make a header request with proper sample cURL header", () => {
|
|
cy.visit(
|
|
"/?url=/documents/features/auth-bearer-flow.yaml"
|
|
)
|
|
.get("button.authorize")
|
|
.click()
|
|
.get("section > input")
|
|
.type("secret_token")
|
|
.get(".auth-btn-wrapper > .authorize")
|
|
.click()
|
|
.get("button.close-modal")
|
|
.click()
|
|
// Try-it-out
|
|
.get("#operations-default-get_get")
|
|
.click()
|
|
.get(".btn.try-out__btn")
|
|
.click()
|
|
.get(".btn.execute")
|
|
.click()
|
|
cy.wait("@tokenRequest")
|
|
.its("request")
|
|
.its("headers")
|
|
.its("authorization")
|
|
.should("equal", "Bearer secret_token")
|
|
.get(".curl")
|
|
.contains("Authorization: Bearer secret_token")
|
|
.should("be.visible")
|
|
})
|
|
})
|