Skip to content

Commit

Permalink
alpha to beta change integration test, rm unused dep
Browse files Browse the repository at this point in the history
  • Loading branch information
peintnermax committed Sep 21, 2023
1 parent 363abd2 commit 2cf06fc
Show file tree
Hide file tree
Showing 7 changed files with 393 additions and 223 deletions.
36 changes: 14 additions & 22 deletions apps/login/cypress/integration/login.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { stub } from "../support/mock";

describe("login", () => {
beforeEach(() => {
stub("zitadel.session.v2alpha.SessionService", "CreateSession", {
stub("zitadel.session.v2beta.SessionService", "CreateSession", {
data: {
details: {
sequence: 859,
Expand All @@ -16,7 +16,7 @@ describe("login", () => {
},
});

stub("zitadel.session.v2alpha.SessionService", "GetSession", {
stub("zitadel.session.v2beta.SessionService", "GetSession", {
data: {
session: {
id: "221394658884845598",
Expand All @@ -37,7 +37,7 @@ describe("login", () => {
},
});

stub("zitadel.settings.v2alpha.SettingsService", "GetLoginSettings", {
stub("zitadel.settings.v2beta.SettingsService", "GetLoginSettings", {
data: {
settings: {
passkeysType: 1,
Expand All @@ -47,23 +47,19 @@ describe("login", () => {
});
describe("password login", () => {
beforeEach(() => {
stub(
"zitadel.user.v2alpha.UserService",
"ListAuthenticationMethodTypes",
{
data: {
authMethodTypes: [1], // 1 for password authentication
},
}
);
stub("zitadel.user.v2beta.UserService", "ListAuthenticationMethodTypes", {
data: {
authMethodTypes: [1], // 1 for password authentication
},
});
});
it("should redirect a user with password authentication to /password", () => {
cy.visit("/loginname?loginName=john%40zitadel.com&submit=true");
cy.location("pathname", { timeout: 10_000 }).should("eq", "/password");
});
describe("with passkey prompt", () => {
beforeEach(() => {
stub("zitadel.session.v2alpha.SessionService", "SetSession", {
stub("zitadel.session.v2beta.SessionService", "SetSession", {
data: {
details: {
sequence: 859,
Expand All @@ -90,15 +86,11 @@ describe("login", () => {
});
describe("passkey login", () => {
beforeEach(() => {
stub(
"zitadel.user.v2alpha.UserService",
"ListAuthenticationMethodTypes",
{
data: {
authMethodTypes: [2], // 2 for passwordless authentication
},
}
);
stub("zitadel.user.v2beta.UserService", "ListAuthenticationMethodTypes", {
data: {
authMethodTypes: [2], // 2 for passwordless authentication
},
});
});
it("should redirect a user with passwordless authentication to /passkey/login", () => {
cy.visit("/loginname?loginName=john%40zitadel.com&submit=true");
Expand Down
2 changes: 1 addition & 1 deletion apps/login/cypress/integration/register-idp.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const IDP_URL = "https://example.com/idp/url";

describe("register idps", () => {
beforeEach(() => {
stub("zitadel.user.v2alpha.UserService", "StartIdentityProviderIntent", {
stub("zitadel.user.v2beta.UserService", "StartIdentityProviderIntent", {
data: {
authUrl: IDP_URL,
},
Expand Down
2 changes: 1 addition & 1 deletion apps/login/cypress/integration/register.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { stub } from "../support/mock";

describe("register", () => {
beforeEach(() => {
stub("zitadel.user.v2alpha.UserService", "AddHumanUser", {
stub("zitadel.user.v2beta.UserService", "AddHumanUser", {
data: {
userId: "123",
},
Expand Down
4 changes: 2 additions & 2 deletions apps/login/cypress/integration/verify.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { stub } from "../support/mock";

describe("/verify", () => {
it("redirects after successful email verification", () => {
stub("zitadel.user.v2alpha.UserService", "VerifyEmail");
stub("zitadel.user.v2beta.UserService", "VerifyEmail");
cy.visit("/verify?userID=123&code=abc&submit=true");
cy.location("pathname", { timeout: 10_000 }).should("eq", "/loginname");
});
it("shows an error if validation failed", () => {
stub("zitadel.user.v2alpha.UserService", "VerifyEmail", {
stub("zitadel.user.v2beta.UserService", "VerifyEmail", {
code: 3,
error: "error validating code",
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[
{
"service": "zitadel.settings.v2alpha.SettingsService",
"service": "zitadel.settings.v2beta.SettingsService",
"method": "GetBrandingSettings",
"out": {}
},
{
"service": "zitadel.settings.v2alpha.SettingsService",
"service": "zitadel.settings.v2beta.SettingsService",
"method": "GetLegalAndSupportSettings",
"out": {
"data": {
Expand All @@ -18,7 +18,7 @@
}
},
{
"service": "zitadel.settings.v2alpha.SettingsService",
"service": "zitadel.settings.v2beta.SettingsService",
"method": "GetActiveIdentityProviders",
"out": {
"data": {
Expand All @@ -33,7 +33,7 @@
}
},
{
"service": "zitadel.settings.v2alpha.SettingsService",
"service": "zitadel.settings.v2beta.SettingsService",
"method": "GetPasswordComplexitySettings",
"out": {
"data": {
Expand Down
1 change: 0 additions & 1 deletion apps/login/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"@zitadel/react": "workspace:*",
"@zitadel/server": "workspace:*",
"clsx": "1.2.1",
"date-fns": "2.29.3",
"moment": "^2.29.4",
"next": "13.4.12",
"next-themes": "^0.2.1",
Expand Down
Loading

0 comments on commit 2cf06fc

Please sign in to comment.