mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 12:03:17 +00:00
restructure tests
This commit is contained in:
@@ -39,8 +39,18 @@ describe("login", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
removeStub("zitadel.settings.v2alpha.SessionService", "GetLoginSettings");
|
||||
addStub("zitadel.settings.v2alpha.SettingsService", "GetLoginSettings", {
|
||||
data: {
|
||||
settings: {
|
||||
passkeysType: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
it("should redirect a user with password authentication to /password", () => {
|
||||
});
|
||||
describe("password login", () => {
|
||||
beforeEach(() => {
|
||||
removeStub(
|
||||
"zitadel.user.v2alpha.UserService",
|
||||
"ListAuthenticationMethodTypes"
|
||||
@@ -54,11 +64,15 @@ describe("login", () => {
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
it("should redirect a user with password authentication to /password", () => {
|
||||
cy.visit("/loginname?loginName=johndoe%40zitadel.com&submit=true");
|
||||
cy.location("pathname", { timeout: 10_000 }).should("eq", "/password");
|
||||
});
|
||||
it("should redirect a user with passwordless authentication to /passkey/login", () => {
|
||||
});
|
||||
|
||||
describe("passkey login", () => {
|
||||
beforeEach(() => {
|
||||
removeStub(
|
||||
"zitadel.user.v2alpha.UserService",
|
||||
"ListAuthenticationMethodTypes"
|
||||
@@ -72,12 +86,18 @@ describe("login", () => {
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
it("should redirect a user with passwordless authentication to /passkey/login", () => {
|
||||
cy.visit("/loginname?loginName=johndoe%40zitadel.com&submit=true");
|
||||
cy.location("pathname", { timeout: 10_000 }).should("eq", "/passkey/login");
|
||||
cy.location("pathname", { timeout: 10_000 }).should(
|
||||
"eq",
|
||||
"/passkey/login"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("should prompt a user to setup passwordless authentication if passkey is allowed in the login settings", () => {
|
||||
describe("password login with passkey prompt", () => {
|
||||
beforeEach(() => {
|
||||
removeStub(
|
||||
"zitadel.user.v2alpha.UserService",
|
||||
"ListAuthenticationMethodTypes"
|
||||
@@ -105,11 +125,13 @@ describe("login", () => {
|
||||
challenges: undefined,
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
it("should prompt a user to setup passwordless authentication if passkey is allowed in the login settings", () => {
|
||||
cy.visit("/loginname?loginName=john%40zitadel.com&submit=true");
|
||||
cy.location("pathname", { timeout: 10_000 }).should("eq", "/password");
|
||||
cy.get('input[type="password"]').focus().type("MyStrongPassword!1");
|
||||
cy.get('button[type="submit"]').click();
|
||||
cy.location("pathname", { timeout: 10_000 }).should("eq", "/passkey/add");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,16 +31,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"service": "zitadel.settings.v2alpha.SettingsService",
|
||||
"method": "GetLoginSettings",
|
||||
"out": {
|
||||
"data": {
|
||||
"settings": {
|
||||
"passkeysType": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user