Some checks failed
CI / Run tests and lints (push) Failing after 29s
CI / Build CLI docs (push) Has been skipped
CI / Run Playwright end-to-end tests (mysql) (push) Failing after 3s
CI / Run Playwright end-to-end tests (postgres) (push) Failing after 2s
CI / Run Playwright end-to-end tests (sqlite) (push) Failing after 3s
CodeQL / Analyze (go) (push) Failing after 4s
CodeQL / Analyze (javascript) (push) Failing after 3s
Docker Image Scanners / scanners (push) Failing after 4s
Synchronize Issue Labels / Synchronize Issue Labels (push) Has been skipped
CI / Run end-to-end tests (postgres) (push) Failing after 19s
CI / Run end-to-end tests (sqlite) (push) Failing after 2s
CI / Run Playwright end-to-end tests (cockroach) (push) Failing after 2s
CI / Draft newsletter (push) Has been skipped
CI / Generate release (push) Has been skipped
CI / Pending approval Slack notification (push) Has been skipped
CI / Send newsletter (push) Has been skipped
69 lines
2.1 KiB
TypeScript
69 lines
2.1 KiB
TypeScript
// Copyright © 2023 Ory Corp
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import { appPrefix, gen, website } from "../../../helpers"
|
|
import { routes as express } from "../../../helpers/express"
|
|
import { routes as react } from "../../../helpers/react"
|
|
|
|
context("2FA UI settings tests", () => {
|
|
;[
|
|
{
|
|
settings: react.settings,
|
|
base: react.base,
|
|
app: "react" as "react",
|
|
profile: "spa",
|
|
},
|
|
{
|
|
settings: express.settings,
|
|
base: express.base,
|
|
app: "express" as "express",
|
|
profile: "mfa",
|
|
},
|
|
].forEach(({ settings, profile, base, app }) => {
|
|
describe(`for app ${app}`, () => {
|
|
before(() => {
|
|
cy.useConfigProfile(profile)
|
|
cy.proxy(app)
|
|
})
|
|
|
|
const email = gen.email()
|
|
const password = gen.password()
|
|
|
|
before(() => {
|
|
cy.registerApi({
|
|
email,
|
|
password,
|
|
fields: { "traits.website": website },
|
|
})
|
|
})
|
|
|
|
beforeEach(() => {
|
|
cy.clearAllCookies()
|
|
cy.useConfig((builder) => builder.disableCodeMfa())
|
|
cy.login({ email, password, cookieUrl: base })
|
|
cy.visit(settings)
|
|
})
|
|
|
|
it("shows all settings forms", () => {
|
|
cy.get(appPrefix(app) + "h3").should("contain.text", "Profile Settings")
|
|
cy.get("h3").should("contain.text", "Change Password")
|
|
cy.get("h3").should("contain.text", "Manage 2FA Backup Recovery Codes")
|
|
cy.get("h3").should("contain.text", "Manage 2FA TOTP Authenticator App")
|
|
cy.get("h3").should("contain.text", "Manage Hardware Tokens")
|
|
cy.get('input[name="traits.email"]').should("contain.value", email)
|
|
cy.get('input[name="traits.website"]').should("contain.value", website)
|
|
|
|
cy.get('[data-testid="node/text/totp_secret_key/label"]').should(
|
|
"contain.text",
|
|
"This is your authenticator app secret",
|
|
)
|
|
cy.get("button").should(
|
|
"contain.text",
|
|
"Generate new backup recovery codes",
|
|
)
|
|
cy.get("button").should("contain.text", "Add security key")
|
|
})
|
|
})
|
|
})
|
|
})
|