2023-07-05 19:06:21 +02:00
|
|
|
import { stub } from "../support/mock";
|
2023-07-04 14:52:33 +02:00
|
|
|
|
|
|
|
|
describe("register", () => {
|
|
|
|
|
beforeEach(() => {
|
2024-10-25 16:04:26 +02:00
|
|
|
stub("zitadel.org.v2.OrganizationService", "ListOrganizations", {
|
2024-10-25 16:03:50 +02:00
|
|
|
data: {
|
2024-10-28 14:52:26 +01:00
|
|
|
details: {
|
|
|
|
|
totalResult: 1,
|
|
|
|
|
},
|
|
|
|
|
result: [{ id: "256088834543534543" }],
|
2024-10-25 16:03:50 +02:00
|
|
|
},
|
|
|
|
|
});
|
2024-08-06 09:34:45 +02:00
|
|
|
stub("zitadel.user.v2.UserService", "AddHumanUser", {
|
2023-07-04 14:52:33 +02:00
|
|
|
data: {
|
2024-10-29 10:44:03 +01:00
|
|
|
userId: "221394658884845598",
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
stub("zitadel.session.v2.SessionService", "CreateSession", {
|
|
|
|
|
data: {
|
|
|
|
|
details: {
|
|
|
|
|
sequence: 859,
|
|
|
|
|
changeDate: new Date("2024-04-04T09:40:55.577Z"),
|
|
|
|
|
resourceOwner: "220516472055706145",
|
2024-10-24 15:28:09 +02:00
|
|
|
},
|
2024-10-29 10:44:03 +01:00
|
|
|
sessionId: "221394658884845598",
|
|
|
|
|
sessionToken:
|
|
|
|
|
"SDMc7DlYXPgwRJ-Tb5NlLqynysHjEae3csWsKzoZWLplRji0AYY3HgAkrUEBqtLCvOayLJPMd0ax4Q",
|
|
|
|
|
challenges: undefined,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
stub("zitadel.session.v2.SessionService", "GetSession", {
|
|
|
|
|
data: {
|
|
|
|
|
session: {
|
|
|
|
|
id: "221394658884845598",
|
|
|
|
|
creationDate: new Date("2024-04-04T09:40:55.577Z"),
|
|
|
|
|
changeDate: new Date("2024-04-04T09:40:55.577Z"),
|
|
|
|
|
sequence: 859,
|
|
|
|
|
factors: {
|
|
|
|
|
user: {
|
|
|
|
|
id: "221394658884845598",
|
|
|
|
|
loginName: "john@zitadel.com",
|
|
|
|
|
},
|
|
|
|
|
password: undefined,
|
|
|
|
|
webAuthN: undefined,
|
|
|
|
|
intent: undefined,
|
|
|
|
|
},
|
|
|
|
|
metadata: {},
|
2024-10-24 15:28:09 +02:00
|
|
|
},
|
2023-07-04 14:52:33 +02:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2024-10-24 14:22:03 +02:00
|
|
|
it("should redirect a user who selects passwordless on register to /passkey/set", () => {
|
2023-07-04 14:52:33 +02:00
|
|
|
cy.visit("/register");
|
|
|
|
|
cy.get('input[autocomplete="firstname"]').focus().type("John");
|
|
|
|
|
cy.get('input[autocomplete="lastname"]').focus().type("Doe");
|
|
|
|
|
cy.get('input[autocomplete="email"]').focus().type("john@zitadel.com");
|
|
|
|
|
cy.get('input[type="checkbox"][value="privacypolicy"]').check();
|
|
|
|
|
cy.get('input[type="checkbox"][value="tos"]').check();
|
|
|
|
|
cy.get('button[type="submit"]').click();
|
2024-09-17 11:58:07 +02:00
|
|
|
cy.location("pathname", { timeout: 10_000 }).should("eq", "/passkey/set");
|
2023-07-04 14:52:33 +02:00
|
|
|
});
|
|
|
|
|
});
|