snapshot of https://github.com/ory/kratos.git (master, 2026-09-15; blobs > 131072B omitted)
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
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
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
// 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("Social Sign Up Errors", () => {
|
||||
;[
|
||||
{
|
||||
registration: react.registration,
|
||||
app: "react" as "react",
|
||||
profile: "spa",
|
||||
},
|
||||
{
|
||||
registration: express.registration,
|
||||
app: "express" as "express",
|
||||
profile: "oidc",
|
||||
},
|
||||
].forEach(({ registration, profile, app }) => {
|
||||
describe(`for app ${app}`, () => {
|
||||
before(() => {
|
||||
cy.useConfigProfile(profile)
|
||||
cy.proxy(app)
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.clearAllCookies()
|
||||
cy.visit(registration)
|
||||
})
|
||||
|
||||
// playwright:migrated
|
||||
it("should fail when the login request is rejected", () => {
|
||||
cy.triggerOidc(app)
|
||||
cy.get("#reject").click()
|
||||
cy.location("pathname").should("equal", "/registration")
|
||||
cy.get(appPrefix(app) + '[data-testid="ui/message/4000001"]').should(
|
||||
"contain.text",
|
||||
"login rejected request",
|
||||
)
|
||||
cy.noSession()
|
||||
})
|
||||
|
||||
// playwright:migrated
|
||||
it("should fail when the consent request is rejected", () => {
|
||||
const email = gen.email()
|
||||
cy.triggerOidc(app)
|
||||
cy.get("#username").type(email)
|
||||
cy.get("#accept").click()
|
||||
cy.get("#reject").click()
|
||||
cy.location("pathname").should("equal", "/registration")
|
||||
cy.get('[data-testid="ui/message/4000001"]').should(
|
||||
"contain.text",
|
||||
"consent rejected request",
|
||||
)
|
||||
cy.noSession()
|
||||
})
|
||||
|
||||
it("should fail when the id_token is missing", () => {
|
||||
const email = gen.email()
|
||||
cy.triggerOidc(app)
|
||||
cy.get("#username").type(email)
|
||||
cy.get("#accept").click()
|
||||
cy.get("#website").type(website)
|
||||
cy.get("#accept").click()
|
||||
cy.location("pathname").should("equal", "/registration")
|
||||
cy.get('[data-testid="ui/message/4000001"]').should(
|
||||
"contain.text",
|
||||
"no id_token",
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,274 @@
|
||||
// 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"
|
||||
import { testFlowWebhook } from "../../../../helpers/webhook"
|
||||
|
||||
context("Social Sign Up Successes", () => {
|
||||
;[
|
||||
{
|
||||
login: react.login,
|
||||
registration: react.registration,
|
||||
app: "react" as "react",
|
||||
profile: "spa",
|
||||
},
|
||||
{
|
||||
login: express.login,
|
||||
registration: express.registration,
|
||||
app: "express" as "express",
|
||||
profile: "oidc",
|
||||
},
|
||||
].forEach(({ registration, login, profile, app }) => {
|
||||
describe(`for app ${app}`, () => {
|
||||
before(() => {
|
||||
cy.useConfigProfile(profile)
|
||||
cy.proxy(app)
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.clearAllCookies()
|
||||
cy.visit(registration)
|
||||
cy.setIdentitySchema(
|
||||
"file://test/e2e/profiles/oidc/identity.traits.schema.json",
|
||||
)
|
||||
})
|
||||
|
||||
const shouldSession = (email) => (session) => {
|
||||
const { identity } = session
|
||||
expect(identity.id).to.not.be.empty
|
||||
expect(identity.traits.website).to.equal(website)
|
||||
expect(identity.traits.email).to.equal(email)
|
||||
}
|
||||
|
||||
it("should be able to sign up with incomplete data and finally be signed in", () => {
|
||||
const email = gen.email()
|
||||
|
||||
cy.registerOidc({
|
||||
app,
|
||||
email,
|
||||
expectSession: false,
|
||||
route: registration,
|
||||
})
|
||||
|
||||
cy.get("#registration-password").should("not.exist")
|
||||
cy.get(appPrefix(app) + '[name="traits.email"]').should(
|
||||
"have.value",
|
||||
email,
|
||||
)
|
||||
cy.get('[data-testid="ui/message/4000002"]').should(
|
||||
"contain.text",
|
||||
"Property website is missing",
|
||||
)
|
||||
|
||||
cy.get('[name="traits.consent"][type="checkbox"]')
|
||||
.siblings("label")
|
||||
.click()
|
||||
cy.get('[name="traits.newsletter"][type="checkbox"]')
|
||||
.siblings("label")
|
||||
.click()
|
||||
cy.get('[name="traits.website"]').type("http://s")
|
||||
|
||||
cy.get('[name="provider"]')
|
||||
.should("have.length", 1)
|
||||
.should("have.value", "hydra")
|
||||
.should("contain.text", "Continue")
|
||||
.click()
|
||||
|
||||
cy.get("#registration-password").should("not.exist")
|
||||
cy.get('[name="traits.email"]').should("have.value", email)
|
||||
cy.get('[name="traits.website"]').should("have.value", "http://s")
|
||||
cy.get('[data-testid="ui/message/4000003"]').should(
|
||||
"contain.text",
|
||||
"length must be >= 10",
|
||||
)
|
||||
cy.get('[name="traits.website"]')
|
||||
.should("have.value", "http://s")
|
||||
.clear()
|
||||
.type(website)
|
||||
|
||||
cy.get('[name="traits.consent"]').should("be.checked")
|
||||
cy.get('[name="traits.newsletter"]').should("be.checked")
|
||||
|
||||
cy.triggerOidc(app)
|
||||
|
||||
cy.location("pathname").should((loc) => {
|
||||
expect(loc).to.be.oneOf(["/welcome", "/", "/sessions"])
|
||||
})
|
||||
|
||||
cy.getSession().should((session) => {
|
||||
shouldSession(email)(session)
|
||||
expect(session.identity.traits.consent).to.equal(true)
|
||||
})
|
||||
})
|
||||
|
||||
it("should pass transient_payload to webhook", () => {
|
||||
testFlowWebhook(
|
||||
(hooks) =>
|
||||
cy.setupHooks("registration", "after", "oidc", [
|
||||
...hooks,
|
||||
{ hook: "session" },
|
||||
]),
|
||||
() => {
|
||||
const email = gen.email()
|
||||
cy.registerOidc({
|
||||
app,
|
||||
email,
|
||||
website,
|
||||
route: registration,
|
||||
})
|
||||
cy.getSession().should(shouldSession(email))
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
// playwright:migrated
|
||||
it("should be able to sign up with complete data", () => {
|
||||
const email = gen.email()
|
||||
|
||||
cy.registerOidc({ app, email, website, route: registration })
|
||||
cy.getSession().should(shouldSession(email))
|
||||
})
|
||||
|
||||
it("should be able to convert a sign up flow to a sign in flow", () => {
|
||||
const email = gen.email()
|
||||
|
||||
cy.registerOidc({ app, email, website, route: registration })
|
||||
cy.logout()
|
||||
cy.noSession()
|
||||
cy.visit(registration)
|
||||
cy.triggerOidc(app)
|
||||
|
||||
cy.location("pathname").should((path) => {
|
||||
expect(path).to.oneOf(["/", "/welcome", "/sessions"])
|
||||
})
|
||||
|
||||
cy.getSession().should(shouldSession(email))
|
||||
})
|
||||
|
||||
it("should be able to convert a sign in flow to a sign up flow", () => {
|
||||
cy.setIdentitySchema(
|
||||
"file://test/e2e/profiles/oidc/identity-required.traits.schema.json",
|
||||
)
|
||||
|
||||
const email = gen.email()
|
||||
cy.visit(login)
|
||||
cy.triggerOidc(app)
|
||||
|
||||
cy.get("#username").clear().type(email)
|
||||
cy.get("#remember").click()
|
||||
cy.get("#accept").click()
|
||||
cy.get('[name="scope"]').each(($el) => cy.wrap($el).click())
|
||||
cy.get("#remember").click()
|
||||
cy.get("#accept").click()
|
||||
|
||||
cy.get('[data-testid="ui/message/4000002"]').should(
|
||||
"contain.text",
|
||||
"Property website is missing",
|
||||
)
|
||||
cy.get('[name="traits.website"]').type("http://s")
|
||||
|
||||
cy.triggerOidc(app)
|
||||
|
||||
cy.get('[data-testid="ui/message/4000003"]').should(
|
||||
"contain.text",
|
||||
"length must be >= 10",
|
||||
)
|
||||
cy.get('[name="traits.requirednested"]').should("not.exist")
|
||||
cy.get('[name="traits.requirednested.a"]').siblings("label").click()
|
||||
cy.get('[name="traits.consent"]').siblings("label").click()
|
||||
cy.get('[name="traits.website"]')
|
||||
.should("have.value", "http://s")
|
||||
.clear()
|
||||
.type(website)
|
||||
cy.triggerOidc(app)
|
||||
|
||||
cy.location("pathname").should("not.contain", "/registration")
|
||||
|
||||
cy.getSession().should(shouldSession(email))
|
||||
})
|
||||
|
||||
it("should be able to sign up with redirects", () => {
|
||||
const email = gen.email()
|
||||
cy.registerOidc({
|
||||
app,
|
||||
email,
|
||||
website,
|
||||
route: registration + "?return_to=https://www.example.org/",
|
||||
})
|
||||
cy.location("href").should("eq", "https://www.example.org/")
|
||||
cy.logout()
|
||||
})
|
||||
|
||||
it("should be able to register with upstream parameters", () => {
|
||||
const email = gen.email()
|
||||
cy.intercept("GET", "**/oauth2/auth*").as("getHydraRegistration")
|
||||
|
||||
cy.visit(registration + "?return_to=https://www.example.org/")
|
||||
|
||||
// hd is forwarded; login_hint is never forwarded because a
|
||||
// caller-supplied value cannot be trusted (HackerOne #3239672,
|
||||
// ory-corp/cloud#8955).
|
||||
cy.addInputElement("form", "upstream_parameters.hd", "ory.sh")
|
||||
cy.addInputElement("form", "upstream_parameters.login_hint", email)
|
||||
|
||||
cy.triggerOidc(app)
|
||||
|
||||
// once a request to getHydraRegistration responds, 'cy.wait' will resolve
|
||||
cy.wait("@getHydraRegistration")
|
||||
.its("request.url")
|
||||
.should("include", "hd=ory.sh")
|
||||
.and("not.include", "login_hint")
|
||||
})
|
||||
|
||||
it("oidc registration with duplicate identifier should return new login flow with duplicate error", () => {
|
||||
cy.visit(registration)
|
||||
|
||||
const email = gen.email()
|
||||
const password = gen.password()
|
||||
|
||||
cy.get('input[name="traits.email"]').type(email)
|
||||
cy.get('input[name="password"]').type(password)
|
||||
cy.get('input[name="traits.website"]').type(website)
|
||||
cy.get('[name="traits.consent"]').siblings("label").click()
|
||||
cy.get('[name="traits.newsletter"]').siblings("label").click()
|
||||
|
||||
cy.submitPasswordForm()
|
||||
|
||||
cy.location("pathname").should("not.contain", "/registration")
|
||||
|
||||
cy.getSession().should(shouldSession(email))
|
||||
|
||||
cy.logout()
|
||||
cy.noSession()
|
||||
|
||||
// register the account through the OIDC provider
|
||||
cy.registerOidc({
|
||||
app,
|
||||
acceptConsent: true,
|
||||
acceptLogin: true,
|
||||
expectSession: false,
|
||||
email,
|
||||
website,
|
||||
route: registration,
|
||||
})
|
||||
|
||||
cy.get('[data-testid="ui/message/1010016"]').should("be.visible")
|
||||
|
||||
cy.location("href").should("contain", "/login")
|
||||
|
||||
cy.get("[name='provider'][value='google']").should("be.visible")
|
||||
cy.get("[name='provider'][value='github']").should("be.visible")
|
||||
|
||||
if (app === "express") {
|
||||
cy.get("[data-testid='forgot-password-link']").should("be.visible")
|
||||
}
|
||||
|
||||
cy.get("input[name='password']").type(password)
|
||||
cy.submitPasswordForm()
|
||||
cy.getSession()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user