Files
upstream-ory-kratos/test/e2e/playwright/tests/desktop/profile_first/everything.registration.spec.ts
upstream-mirror c60cc7ca75
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
snapshot of https://github.com/ory/kratos.git (master, 2026-09-15; blobs > 131072B omitted)
2026-09-15 21:19:12 +05:00

148 lines
4.6 KiB
TypeScript

// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0
import { expect } from "@playwright/test"
import { test } from "../../../fixtures"
import { toConfig } from "../../../lib/helper"
import { RegistrationPage } from "../../../models/elements/registration"
import {
OryKratosConfiguration,
RegistrationFlowStyle,
RegistrationNodeGroup,
} from "../../../../shared/config"
const selfservice: Partial<OryKratosConfiguration["selfservice"]> = {
methods: {
code: {
passwordless_enabled: true,
},
password: {
enabled: true,
},
webauthn: {
enabled: true,
config: {
passwordless: true,
rp: { id: "localhost", display_name: "Ory Kratos" },
},
},
passkey: {
enabled: true,
config: {
rp: { id: "localhost", display_name: "Ory Kratos" },
},
},
totp: {
enabled: true,
},
lookup_secret: {
enabled: true,
},
oidc: {
enabled: true,
config: {
providers: [
{
id: "github",
provider: "github",
label: "GitHub",
client_id: "1",
client_secret: "1",
mapper_url: "base64://",
},
{
id: "google",
provider: "google",
label: "Google",
client_id: "1",
client_secret: "1",
mapper_url: "base64://e30=",
},
],
},
},
},
}
test.describe("profile_first strategy with all methods enabled", () => {
;["default", "password"].forEach((group: RegistrationNodeGroup) => {
test.describe(`password group behavior is ${group}`, () => {
;["profile_first", "unified"].forEach((style: RegistrationFlowStyle) => {
test.describe(`registration with ${style} enabled`, () => {
;[
["password"],
["password", "webauthn"],
["password", "code"],
["password", "code", "webauthn"],
["password", "code", "passkey"],
["password", "code", "passkey", "webauthn"],
].forEach((methods) => {
test.describe(`methods ${methods.join(", ")} enabled`, () => {
test.use({
configOverride: {
...toConfig({
style: "identifier_first",
mitigateEnumeration: false,
selfservice: {
...selfservice,
methods: {
password: {
enabled: methods.includes("password"),
},
webauthn: {
enabled: methods.includes("webauthn"),
config: {
passwordless: true,
rp: { id: "localhost", display_name: "Ory Kratos" },
},
},
passkey: {
enabled: methods.includes("passkey"),
config: {
rp: { id: "localhost", display_name: "Ory Kratos" },
},
},
code: {
enabled: methods.includes("code"),
passwordless_enabled: methods.includes("code"),
},
totp: {
enabled: false,
},
lookup_secret: {
enabled: false,
},
oidc: {
enabled: false,
},
},
flows: {
registration: { style },
},
},
}),
feature_flags: {
password_profile_registration_node_group: group,
},
},
})
test("registration does not have any duplicated fields when using profile first", async ({
page,
config,
}) => {
const registration = new RegistrationPage(page, config)
await registration.open()
await expect(
page.locator('[name="traits.email"]'),
"expect the profile form fields to not be duplicated",
).toHaveCount(style === "profile_first" ? 1 : methods.length)
})
})
})
})
})
})
})
})