mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-26 14:28:46 +00:00
chore(login): remove integration tests (#11608)
# Which Problems Are Solved Removes the Cypress integration tests and associated configuration from the apps/login project to streamline the build process. # How the Problems Are Solved - Removed cypress directory, integration directory, and cypress.config.ts from apps/login. - Updated project.json to remove test-integration targets and dependencies. - Updated package.json to remove the cypress dev dependency and clean script reference. - Updated tsconfig.json to remove the now-redundant integration exclusion. - Ensured acceptance tests are preserved and correctly excluded from build inputs. --------- Co-authored-by: Florian Forster <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: conblem <[email protected]>
This commit is contained in:
co-authored by
Florian Forster
Copilot
conblem
parent
c3a6bdb0bb
commit
c1be72765c
@@ -1,2 +0,0 @@
|
||||
API_MOCK_STUBS_HOST=${DEVCONTAINER_LOGIN_API_MOCK_HOST:-localhost}
|
||||
API_MOCK_STUBS_URL=http://${API_MOCK_STUBS_HOST}:22220/v1/stubs
|
||||
@@ -1,4 +0,0 @@
|
||||
ZITADEL_API_URL=http://${DEVCONTAINER_LOGIN_API_MOCK_HOST:-localhost}:22222
|
||||
ZITADEL_SERVICE_USER_TOKEN=none
|
||||
ZITADEL_SERVICE_USER_TOKEN_FILE=""
|
||||
PORT=3001
|
||||
@@ -1,17 +0,0 @@
|
||||
import { defineConfig } from "cypress";
|
||||
export default defineConfig({
|
||||
reporter: "list",
|
||||
video: true,
|
||||
retries: {
|
||||
runMode: 2
|
||||
},
|
||||
e2e: {
|
||||
baseUrl: `http://localhost:3001${process.env.NEXT_PUBLIC_BASE_PATH || ""}`,
|
||||
specPattern: "integration/integration/**/*.cy.{js,jsx,ts,tsx}",
|
||||
supportFile: "integration/support/e2e.{js,jsx,ts,tsx}",
|
||||
pageLoadTimeout: 120_0000,
|
||||
env: {
|
||||
API_MOCK_STUBS_URL: process.env.API_MOCK_STUBS_URL || "http://localhost:22220/v1/stubs"
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,2 +0,0 @@
|
||||
screenshots
|
||||
videos
|
||||
@@ -1 +0,0 @@
|
||||
side-effects-cache=false
|
||||
@@ -1,16 +0,0 @@
|
||||
FROM bufbuild/buf:1.64.0 AS dependencies
|
||||
RUN buf export https://github.com/envoyproxy/protoc-gen-validate.git --path validate --output /proto && \
|
||||
buf export https://github.com/grpc-ecosystem/grpc-gateway.git --path protoc-gen-openapiv2 --output /proto && \
|
||||
buf export https://github.com/googleapis/googleapis.git --path google/api/annotations.proto --path google/api/http.proto --path google/api/field_behavior.proto --output /proto
|
||||
|
||||
|
||||
FROM golang:1.20.5-alpine3.18 AS mock-zitadel
|
||||
|
||||
RUN go install github.com/eliobischof/grpc-mock/cmd/grpc-mock@01b09f60db1b501178af59bed03b2c22661df48c
|
||||
|
||||
COPY mocked-services.cfg .
|
||||
COPY initial-stubs initial-stubs
|
||||
COPY --from=dependencies /proto/ ./
|
||||
COPY --from=zitadel-protos /zitadel/ ./zitadel/
|
||||
|
||||
ENTRYPOINT [ "sh", "-c", "grpc-mock -v 1 -proto $(tr '\n' ',' < ./mocked-services.cfg) -stub-dir ./initial-stubs -mock-addr :22222" ]
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
[
|
||||
{
|
||||
"service": "zitadel.settings.v2.SettingsService",
|
||||
"method": "GetBrandingSettings",
|
||||
"out": {
|
||||
"data": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"service": "zitadel.settings.v2.SettingsService",
|
||||
"method": "GetSecuritySettings",
|
||||
"out": {
|
||||
"data": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"service": "zitadel.settings.v2.SettingsService",
|
||||
"method": "GetLegalAndSupportSettings",
|
||||
"out": {
|
||||
"data": {
|
||||
"settings": {
|
||||
"tosLink": "http://whatever.com/help",
|
||||
"privacyPolicyLink": "http://whatever.com/help",
|
||||
"helpLink": "http://whatever.com/help"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"service": "zitadel.settings.v2.SettingsService",
|
||||
"method": "GetActiveIdentityProviders",
|
||||
"out": {
|
||||
"data": {
|
||||
"identityProviders": [
|
||||
{
|
||||
"id": "123",
|
||||
"name": "Hubba bubba",
|
||||
"type": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"service": "zitadel.settings.v2.SettingsService",
|
||||
"method": "GetPasswordComplexitySettings",
|
||||
"out": {
|
||||
"data": {
|
||||
"settings": {
|
||||
"minLength": 8,
|
||||
"requiresUppercase": true,
|
||||
"requiresLowercase": true,
|
||||
"requiresNumber": true,
|
||||
"requiresSymbol": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"service": "zitadel.settings.v2.SettingsService",
|
||||
"method": "GetHostedLoginTranslation",
|
||||
"out": {
|
||||
"data": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,7 +0,0 @@
|
||||
zitadel/user/v2/user_service.proto
|
||||
zitadel/org/v2/org_service.proto
|
||||
zitadel/session/v2/session_service.proto
|
||||
zitadel/settings/v2/settings_service.proto
|
||||
zitadel/management.proto
|
||||
zitadel/auth.proto
|
||||
zitadel/admin.proto
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"name": "@zitadel/login-api-mock",
|
||||
"targets": {
|
||||
"build": {
|
||||
"description": "Builds the API mock server",
|
||||
"command": "nx run @zitadel/devcontainer:compose build login-api-mock"
|
||||
},
|
||||
"serve": {
|
||||
"description": "Starts the API mock server",
|
||||
"continuous": true,
|
||||
"command": "nx run @zitadel/devcontainer:compose up --force-recreate --renew-anon-volumes login-api-mock"
|
||||
},
|
||||
"down": {
|
||||
"description": "Stops the API mock server",
|
||||
"command": "nx run @zitadel/devcontainer:compose down login-api-mock"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import js from "@eslint/js";
|
||||
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
||||
import tsParser from "@typescript-eslint/parser";
|
||||
import prettierConfig from "eslint-config-prettier/flat";
|
||||
import pluginCypress from "eslint-plugin-cypress";
|
||||
|
||||
export default [
|
||||
{ ignores: ["node_modules/**"] },
|
||||
js.configs.recommended,
|
||||
{
|
||||
files: ["**/*.ts"],
|
||||
plugins: {
|
||||
"@typescript-eslint": tsPlugin,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
},
|
||||
rules: {
|
||||
...tsPlugin.configs.recommended.rules,
|
||||
"no-unused-vars": "off",
|
||||
"no-undef": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{ argsIgnorePattern: "^_" },
|
||||
],
|
||||
},
|
||||
},
|
||||
pluginCypress.configs.recommended,
|
||||
prettierConfig,
|
||||
];
|
||||
@@ -1,112 +0,0 @@
|
||||
import { stub } from "../support/e2e";
|
||||
|
||||
describe("verify invite", () => {
|
||||
beforeEach(() => {
|
||||
stub("zitadel.org.v2.OrganizationService", "ListOrganizations", {
|
||||
data: {
|
||||
details: {
|
||||
totalResult: 1,
|
||||
},
|
||||
result: [{ id: "256088834543534543" }],
|
||||
},
|
||||
});
|
||||
|
||||
stub("zitadel.user.v2.UserService", "ListAuthenticationMethodTypes", {
|
||||
data: {
|
||||
authMethodTypes: [], // user with no auth methods was invited
|
||||
},
|
||||
});
|
||||
|
||||
stub("zitadel.user.v2.UserService", "GetUserByID", {
|
||||
data: {
|
||||
user: {
|
||||
userId: "221394658884845598",
|
||||
state: 1,
|
||||
username: "[email protected]",
|
||||
loginNames: ["[email protected]"],
|
||||
preferredLoginName: "[email protected]",
|
||||
human: {
|
||||
userId: "221394658884845598",
|
||||
state: 1,
|
||||
username: "[email protected]",
|
||||
loginNames: ["[email protected]"],
|
||||
preferredLoginName: "[email protected]",
|
||||
profile: {
|
||||
givenName: "John",
|
||||
familyName: "Doe",
|
||||
avatarUrl: "https://example.com/avatar.jpg",
|
||||
},
|
||||
email: {
|
||||
email: "[email protected]",
|
||||
isVerified: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
stub("zitadel.session.v2.SessionService", "CreateSession", {
|
||||
data: {
|
||||
details: {
|
||||
sequence: 859,
|
||||
changeDate: new Date("2024-04-04T09:40:55.577Z"),
|
||||
resourceOwner: "220516472055706145",
|
||||
},
|
||||
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: "[email protected]",
|
||||
},
|
||||
password: undefined,
|
||||
webAuthN: undefined,
|
||||
intent: undefined,
|
||||
},
|
||||
metadata: {},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
stub("zitadel.settings.v2.SettingsService", "GetLoginSettings", {
|
||||
data: {
|
||||
settings: {
|
||||
passkeysType: 1,
|
||||
allowLocalAuthentication: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("shows authenticators after successful invite verification", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyInviteCode");
|
||||
|
||||
cy.visit("/verify?userId=221394658884845598&code=abc&invite=true");
|
||||
cy.get("[data-testid=submit-button]").click();
|
||||
cy.url().should("include", Cypress.config().baseUrl + "/authenticator/set");
|
||||
});
|
||||
|
||||
it("shows an error if invite code validation failed", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyInviteCode", {
|
||||
code: 3,
|
||||
error: "error validating code",
|
||||
});
|
||||
|
||||
// TODO: Avoid uncaught exception in application
|
||||
cy.once("uncaught:exception", () => false);
|
||||
cy.visit("/verify?userId=221394658884845598&code=abc&invite=true");
|
||||
cy.get("[data-testid=submit-button]").click();
|
||||
cy.contains("Could not verify invite", { timeout: 10_000 });
|
||||
});
|
||||
});
|
||||
@@ -1,172 +0,0 @@
|
||||
import { stub } from "../support/e2e";
|
||||
|
||||
describe("login", () => {
|
||||
beforeEach(() => {
|
||||
stub("zitadel.org.v2.OrganizationService", "ListOrganizations", {
|
||||
data: {
|
||||
details: {
|
||||
totalResult: 1,
|
||||
},
|
||||
result: [{ id: "256088834543534543" }],
|
||||
},
|
||||
});
|
||||
stub("zitadel.session.v2.SessionService", "CreateSession", {
|
||||
data: {
|
||||
details: {
|
||||
sequence: 859,
|
||||
changeDate: new Date("2024-04-04T09:40:55.577Z"),
|
||||
resourceOwner: "220516472055706145",
|
||||
},
|
||||
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: "[email protected]",
|
||||
},
|
||||
password: undefined,
|
||||
webAuthN: undefined,
|
||||
intent: undefined,
|
||||
},
|
||||
metadata: {},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
stub("zitadel.settings.v2.SettingsService", "GetLoginSettings", {
|
||||
data: {
|
||||
settings: {
|
||||
passkeysType: 1,
|
||||
allowLocalAuthentication: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
describe("password login", () => {
|
||||
beforeEach(() => {
|
||||
stub("zitadel.user.v2.UserService", "ListUsers", {
|
||||
data: {
|
||||
details: {
|
||||
totalResult: 1,
|
||||
},
|
||||
result: [
|
||||
{
|
||||
userId: "221394658884845598",
|
||||
state: 1,
|
||||
username: "[email protected]",
|
||||
loginNames: ["[email protected]"],
|
||||
preferredLoginName: "[email protected]",
|
||||
human: {
|
||||
userId: "221394658884845598",
|
||||
state: 1,
|
||||
username: "[email protected]",
|
||||
loginNames: ["[email protected]"],
|
||||
preferredLoginName: "[email protected]",
|
||||
profile: {
|
||||
givenName: "John",
|
||||
familyName: "Doe",
|
||||
avatarUrl: "https://example.com/avatar.jpg",
|
||||
},
|
||||
email: {
|
||||
email: "[email protected]",
|
||||
isVerified: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
stub("zitadel.user.v2.UserService", "ListAuthenticationMethodTypes", {
|
||||
data: {
|
||||
authMethodTypes: [1], // 1 for password authentication
|
||||
},
|
||||
});
|
||||
});
|
||||
it("should redirect a user with password authentication to /password", () => {
|
||||
cy.visit("/loginname?loginName=john%40example.com&submit=true");
|
||||
cy.url({ timeout: 5 * 60_000 }).should("include", Cypress.config().baseUrl + "/password");
|
||||
});
|
||||
describe("with passkey prompt", () => {
|
||||
beforeEach(() => {
|
||||
stub("zitadel.session.v2.SessionService", "SetSession", {
|
||||
data: {
|
||||
details: {
|
||||
sequence: 859,
|
||||
changeDate: "2023-07-04T07:58:20.126Z",
|
||||
resourceOwner: "220516472055706145",
|
||||
},
|
||||
sessionToken: "SDMc7DlYXPgwRJ-Tb5NlLqynysHjEae3csWsKzoZWLplRji0AYY3HgAkrUEBqtLCvOayLJPMd0ax4Q",
|
||||
challenges: undefined,
|
||||
},
|
||||
});
|
||||
});
|
||||
// it("should prompt a user to setup passkey authentication if passkey is allowed in the login settings", () => {
|
||||
// cy.visit("/loginname?loginName=john%40example.com&submit=true");
|
||||
// cy.location("pathname", { timeout: 5 * 60_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/set",
|
||||
// );
|
||||
// });
|
||||
});
|
||||
});
|
||||
describe("passkey login", () => {
|
||||
beforeEach(() => {
|
||||
stub("zitadel.user.v2.UserService", "ListUsers", {
|
||||
data: {
|
||||
details: {
|
||||
totalResult: 1,
|
||||
},
|
||||
result: [
|
||||
{
|
||||
userId: "221394658884845598",
|
||||
state: 1,
|
||||
username: "[email protected]",
|
||||
loginNames: ["[email protected]"],
|
||||
preferredLoginName: "[email protected]",
|
||||
human: {
|
||||
userId: "221394658884845598",
|
||||
state: 1,
|
||||
username: "[email protected]",
|
||||
loginNames: ["[email protected]"],
|
||||
preferredLoginName: "[email protected]",
|
||||
profile: {
|
||||
givenName: "John",
|
||||
familyName: "Doe",
|
||||
avatarUrl: "https://example.com/avatar.jpg",
|
||||
},
|
||||
email: {
|
||||
email: "[email protected]",
|
||||
isVerified: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
stub("zitadel.user.v2.UserService", "ListAuthenticationMethodTypes", {
|
||||
data: {
|
||||
authMethodTypes: [2], // 2 for passkey authentication
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should redirect a user with passkey authentication to /passkey", () => {
|
||||
cy.visit("/loginname?loginName=john%40example.com&submit=true");
|
||||
cy.url().should("include", Cypress.config().baseUrl + "/passkey");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,21 +0,0 @@
|
||||
import { stub } from "../support/e2e";
|
||||
|
||||
const IDP_URL = "https://example.com/idp/url";
|
||||
|
||||
describe("register idps", () => {
|
||||
beforeEach(() => {
|
||||
stub("zitadel.user.v2.UserService", "StartIdentityProviderIntent", {
|
||||
data: {
|
||||
authUrl: IDP_URL,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should redirect the user to the correct url", () => {
|
||||
cy.visit("/idp");
|
||||
cy.get('button[e2e="google"]').click();
|
||||
cy.origin(IDP_URL, { args: IDP_URL }, (url) => {
|
||||
cy.location("href").should("eq", url);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,73 +0,0 @@
|
||||
import { stub } from "../support/e2e";
|
||||
|
||||
describe("register", () => {
|
||||
beforeEach(() => {
|
||||
stub("zitadel.org.v2.OrganizationService", "ListOrganizations", {
|
||||
data: {
|
||||
details: {
|
||||
totalResult: 1,
|
||||
},
|
||||
result: [{ id: "256088834543534543" }],
|
||||
},
|
||||
});
|
||||
stub("zitadel.settings.v2.SettingsService", "GetLoginSettings", {
|
||||
data: {
|
||||
settings: {
|
||||
passkeysType: 1,
|
||||
allowRegister: true,
|
||||
allowLocalAuthentication: true,
|
||||
defaultRedirectUri: "",
|
||||
},
|
||||
},
|
||||
});
|
||||
stub("zitadel.user.v2.UserService", "AddHumanUser", {
|
||||
data: {
|
||||
userId: "221394658884845598",
|
||||
},
|
||||
});
|
||||
stub("zitadel.session.v2.SessionService", "CreateSession", {
|
||||
data: {
|
||||
details: {
|
||||
sequence: 859,
|
||||
changeDate: new Date("2024-04-04T09:40:55.577Z"),
|
||||
resourceOwner: "220516472055706145",
|
||||
},
|
||||
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: "[email protected]",
|
||||
},
|
||||
password: undefined,
|
||||
webAuthN: undefined,
|
||||
intent: undefined,
|
||||
},
|
||||
metadata: {},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should redirect a user who selects passkey on register to /passkey/set", () => {
|
||||
cy.visit("/register");
|
||||
cy.get('input[data-testid="firstname-text-input"]').focus().type("John");
|
||||
cy.get('input[data-testid="lastname-text-input"]').focus().type("Doe");
|
||||
cy.get('input[data-testid="email-text-input"]').focus().type("[email protected]");
|
||||
cy.get('input[type="checkbox"][value="privacypolicy"]').check();
|
||||
cy.get('input[type="checkbox"][value="tos"]').check();
|
||||
cy.get('button[type="submit"]').click();
|
||||
cy.url().should("include", Cypress.config().baseUrl + "/passkey/set");
|
||||
});
|
||||
});
|
||||
@@ -1,96 +0,0 @@
|
||||
import { stub } from "../support/e2e";
|
||||
|
||||
describe("verify email", () => {
|
||||
beforeEach(() => {
|
||||
stub("zitadel.org.v2.OrganizationService", "ListOrganizations", {
|
||||
data: {
|
||||
details: {
|
||||
totalResult: 1,
|
||||
},
|
||||
result: [{ id: "256088834543534543" }],
|
||||
},
|
||||
});
|
||||
|
||||
stub("zitadel.user.v2.UserService", "ListAuthenticationMethodTypes", {
|
||||
data: {
|
||||
authMethodTypes: [1], // set one method such that we know that the user was not invited
|
||||
},
|
||||
});
|
||||
|
||||
stub("zitadel.user.v2.UserService", "SendEmailCode");
|
||||
|
||||
stub("zitadel.user.v2.UserService", "GetUserByID", {
|
||||
data: {
|
||||
user: {
|
||||
userId: "221394658884845598",
|
||||
state: 1,
|
||||
username: "[email protected]",
|
||||
loginNames: ["[email protected]"],
|
||||
preferredLoginName: "[email protected]",
|
||||
human: {
|
||||
userId: "221394658884845598",
|
||||
state: 1,
|
||||
username: "[email protected]",
|
||||
loginNames: ["[email protected]"],
|
||||
preferredLoginName: "[email protected]",
|
||||
profile: {
|
||||
givenName: "John",
|
||||
familyName: "Doe",
|
||||
avatarUrl: "https://example.com/avatar.jpg",
|
||||
},
|
||||
email: {
|
||||
email: "[email protected]",
|
||||
isVerified: false, // email is not verified yet
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
stub("zitadel.session.v2.SessionService", "CreateSession", {
|
||||
data: {
|
||||
details: {
|
||||
sequence: 859,
|
||||
changeDate: new Date("2024-04-04T09:40:55.577Z"),
|
||||
resourceOwner: "220516472055706145",
|
||||
},
|
||||
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: "[email protected]",
|
||||
},
|
||||
password: undefined,
|
||||
webAuthN: undefined,
|
||||
intent: undefined,
|
||||
},
|
||||
metadata: {},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("shows an error if email code validation failed", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyEmail", {
|
||||
code: 3,
|
||||
error: "error validating code",
|
||||
});
|
||||
// TODO: Avoid uncaught exception in application
|
||||
cy.once("uncaught:exception", () => false);
|
||||
cy.visit("/verify?userId=221394658884845598&code=abc");
|
||||
cy.get("[data-testid=submit-button]").click();
|
||||
cy.contains("Could not verify email");
|
||||
});
|
||||
});
|
||||
@@ -1,49 +0,0 @@
|
||||
// Handle React 19 SSR hydration errors that don't affect functionality
|
||||
Cypress.on('uncaught:exception', (err, runnable) => {
|
||||
// React error #419 is specifically about SSR Suspense boundary issues
|
||||
// This doesn't affect the actual functionality, just the SSR/CSR transition
|
||||
if (err.message.includes('Minified React error #419')) {
|
||||
console.warn('Cypress: Suppressed React SSR error #419 (Suspense boundary issue):', err.message);
|
||||
return false;
|
||||
}
|
||||
// Other hydration mismatches that are common with React 19 + Next.js 15
|
||||
if (err.message.includes('server could not finish this Suspense boundary') ||
|
||||
err.message.includes('Switched to client rendering') ||
|
||||
err.message.includes('Hydration failed') ||
|
||||
err.message.includes('Text content does not match server-rendered HTML')) {
|
||||
console.warn('Cypress: Suppressed React hydration error (non-functional):', err.message);
|
||||
return false;
|
||||
}
|
||||
// Let other errors fail the test as they should
|
||||
return true;
|
||||
});
|
||||
|
||||
const url = Cypress.env("API_MOCK_STUBS_URL");
|
||||
|
||||
function removeStub(service: string, method: string) {
|
||||
return cy.request({
|
||||
url,
|
||||
method: "DELETE",
|
||||
qs: {
|
||||
service,
|
||||
method,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function stub(service: string, method: string, out?: any) {
|
||||
removeStub(service, method);
|
||||
return cy.request({
|
||||
url,
|
||||
method: "POST",
|
||||
body: {
|
||||
stubs: [
|
||||
{
|
||||
service,
|
||||
method,
|
||||
out,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["es5", "dom"],
|
||||
"types": ["cypress", "node"]
|
||||
},
|
||||
"include": ["**/*.ts", "../cypress.config.ts"]
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
"test-unit": "vitest --run",
|
||||
"test-dockerized": "vitest --run --config vitest.config.dockerized.ts",
|
||||
"lint-staged": "lint-staged",
|
||||
"clean": "rm -rf node_modules .next cypress"
|
||||
"clean": "rm -rf node_modules .next"
|
||||
},
|
||||
"git": {
|
||||
"pre-commit": "lint-staged"
|
||||
@@ -81,7 +81,6 @@
|
||||
"@zitadel/proto": "workspace:*",
|
||||
"autoprefixer": "^10.4.23",
|
||||
"concurrently": "^9.2.1",
|
||||
"cypress": "^14.5.4",
|
||||
"dotenv-cli": "^8.0.0",
|
||||
"env-cmd": "^10.1.0",
|
||||
"esbuild": "^0.27.3",
|
||||
|
||||
+27
-123
@@ -4,47 +4,34 @@
|
||||
"prod": {
|
||||
"description": "Runs the Next.js Login application in production mode from the standalone build",
|
||||
"continuous": true,
|
||||
"dependsOn": [
|
||||
"build"
|
||||
],
|
||||
"dependsOn": ["build"],
|
||||
"defaultConfiguration": "default",
|
||||
"configurations": {
|
||||
"default": {},
|
||||
"test-login-integration": {}
|
||||
"default": {}
|
||||
}
|
||||
},
|
||||
"dev": {
|
||||
"description": "Runs the Next.js Login application in development mode with hot-reloading",
|
||||
"continuous": true,
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
"dependsOn": ["^build"]
|
||||
},
|
||||
"build": {
|
||||
"description": "Builds the Next.js Login application in standalone mode for production",
|
||||
"cache": true,
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": [
|
||||
"default",
|
||||
"{workspaceRoot}/pnpm-lock.yaml",
|
||||
"!{projectRoot}/.env.*",
|
||||
"!{projectRoot}/.local.env",
|
||||
"!{projectRoot}/integration/**/*",
|
||||
"!{projectRoot}/acceptance/**/*",
|
||||
"!{projectRoot}/dockerized/**/*",
|
||||
"!{projectRoot}/cypress.config.ts"
|
||||
"!{projectRoot}/dockerized/**/*"
|
||||
],
|
||||
"outputs": [
|
||||
"{projectRoot}/.next/standalone"
|
||||
]
|
||||
"outputs": ["{projectRoot}/.next/standalone"]
|
||||
},
|
||||
"pack": {
|
||||
"description": "Builds a local Docker image for the ZITADEL Login UI (zitadel/zitadel-login:local). Requires Docker daemon.",
|
||||
"dependsOn": [
|
||||
"build"
|
||||
],
|
||||
"dependsOn": ["build"],
|
||||
"command": "docker build -f apps/login/Dockerfile -t zitadel/zitadel-login:local apps/login",
|
||||
"cache": false,
|
||||
"inputs": [
|
||||
@@ -52,144 +39,68 @@
|
||||
"{workspaceRoot}/pnpm-lock.yaml",
|
||||
"{projectRoot}/Dockerfile",
|
||||
"!{projectRoot}/.env.*",
|
||||
"!{projectRoot}/integration/**/*",
|
||||
"!{projectRoot}/acceptance/**/*"
|
||||
]
|
||||
},
|
||||
"build-vercel": {
|
||||
"description": "Builds the Next.js Login application for Vercel deployment",
|
||||
"cache": true,
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": [
|
||||
"default",
|
||||
"{workspaceRoot}/pnpm-lock.yaml",
|
||||
"!{projectRoot}/.env.*",
|
||||
"!{projectRoot}/.local.env",
|
||||
"!{projectRoot}/integration/**/*",
|
||||
"!{projectRoot}/acceptance/**/*",
|
||||
"!{projectRoot}/dockerized/**/*",
|
||||
"!{projectRoot}/cypress.config.ts"
|
||||
"!{projectRoot}/dockerized/**/*"
|
||||
],
|
||||
"outputs": [
|
||||
"{projectRoot}/.next",
|
||||
"!{projectRoot}/.next/cache",
|
||||
"!{projectRoot}/.next/standalone"
|
||||
]
|
||||
"outputs": ["{projectRoot}/.next", "!{projectRoot}/.next/cache", "!{projectRoot}/.next/standalone"]
|
||||
},
|
||||
"lint": {
|
||||
"description": "Runs all linters",
|
||||
"dependsOn": [
|
||||
"lint-check-*"
|
||||
]
|
||||
"dependsOn": ["lint-check-*"]
|
||||
},
|
||||
"lint-check-prettier": {
|
||||
"description": "Checks code formatting with Prettier",
|
||||
"cache": true,
|
||||
"inputs": [
|
||||
"default"
|
||||
]
|
||||
"inputs": ["default"]
|
||||
},
|
||||
"lint-check-next": {
|
||||
"description": "Runs Next.js specific lint checks",
|
||||
"cache": true,
|
||||
"inputs": [
|
||||
"default"
|
||||
]
|
||||
"inputs": ["default"],
|
||||
"dependsOn": ["^build"]
|
||||
},
|
||||
"test": {
|
||||
"description": "Runs all tests (unit, integration, and dockerized)",
|
||||
"dependsOn": [
|
||||
"test-unit",
|
||||
"test-integration",
|
||||
"test-dockerized"
|
||||
]
|
||||
"description": "Runs all tests (unit, and dockerized)",
|
||||
"dependsOn": ["test-unit", "test-dockerized"]
|
||||
},
|
||||
"test-unit": {
|
||||
"description": "Runs unit tests using Vitest",
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
"dependsOn": ["^build"]
|
||||
},
|
||||
"test-dockerized": {
|
||||
"description": "Runs dockerized integration tests (OpenTelemetry and custom CA certificate tests)",
|
||||
"dependsOn": [
|
||||
"build",
|
||||
"test-integration"
|
||||
],
|
||||
"dependsOn": ["build"],
|
||||
"executor": "nx:run-commands",
|
||||
"cache": true,
|
||||
"inputs": [
|
||||
"default",
|
||||
"!{projectRoot}/integration/**/*",
|
||||
"!{projectRoot}/acceptance/**/*",
|
||||
"!{projectRoot}/dockerized/**/output/**/*"
|
||||
],
|
||||
"inputs": ["default", "!{projectRoot}/acceptance/**/*", "!{projectRoot}/dockerized/**/output/**/*"],
|
||||
"options": {
|
||||
"cwd": "{projectRoot}",
|
||||
"commands": [
|
||||
"pnpm vitest --run --config vitest.config.dockerized.ts"
|
||||
]
|
||||
"commands": ["pnpm vitest --run --config vitest.config.dockerized.ts"]
|
||||
}
|
||||
},
|
||||
"test-ssl": {
|
||||
"description": "Runs TLS integration tests using testcontainers",
|
||||
"dependsOn": [
|
||||
"build"
|
||||
],
|
||||
"dependsOn": ["build"],
|
||||
"executor": "nx:run-commands",
|
||||
"cache": true,
|
||||
"inputs": [
|
||||
"default",
|
||||
"!{projectRoot}/integration/**/*",
|
||||
"!{projectRoot}/acceptance/**/*",
|
||||
"!{projectRoot}/dockerized/**/output/**/*"
|
||||
],
|
||||
"inputs": ["default", "!{projectRoot}/acceptance/**/*", "!{projectRoot}/dockerized/**/output/**/*"],
|
||||
"options": {
|
||||
"cwd": "{projectRoot}",
|
||||
"commands": [
|
||||
"pnpm vitest --run --config vitest.config.dockerized.ts dockerized/ssl"
|
||||
]
|
||||
"commands": ["pnpm vitest --run --config vitest.config.dockerized.ts dockerized/ssl"]
|
||||
}
|
||||
},
|
||||
"test-integration-run-login": {
|
||||
"description": "Runs the Login application under test. It has its own target, separate from test-integration, because it's a continuous task.",
|
||||
"dependsOn": [
|
||||
"build"
|
||||
],
|
||||
"continuous": true,
|
||||
"command": "nx run @zitadel/login:prod:test-login-integration --excludeTaskDependencies"
|
||||
},
|
||||
"test-integration": {
|
||||
"description": "Runs integration tests using Cypress against a running Login and a mocked API",
|
||||
"dependsOn": [
|
||||
"test-integration-run-login",
|
||||
"@zitadel/login-api-mock:build",
|
||||
"@zitadel/login-api-mock:serve"
|
||||
],
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "{projectRoot}",
|
||||
"parallel": false,
|
||||
"commands": [
|
||||
"pnpm cypress install",
|
||||
"pnpm wait-on --verbose --interval 2000 --simultaneous 1 --timeout 30m \"tcp:${API_MOCK_STUBS_HOST}:22220\" \"http-get://localhost:3001/ui/v2/login/verify?userId=221394658884845598&code=abc\"",
|
||||
"DISPLAY='' pnpm cypress run --headless",
|
||||
"nx run @zitadel/login:test-integration-stop"
|
||||
]
|
||||
},
|
||||
"inputs": [
|
||||
"default",
|
||||
"{workspaceRoot}/pnpm-lock.yaml",
|
||||
"!{projectRoot}/acceptance/**/*",
|
||||
{ "env": "LOGIN_BASE_URL" }
|
||||
]
|
||||
},
|
||||
"test-integration-stop": {
|
||||
"description": "Stops the gRPC mock container used for integration tests.",
|
||||
"command": "nx run @zitadel/login-api-mock:down"
|
||||
},
|
||||
"test-acceptance": {
|
||||
"description": "Runs the Playwright acceptance test suite in apps/login/acceptance/ against a running ZITADEL stack. Requires LOGIN_BASE_URL, ZITADEL_API_URL, and ZITADEL_ADMIN_TOKEN to be set (or apps/login/.env.test.local to exist). Run the setup script at acceptance/setup/setup.sh first to seed config.",
|
||||
"executor": "nx:run-commands",
|
||||
@@ -206,9 +117,7 @@
|
||||
},
|
||||
"pack-archive": {
|
||||
"description": "Packages the standalone Login application build into an archive",
|
||||
"dependsOn": [
|
||||
"build"
|
||||
],
|
||||
"dependsOn": ["build"],
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"parallel": false,
|
||||
@@ -216,15 +125,10 @@
|
||||
"STANDALONE_DIR": "{projectRoot}/.next/standalone",
|
||||
"PACK_DIR": "{workspaceRoot}/.artifacts/pack"
|
||||
},
|
||||
"commands": [
|
||||
"mkdir -p ${PACK_DIR}",
|
||||
"tar -czf ${PACK_DIR}/zitadel-login.tar.gz -C ${STANDALONE_DIR} ."
|
||||
]
|
||||
"commands": ["mkdir -p ${PACK_DIR}", "tar -czf ${PACK_DIR}/zitadel-login.tar.gz -C ${STANDALONE_DIR} ."]
|
||||
},
|
||||
"cache": true,
|
||||
"outputs": [
|
||||
"{workspaceRoot}/.artifacts/pack/zitadel-login.tar.gz"
|
||||
]
|
||||
"outputs": ["{workspaceRoot}/.artifacts/pack/zitadel-login.tar.gz"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,7 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
return { title: t("title") };
|
||||
}
|
||||
|
||||
async function loadSessions({
|
||||
serviceConfig,
|
||||
organization,
|
||||
}: {
|
||||
serviceConfig: ServiceConfig;
|
||||
organization?: string;
|
||||
}) {
|
||||
async function loadSessions({ serviceConfig, organization }: { serviceConfig: ServiceConfig; organization?: string }) {
|
||||
const cookieIds = await getAllSessionCookieIds();
|
||||
|
||||
if (cookieIds && cookieIds.length) {
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
@@ -23,23 +19,9 @@
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
]
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts",
|
||||
".next/dev/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"integration",
|
||||
"acceptance",
|
||||
"dockerized",
|
||||
"vitest.config*.ts"
|
||||
]
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
|
||||
"exclude": ["node_modules", "acceptance", "dockerized", "vitest.config*.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user