diff --git a/.gitignore b/.gitignore index 6bea26fda563326c795cdb8083f61d6d077affba..7486a561ca1bc09cfff5b10c858b02e455e30de0 100644 --- a/.gitignore +++ b/.gitignore @@ -69,7 +69,6 @@ scripts/solidify-generate-timestamped-version.script.ts scripts/update-package-lock-version.script.ts scripts/update-package-version.script.ts scripts/proxy.conf.variable.js -cypress/integration/environments/cypress-environment.local.ts cypress/environments/cypress-environment.local.ts proxy.conf.local.js /report.* diff --git a/angular.json b/angular.json index a3cfb1f9da023f0a670729f2de2bbb1b082be868..1939dcd391e79cfcbf2fb99a0b96d5f7f915adec 100644 --- a/angular.json +++ b/angular.json @@ -439,11 +439,46 @@ } }, "defaultConfiguration": "production" + }, + "cypress-run": { + "builder": "@cypress/schematic:cypress", + "options": { + "devServerTarget": "dlcm-portal:serve" + }, + "configurations": { + "production": { + "devServerTarget": "dlcm-portal:serve:production" + } + } + }, + "cypress-open": { + "builder": "@cypress/schematic:cypress", + "options": { + "watch": true, + "headless": false + } + }, + "e2e": { + "builder": "@cypress/schematic:cypress", + "options": { + "devServerTarget": "dlcm-portal:serve", + "watch": true, + "headless": false + }, + "configurations": { + "production": { + "devServerTarget": "dlcm-portal:serve:production" + } + } } } } }, "cli": { - "analytics": false + "analytics": false, + "schematicCollections": [ + "@cypress/schematic", + "@schematics/angular" + ] } -} +} \ No newline at end of file diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..10b2b5dc9567fcbfefb315ddb6631a2bbef39431 --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,32 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - cypress.config.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + +import {defineConfig} from "cypress"; + +export default defineConfig({ + viewportWidth: 1200, + viewportHeight: 660, + e2e: { + baseUrl: "http://localhost:4200", + }, +}); diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 69dddfb9d7e0d03cbef8c5a39d1d4f282acd071b..0000000000000000000000000000000000000000 --- a/cypress.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "projectId": "xt5fd6", - "requestTimeout": 10000, - "ignoreTestFiles": "*.js", - "chromeWebSecurity": false, - "defaultCommandTimeout": 10000 -} diff --git a/cypress/e2e/admin/admin.cy.ts b/cypress/e2e/admin/admin.cy.ts new file mode 100644 index 0000000000000000000000000000000000000000..2cb057d2abfe93ce8dbcab576577a984480c2840 --- /dev/null +++ b/cypress/e2e/admin/admin.cy.ts @@ -0,0 +1,45 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - admin.cy.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + +import {DataTestEnum} from "@app/shared/enums/data-test.enum"; +import {Enums} from "@enums"; +import {TestHelper} from "../../support/test-helper"; + +describe("Admin Page", () => { + beforeEach(() => { + TestHelper.login(Enums.UserApplicationRole.UserApplicationRoleEnum.admin); + }); + + xit("navigate to admin page", () => { + cy.visit("/"); + TestHelper.getTestData(DataTestEnum.linkUserMenu).click(); + TestHelper.getTestData(DataTestEnum.linkMenuAdmin).click(); + cy.location("pathname").should("eq", "/admin"); + }); + + xit("visit admin page", () => { + cy.visit("/admin"); + cy.get("#admin-home-title").contains("Administration"); + cy.get("mat-card").should("have.length", 10); + }); +}); diff --git a/cypress/e2e/deposit/deposit.cy.ts b/cypress/e2e/deposit/deposit.cy.ts new file mode 100644 index 0000000000000000000000000000000000000000..666739d8a59aaa73affdf3e04f383c481b0da43a --- /dev/null +++ b/cypress/e2e/deposit/deposit.cy.ts @@ -0,0 +1,115 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - deposit.cy.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + +import {DataTestEnum} from "@app/shared/enums/data-test.enum"; +import {Enums} from "@enums"; +import {HttpStatusCode} from "../../enums/http-status-code.enum"; +import {TestHelper} from "../../support/test-helper"; + +describe("Deposit Page", () => { + beforeEach(() => { + TestHelper.login(Enums.UserApplicationRole.UserApplicationRoleEnum.root); + cy.visit("/deposit"); + // TestHelper.waitXhr("preingest/deposits?*", () => { + // cy.wait(2000); // MANDATORY FOR NOT RANDOM ERROR... + // TestHelper.getTestData(DataTestEnum.linkMenuDeposit).click(); + // }, { + // expectedHttpCode: undefined, + // }); + + // TestHelper.waitModuleLoaded(ModuleLoadedEnum.depositModuleLoaded); + }); + + xit("visit deposit", () => { + TestHelper.getTestData(DataTestEnum.depositDataTable).should("exist"); + }); + + xit("should create a deposit", () => { + cy.get("#add-deposit-btn").click(); + TestHelper.getTestData(DataTestEnum.depositTitle).type("Deposit Test 1"); + TestHelper.getTestData(DataTestEnum.depositDescription).type("Description of deposit"); + TestHelper.getTestData(DataTestEnum.depositAddMeAsAuthor).click(); + TestHelper.getTestData(DataTestEnum.depositPublicationDate).invoke("val").should("not.be.empty"); + TestHelper.getTestData(DataTestEnum.depositAccessLevel).click().get("mat-option").contains("Public").click(); + + TestHelper.getTestData(DataTestEnum.depositLicenseId) + .click() + .get("solidify-searchable-single-select-content li") + .first() + .click(); + + TestHelper.getTestData(DataTestEnum.depositLanguage).first().click().get("mat-option").contains("en").click(); + TestHelper.getTestData(DataTestEnum.depositSave).should("not.be.disabled").click(); + // TestHelper.waitXhr("*/preingest/deposits", () => , { + // method: HttpVerbEnum.POST, + // expectedHttpCode: HttpStatusCode.Created, + // }); + + //click submit button to save + cy.intercept("GET", "*/preingest/deposits/*/data?*").as("depositData"); + cy.intercept("GET", "*/preingest/deposits/*/aip?*").as("depositAip"); + + cy.wait("@depositData").then((xhr) => { + expect(xhr.response.statusCode).to.eq(HttpStatusCode.Ok); + }); + cy.wait("@depositAip").then((xhr) => { + expect(xhr.response.statusCode).to.eq(HttpStatusCode.Ok); + }); + + //open upload file dialog + cy.get("#deposit-upload-primary-data").click(); + + // fill form + // TestHelper.getTestData(DataTestEnum.depositDataCategory).first().click().get("mat-option").contains("Primary").click(); + TestHelper.getTestData(DataTestEnum.depositDataType).first().click().get("mat-option").contains("Reference").click(); + + // load mock data from a fixture or construct here + const fileName = "example.json"; + cy.fixture(fileName).then(fileContent => { + // TODO FIX + // cy.get("#file-upload").upload({fileContent, fileName, mimeType: "application/json"}); + }); + + cy.get("#deposit-upload-confirm").click(); + + // navigate to upload file tab + cy.get("#tab-files").click(); + + cy.intercept({ + url: "*/data?size=10&page=0&relativeLocation=/", + method: "GET", + }).as("listFiles"); + + cy.wait("@listFiles").then((xhr) => { + expect(xhr.response.statusCode).to.eq(HttpStatusCode.Ok); + }); + + TestHelper.getTestData(DataTestEnum.depositFileDataTable).then($table => { + const rowsCount = $table.find("tbody").find("tr").length; + //expect to have at least one row with data + expect(rowsCount).to.be.greaterThan(1); + }); + + }); + +}); diff --git a/cypress/e2e/home/home-unlogged.cy.ts b/cypress/e2e/home/home-unlogged.cy.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0c6a131d802f9726776aabf6210fac96bdc9353 --- /dev/null +++ b/cypress/e2e/home/home-unlogged.cy.ts @@ -0,0 +1,122 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - home-unlogged.cy.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + +import {Enums} from "@enums"; +import {DataTestEnum} from "@shared/enums/data-test.enum"; +import {HttpVerbEnum} from "@shared/enums/http-verb.enum"; +import {HttpStatusCode} from "../../enums/http-status-code.enum"; +import {TestHelper} from "../../support/test-helper"; + +describe("Home Page", () => { + beforeEach(() => { + TestHelper.login(Enums.UserApplicationRole.UserApplicationRoleEnum.guest); + cy.visit("/"); + }); + + it("check the title", () => { + cy.title().should("eq", "DLCM"); + }); + + it("check that login is visible", () => { + TestHelper.getTestData(DataTestEnum.loginHorizontalInput).should("be.visible"); + }); + + it("check that search of public archive is working", () => { + // cy.wait(100); + // cy.server(); + cy.intercept({method: "POST", url: "*/access/metadata/search?size=10&page=0"}).as("search"); + + TestHelper.getTestData(DataTestEnum.homeSearchInput).type("dlcm"); + + cy.wait("@search").its("response.statusCode").should("eq", 200); + + // TestHelper.getTestData(DataTestEnum.homeButtonViewList).click(); + + TestHelper.waitXhr("*/access/metadata/search?size=*&page=0", () => TestHelper.getTestData(DataTestEnum.homeButtonViewList).click(), { + method: HttpVerbEnum.POST, + expectedHttpCode: HttpStatusCode.Ok, + }); + + TestHelper.getTestData(DataTestEnum.homeDataTableSearch).should("exist"); + + // cy.get(TestHelper.testData(DataTestEnum.homeFacet + "-access-levels-PUBLIC") + " [type=\"checkbox\"]").not("[disabled]") + // .click({force: true}).should("be.checked"); + + TestHelper.getTestData(DataTestEnum.homeDataTableSearch).find("tbody").find("tr").as("list"); + cy.get("@list").first().click(); + // TestHelper.getTestData(DataTestEnum.homeDataTableSearch).then($table => { + // const list = $table.find("tbody").find("tr"); + // + // list.first().click(); + + // TestHelper.waitXhr("access/metadata/*", () => list[0].click(), { + // method: HttpVerbEnum.GET, + // expectedHttpCode: HttpStatusCode.Ok, + // }); + // }); + + TestHelper.getTestData(DataTestEnum.homeArchiveDetailDownloadButton).should("exist"); + + TestHelper.getTestData(DataTestEnum.homeArchiveDetailLinkFilesOrCollections).should("exist"); + // .click({force: true}).should("be.checked"); + // cy.request("POST", TestHelper.xhrBaseUrl + "access/metadata/search?size=*&page=0&query=dlcm").should((response) => { + // TestHelper.getTestData(DataTestEnum.homeSearchInput).type("dlcm"); + // }); + + // TestHelper.waitXhr("access/metadata/search?size=*&page=0&query=dlcm", () => TestHelper.getTestData(DataTestEnum.homeSearchInput) + // .type("dlcm"), { + // method: HttpVerbEnum.POST, + // expectedHttpCode: HttpStatusCode.Ok, + // }); + + // TestHelper.waitXhr("access/metadata/search?size=*&page=0&query=dlcm", () => TestHelper.getTestData(DataTestEnum.homeButtonViewList).click(), { + // method: HttpVerbEnum.POST, + // expectedHttpCode: HttpStatusCode.Ok, + // }); + // + // TestHelper.getTestData(DataTestEnum.homeDataTableSearch).should("exist"); + // + // TestHelper.waitXhr("access/metadata/search?size=*&page=0*", () => { + // cy.get(TestHelper.testData(DataTestEnum.homeFacet + "-access-levels-PUBLIC") + " [type=\"checkbox\"]").not("[disabled]") + // .click({force: true}).should("be.checked"); + // }, { + // method: HttpVerbEnum.POST, + // expectedHttpCode: HttpStatusCode.Ok, + // }); + // + // TestHelper.getTestData(DataTestEnum.homeDataTableSearch).then($table => { + // const list = $table.find("tbody").find("tr"); + // const rowsCount = list.length; + // //expect to have at least one row with data + // expect(rowsCount).to.be.greaterThan(1); + // + // TestHelper.waitXhr("access/metadata/*", () => list[0].click(), { + // method: HttpVerbEnum.GET, + // expectedHttpCode: HttpStatusCode.Ok, + // }); + // }); + // + // TestHelper.getTestData(DataTestEnum.homeArchiveDetailDownloadButton).should("exist"); + // TestHelper.getTestData(DataTestEnum.homeArchiveDetailLinkFilesOrCollections).should("exist"); + }); +}); diff --git a/cypress/enums/http-status-code.enum.ts b/cypress/enums/http-status-code.enum.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ea0aa41fcee1c24b0714a549f94f2e399f0c2c1 --- /dev/null +++ b/cypress/enums/http-status-code.enum.ts @@ -0,0 +1,88 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - http-status-code.enum.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + +export enum HttpStatusCode { + Continue = 100, + SwitchingProtocols = 101, + Processing = 102, + EarlyHints = 103, + Ok = 200, + Created = 201, + Accepted = 202, + NonAuthoritativeInformation = 203, + NoContent = 204, + ResetContent = 205, + PartialContent = 206, + MultiStatus = 207, + AlreadyReported = 208, + ImUsed = 226, + MultipleChoices = 300, + MovedPermanently = 301, + Found = 302, + SeeOther = 303, + NotModified = 304, + UseProxy = 305, + Unused = 306, + TemporaryRedirect = 307, + PermanentRedirect = 308, + BadRequest = 400, + Unauthorized = 401, + PaymentRequired = 402, + Forbidden = 403, + NotFound = 404, + MethodNotAllowed = 405, + NotAcceptable = 406, + ProxyAuthenticationRequired = 407, + RequestTimeout = 408, + Conflict = 409, + Gone = 410, + LengthRequired = 411, + PreconditionFailed = 412, + PayloadTooLarge = 413, + UriTooLong = 414, + UnsupportedMediaType = 415, + RangeNotSatisfiable = 416, + ExpectationFailed = 417, + ImATeapot = 418, + MisdirectedRequest = 421, + UnprocessableEntity = 422, + Locked = 423, + FailedDependency = 424, + TooEarly = 425, + UpgradeRequired = 426, + PreconditionRequired = 428, + TooManyRequests = 429, + RequestHeaderFieldsTooLarge = 431, + UnavailableForLegalReasons = 451, + InternalServerError = 500, + NotImplemented = 501, + BadGateway = 502, + ServiceUnavailable = 503, + GatewayTimeout = 504, + HttpVersionNotSupported = 505, + VariantAlsoNegotiates = 506, + InsufficientStorage = 507, + LoopDetected = 508, + NotExtended = 510, + NetworkAuthenticationRequired = 511 +} \ No newline at end of file diff --git a/cypress/enums/role.enum.ts b/cypress/enums/role.enum.ts new file mode 100644 index 0000000000000000000000000000000000000000..42ce2282f301d9fa44aa33bb27a2b57aa716a4d7 --- /dev/null +++ b/cypress/enums/role.enum.ts @@ -0,0 +1,36 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - role.enum.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + +export type RoleEnum = + "APPROVER" + | "CREATOR" + | "MANAGER" + | "STEWARD" + | "VISITOR"; +export const RoleEnum = { + APPROVER: "APPROVER" as RoleEnum, + CREATOR: "CREATOR" as RoleEnum, + MANAGER: "MANAGER" as RoleEnum, + STEWARD: "STEWARD" as RoleEnum, + VISITOR: "VISITOR" as RoleEnum, +}; \ No newline at end of file diff --git a/cypress/enums/user-application-role.enum.ts b/cypress/enums/user-application-role.enum.ts new file mode 100644 index 0000000000000000000000000000000000000000..97183bcf00ac283e8815eb17bd2f843be3e1a195 --- /dev/null +++ b/cypress/enums/user-application-role.enum.ts @@ -0,0 +1,37 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - user-application-role.enum.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + + +export type UserApplicationRoleEnum = + "ROOT" + | "ADMIN" + | "USER" + | "TRUSTED_CLIENT" + | "GUEST"; +export const UserApplicationRoleEnum = { + root: "ROOT" as UserApplicationRoleEnum, + admin: "ADMIN" as UserApplicationRoleEnum, + user: "USER" as UserApplicationRoleEnum, + trusted_client: "TRUSTED_CLIENT" as UserApplicationRoleEnum, + guest: "GUEST" as UserApplicationRoleEnum, +}; diff --git a/cypress/environments/cypress-environment.model.ts b/cypress/environments/cypress-environment.model.ts new file mode 100644 index 0000000000000000000000000000000000000000..95bd0befa59ca6322081a3a70655ba7ea94f4711 --- /dev/null +++ b/cypress/environments/cypress-environment.model.ts @@ -0,0 +1,30 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - cypress-environment.model.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + +export interface CypressEnvironmentModel { + rootUrl: string; + localAuth: boolean; + tokenRoot: string | undefined; + tokenAdmin: string | undefined; + tokenUser: string | undefined; +} diff --git a/cypress/environments/cypress-environment.ts b/cypress/environments/cypress-environment.ts new file mode 100644 index 0000000000000000000000000000000000000000..de9e2fd7a0e9762485a9a87f1c7baa2f209b49c6 --- /dev/null +++ b/cypress/environments/cypress-environment.ts @@ -0,0 +1,31 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - cypress-environment.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + +import {cypressEnvironmentLocal} from "./cypress-environment.local"; +import {CypressEnvironmentModel} from "./cypress-environment.model"; + +export const cypressEnvironment: CypressEnvironmentModel = { + rootUrl: "http://localhost:4200", + localAuth: false, + ...cypressEnvironmentLocal, +}; diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json index da18d9352a17d427321962199a1fa43b8ab5cfe4..a4c63230ecdd4171fd1125ce5800b9e068abe873 100644 --- a/cypress/fixtures/example.json +++ b/cypress/fixtures/example.json @@ -1,5 +1,5 @@ { "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} \ No newline at end of file + "email": "hello@cypress.io" +} + \ No newline at end of file diff --git a/cypress/integration/deposit.spec.ts b/cypress/integration/deposit.spec.ts index c66f0a52f80913022938558214a7b88fda74a7cf..cdb921caa6b70bd5253305c59c573b58c5d16752 100644 --- a/cypress/integration/deposit.spec.ts +++ b/cypress/integration/deposit.spec.ts @@ -29,7 +29,7 @@ describe("Deposit Page", () => { TestHelper.getTestData(DataTestEnum.depositPublicationDate).invoke("val").should("not.be.empty"); // simulate click event on the drop down TestHelper.getTestData(DataTestEnum.depositAccessLevel).first().click().get("mat-option").contains("Public").click(); - TestHelper.getTestData(DataTestEnum.depositAddMeAuthor).click(); + TestHelper.getTestData(DataTestEnum.depositAddMeAsAuthor).click(); /* TestHelper.getTestData(DataTestEnum.depositLicenseId) .click() diff --git a/cypress/integration/environments/cypress-environment.local.ts b/cypress/integration/environments/cypress-environment.local.ts deleted file mode 100644 index 491dd43d87cb74b0fe1b130354ffb06eac68d976..0000000000000000000000000000000000000000 --- a/cypress/integration/environments/cypress-environment.local.ts +++ /dev/null @@ -1,8 +0,0 @@ -import {CypressEnvironmentModel} from "./cypress-environment.model"; - -export const cypressEnvironmentLocal: CypressEnvironmentModel | any = { - tokenAdmin: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjM3Mjg0Nzg5MTYsInVzZXJfbmFtZSI6ImFkbWluX2V4dGVybmFsVWlkIiwiYXV0aG9yaXRpZXMiOlsiQURNSU4iXSwianRpIjoiMGE0ZjI2ZTQtOTdkNS00Zjc1LWFiNmMtNzhhNDdhZjI2MGM2IiwiY2xpZW50X2lkIjoiZGxjbXRlc3QtNjh5ZWFycyIsInNjb3BlIjpbIlJFQUQiXX0.jecH-ePhwVLILQTA2v4n9bTisfqtYI9JGDoskbDUxtrEpGGEum945fBZM_AxnniZZByQd_eZJo5izDxsJEh_LXcrMpYjCp17dbt35yslV1q0OLyOkXfrZSy3EIRFhEDcFT12hdu8hI3im62Do3IwB4l_erl6Ih6WhYpAaOsjnHmr3I0CTODlGrGo7wUowYRUq8t-0MNhVpEUxqIxW28MBC1nQtG84uDEInznVAxBVRa5m_InqLRSKytzFIk151vywRflRX83_LGFBs8bVq6FQViUr3ajrt_LSwPzx846APPOtVvyabWI36r9PIUofhB82URi3YNfNtwbPDNEsy8QMw", - tokenRoot: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjM3Mjg0Nzg5NzcsInVzZXJfbmFtZSI6InJvb3RfZXh0ZXJuYWxVaWQiLCJhdXRob3JpdGllcyI6WyJST09UIl0sImp0aSI6IjllMDhmY2FjLTE5ZjUtNDc0ZC1iNGViLWRlZDcxZTY1OGZlYiIsImNsaWVudF9pZCI6ImRsY210ZXN0LTY4eWVhcnMiLCJzY29wZSI6WyJSRUFEIl19.WgnvIvKkaHTL2LwnoejgVMBMKSvmXpPe7q4mRaHsnsO0z-XTv915FKGavD86ze0EY1MsQ6ZgZe4pg6BtcDGWrdLIeZFBdCiqXPz9KCHIbtxxI6LOdxTANlI3fbgXbbUqJ6HKNxE1pKpCUgOpnRJyjiyzoHpo1Eyjt-nDlWDnv3zA7vC7TVdKJGljH1wqm_22fuN7j0_CYuxZjC51JSnGVGF9Jc-BYVfRAvMdwroCvUW94CdC-uxOfRPrlxzmviIdyvD76nme3OxtzNg-DreuPreuR8VLtMx8aP1yMQFk9VcJL03dcdsphLMCQP8XGQdmPj9C5BGhdH8J6hNe5LxEgQ", - tokenUser: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjM3Mjg0Nzg1ODksInVzZXJfbmFtZSI6InVzZXJfZXh0ZXJuYWxVaWQiLCJhdXRob3JpdGllcyI6WyJVU0VSIl0sImp0aSI6IjMwNTc1Zjc0LTc0MTktNDZkYi1hMjIxLTE3NzNiYzU4ZDI1MCIsImNsaWVudF9pZCI6ImRsY210ZXN0LTY4eWVhcnMiLCJzY29wZSI6WyJSRUFEIl19.iFHoI_B3Cqny8jpAGBxGXXnXXp-uc15UdxNVRrqEtjQJa0F6UZLkdDdskoBp5rvu0tFUwQ33THS56l8iL3EyFS3k_3-dMpM8ZNi-mFWJaWqF3iy3x1Poet5lNUZuNSyBKYeLo4DlW38kUisc42HFbbj-97U2Gx0rGCfaAvqrqbWFPZG4KjIvsbj6AzWLJ94gFCNajBf8a-npa4-UQALW0oTbGGyCaft1vHRtYyx_y2hArQzuAzl9-S5JuhzjFTZz4XWPuIugNwUAoaXwzSI3XQklno1uH6EJoH0itw23VtMTToT3zosOoS-nwlsXy9dAUkn2-argunqdBqzRtqFNTQ", - // localAuth: true, -}; diff --git a/cypress/integration/environments/cypress-environment.model.ts b/cypress/integration/environments/cypress-environment.model.ts deleted file mode 100644 index 25370434e886ebbeae72f7c644790248f96db108..0000000000000000000000000000000000000000 --- a/cypress/integration/environments/cypress-environment.model.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface CypressEnvironmentModel { - rootUrl: string; - localAuth: boolean; - tokenRoot: string | undefined; - tokenAdmin: string | undefined; - tokenUser: string | undefined; -} diff --git a/cypress/integration/environments/cypress-environment.ts b/cypress/integration/environments/cypress-environment.ts deleted file mode 100644 index b910cd815a48969c3b7f1d61335f9a56358854a2..0000000000000000000000000000000000000000 --- a/cypress/integration/environments/cypress-environment.ts +++ /dev/null @@ -1,8 +0,0 @@ -import {cypressEnvironmentLocal} from "./cypress-environment.local"; -import {CypressEnvironmentModel} from "./cypress-environment.model"; - -export const cypressEnvironment: CypressEnvironmentModel = { - rootUrl: "http://localhost:4200", - localAuth: false, - ...cypressEnvironmentLocal, -}; diff --git a/cypress/integration/examples/actions.spec.js b/cypress/integration/examples/actions.spec.js deleted file mode 100644 index 21952432000ce2c9e82492eb84861e8a9e579c85..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/actions.spec.js +++ /dev/null @@ -1,298 +0,0 @@ -/// <reference types="cypress" /> - -context('Actions', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/actions') - }) - - // https://on.cypress.io/interacting-with-elements - - it('.type() - type into a DOM element', () => { - // https://on.cypress.io/type - cy.get('.action-email') - .type('fake@email.com').should('have.value', 'fake@email.com') - - // .type() with special character sequences - .type('{leftarrow}{rightarrow}{uparrow}{downarrow}') - .type('{del}{selectall}{backspace}') - - // .type() with key modifiers - .type('{alt}{option}') //these are equivalent - .type('{ctrl}{control}') //these are equivalent - .type('{meta}{command}{cmd}') //these are equivalent - .type('{shift}') - - // Delay each keypress by 0.1 sec - .type('slow.typing@email.com', {delay: 100}) - .should('have.value', 'slow.typing@email.com') - - cy.get('.action-disabled') - // Ignore error checking prior to type - // like whether the input is visible or disabled - .type('disabled error checking', {force: true}) - .should('have.value', 'disabled error checking') - }) - - it('.focus() - focus on a DOM element', () => { - // https://on.cypress.io/focus - cy.get('.action-focus').focus() - .should('have.class', 'focus') - .prev().should('have.attr', 'style', 'color: orange;') - }) - - it('.blur() - blur off a DOM element', () => { - // https://on.cypress.io/blur - cy.get('.action-blur').type('About to blur').blur() - .should('have.class', 'error') - .prev().should('have.attr', 'style', 'color: red;') - }) - - it('.clear() - clears an input or textarea element', () => { - // https://on.cypress.io/clear - cy.get('.action-clear').type('Clear this text') - .should('have.value', 'Clear this text') - .clear() - .should('have.value', '') - }) - - it('.submit() - submit a form', () => { - // https://on.cypress.io/submit - cy.get('.action-form') - .find('[type="text"]').type('HALFOFF') - cy.get('.action-form').submit() - .next().should('contain', 'Your form has been submitted!') - }) - - it('.click() - click on a DOM element', () => { - // https://on.cypress.io/click - cy.get('.action-btn').click() - - // You can click on 9 specific positions of an element: - // ----------------------------------- - // | topLeft top topRight | - // | | - // | | - // | | - // | left center right | - // | | - // | | - // | | - // | bottomLeft bottom bottomRight | - // ----------------------------------- - - // clicking in the center of the element is the default - cy.get('#action-canvas').click() - - cy.get('#action-canvas').click('topLeft') - cy.get('#action-canvas').click('top') - cy.get('#action-canvas').click('topRight') - cy.get('#action-canvas').click('left') - cy.get('#action-canvas').click('right') - cy.get('#action-canvas').click('bottomLeft') - cy.get('#action-canvas').click('bottom') - cy.get('#action-canvas').click('bottomRight') - - // .click() accepts an x and y coordinate - // that controls where the click occurs :) - - cy.get('#action-canvas') - .click(80, 75) // click 80px on x coord and 75px on y coord - .click(170, 75) - .click(80, 165) - .click(100, 185) - .click(125, 190) - .click(150, 185) - .click(170, 165) - - // click multiple elements by passing multiple: true - cy.get('.action-labels>.label').click({multiple: true}) - - // Ignore error checking prior to clicking - cy.get('.action-opacity>.btn').click({force: true}) - }) - - it('.dblclick() - double click on a DOM element', () => { - // https://on.cypress.io/dblclick - - // Our app has a listener on 'dblclick' event in our 'scripts.js' - // that hides the div and shows an input on double click - cy.get('.action-div').dblclick().should('not.be.visible') - cy.get('.action-input-hidden').should('be.visible') - }) - - it('.rightclick() - right click on a DOM element', () => { - // https://on.cypress.io/rightclick - - // Our app has a listener on 'contextmenu' event in our 'scripts.js' - // that hides the div and shows an input on right click - cy.get('.rightclick-action-div').rightclick().should('not.be.visible') - cy.get('.rightclick-action-input-hidden').should('be.visible') - }) - - it('.check() - check a checkbox or radio element', () => { - // https://on.cypress.io/check - - // By default, .check() will check all - // matching checkbox or radio elements in succession, one after another - cy.get('.action-checkboxes [type="checkbox"]').not('[disabled]') - .check().should('be.checked') - - cy.get('.action-radios [type="radio"]').not('[disabled]') - .check().should('be.checked') - - // .check() accepts a value argument - cy.get('.action-radios [type="radio"]') - .check('radio1').should('be.checked') - - // .check() accepts an array of values - cy.get('.action-multiple-checkboxes [type="checkbox"]') - .check(['checkbox1', 'checkbox2']).should('be.checked') - - // Ignore error checking prior to checking - cy.get('.action-checkboxes [disabled]') - .check({force: true}).should('be.checked') - - cy.get('.action-radios [type="radio"]') - .check('radio3', {force: true}).should('be.checked') - }) - - it('.uncheck() - uncheck a checkbox element', () => { - // https://on.cypress.io/uncheck - - // By default, .uncheck() will uncheck all matching - // checkbox elements in succession, one after another - cy.get('.action-check [type="checkbox"]') - .not('[disabled]') - .uncheck().should('not.be.checked') - - // .uncheck() accepts a value argument - cy.get('.action-check [type="checkbox"]') - .check('checkbox1') - .uncheck('checkbox1').should('not.be.checked') - - // .uncheck() accepts an array of values - cy.get('.action-check [type="checkbox"]') - .check(['checkbox1', 'checkbox3']) - .uncheck(['checkbox1', 'checkbox3']).should('not.be.checked') - - // Ignore error checking prior to unchecking - cy.get('.action-check [disabled]') - .uncheck({force: true}).should('not.be.checked') - }) - - it('.select() - select an option in a <select> element', () => { - // https://on.cypress.io/select - - // at first, no option should be selected - cy.get('.action-select') - .should('have.value', '--Select a fruit--') - - // Select option(s) with matching text content - cy.get('.action-select').select('apples') - // confirm the apples were selected - // note that each value starts with "fr-" in our HTML - cy.get('.action-select').should('have.value', 'fr-apples') - - cy.get('.action-select-multiple') - .select(['apples', 'oranges', 'bananas']) - // when getting multiple values, invoke "val" method first - .invoke('val') - .should('deep.equal', ['fr-apples', 'fr-oranges', 'fr-bananas']) - - // Select option(s) with matching value - cy.get('.action-select').select('fr-bananas') - // can attach an assertion right away to the element - .should('have.value', 'fr-bananas') - - cy.get('.action-select-multiple') - .select(['fr-apples', 'fr-oranges', 'fr-bananas']) - .invoke('val') - .should('deep.equal', ['fr-apples', 'fr-oranges', 'fr-bananas']) - // assert the selected values include oranges - cy.get('.action-select-multiple') - .invoke('val').should('include', 'fr-oranges') - }) - - it('.scrollIntoView() - scroll an element into view', () => { - // https://on.cypress.io/scrollintoview - - // normally all of these buttons are hidden, - // because they're not within - // the viewable area of their parent - // (we need to scroll to see them) - cy.get('#scroll-horizontal button') - .should('not.be.visible') - - // scroll the button into view, as if the user had scrolled - cy.get('#scroll-horizontal button').scrollIntoView() - .should('be.visible') - - cy.get('#scroll-vertical button') - .should('not.be.visible') - - // Cypress handles the scroll direction needed - cy.get('#scroll-vertical button').scrollIntoView() - .should('be.visible') - - cy.get('#scroll-both button') - .should('not.be.visible') - - // Cypress knows to scroll to the right and down - cy.get('#scroll-both button').scrollIntoView() - .should('be.visible') - }) - - it('.trigger() - trigger an event on a DOM element', () => { - // https://on.cypress.io/trigger - - // To interact with a range input (slider) - // we need to set its value & trigger the - // event to signal it changed - - // Here, we invoke jQuery's val() method to set - // the value and trigger the 'change' event - cy.get('.trigger-input-range') - .invoke('val', 25) - .trigger('change') - .get('input[type=range]').siblings('p') - .should('have.text', '25') - }) - - it('cy.scrollTo() - scroll the window or element to a position', () => { - - // https://on.cypress.io/scrollTo - - // You can scroll to 9 specific positions of an element: - // ----------------------------------- - // | topLeft top topRight | - // | | - // | | - // | | - // | left center right | - // | | - // | | - // | | - // | bottomLeft bottom bottomRight | - // ----------------------------------- - - // if you chain .scrollTo() off of cy, we will - // scroll the entire window - cy.scrollTo('bottom') - - cy.get('#scrollable-horizontal').scrollTo('right') - - // or you can scroll to a specific coordinate: - // (x axis, y axis) in pixels - cy.get('#scrollable-vertical').scrollTo(250, 250) - - // or you can scroll to a specific percentage - // of the (width, height) of the element - cy.get('#scrollable-both').scrollTo('75%', '25%') - - // control the easing of the scroll (default is 'swing') - cy.get('#scrollable-vertical').scrollTo('center', {easing: 'linear'}) - - // control the duration of the scroll (in ms) - cy.get('#scrollable-both').scrollTo('center', {duration: 2000}) - }) -}) diff --git a/cypress/integration/examples/aliasing.spec.js b/cypress/integration/examples/aliasing.spec.js deleted file mode 100644 index c3095745a2aaaa5bacf2ad23cb46357e598c13d6..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/aliasing.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -/// <reference types="cypress" /> - -context('Aliasing', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/aliasing') - }) - - it('.as() - alias a DOM element for later use', () => { - // https://on.cypress.io/as - - // Alias a DOM element for use later - // We don't have to traverse to the element - // later in our code, we reference it with @ - - cy.get('.as-table').find('tbody>tr') - .first().find('td').first() - .find('button').as('firstBtn') - - // when we reference the alias, we place an - // @ in front of its name - cy.get('@firstBtn').click() - - cy.get('@firstBtn') - .should('have.class', 'btn-success') - .and('contain', 'Changed') - }) - - it('.as() - alias a route for later use', () => { - - // Alias the route to wait for its response - cy.server() - cy.route('GET', 'comments/*').as('getComment') - - // we have code that gets a comment when - // the button is clicked in scripts.js - cy.get('.network-btn').click() - - // https://on.cypress.io/wait - cy.wait('@getComment').its('status').should('eq', 200) - - }) -}) diff --git a/cypress/integration/examples/assertions.spec.js b/cypress/integration/examples/assertions.spec.js deleted file mode 100644 index 81d80acf00718f8b252ad2a9a4b006eda9c74e35..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/assertions.spec.js +++ /dev/null @@ -1,168 +0,0 @@ -/// <reference types="cypress" /> - -context('Assertions', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/assertions') - }) - - describe('Implicit Assertions', () => { - it('.should() - make an assertion about the current subject', () => { - // https://on.cypress.io/should - cy.get('.assertion-table') - .find('tbody tr:last') - .should('have.class', 'success') - .find('td') - .first() - // checking the text of the <td> element in various ways - .should('have.text', 'Column content') - .should('contain', 'Column content') - .should('have.html', 'Column content') - // chai-jquery uses "is()" to check if element matches selector - .should('match', 'td') - // to match text content against a regular expression - // first need to invoke jQuery method text() - // and then match using regular expression - .invoke('text') - .should('match', /column content/i) - - // a better way to check element's text content against a regular expression - // is to use "cy.contains" - // https://on.cypress.io/contains - cy.get('.assertion-table') - .find('tbody tr:last') - // finds first <td> element with text content matching regular expression - .contains('td', /column content/i) - .should('be.visible') - - // for more information about asserting element's text - // see https://on.cypress.io/using-cypress-faq#How-do-I-get-an-element’s-text-contents - }) - - it('.and() - chain multiple assertions together', () => { - // https://on.cypress.io/and - cy.get('.assertions-link') - .should('have.class', 'active') - .and('have.attr', 'href') - .and('include', 'cypress.io') - }) - }) - - describe('Explicit Assertions', () => { - // https://on.cypress.io/assertions - it('expect - make an assertion about a specified subject', () => { - // We can use Chai's BDD style assertions - expect(true).to.be.true - const o = { foo: 'bar' } - - expect(o).to.equal(o) - expect(o).to.deep.equal({ foo: 'bar' }) - // matching text using regular expression - expect('FooBar').to.match(/bar$/i) - }) - - it('pass your own callback function to should()', () => { - // Pass a function to should that can have any number - // of explicit assertions within it. - // The ".should(cb)" function will be retried - // automatically until it passes all your explicit assertions or times out. - cy.get('.assertions-p') - .find('p') - .should(($p) => { - // https://on.cypress.io/$ - // return an array of texts from all of the p's - // @ts-ignore TS6133 unused variable - const texts = $p.map((i, el) => Cypress.$(el).text()) - - // jquery map returns jquery object - // and .get() convert this to simple array - const paragraphs = texts.get() - - // array should have length of 3 - expect(paragraphs, 'has 3 paragraphs').to.have.length(3) - - // use second argument to expect(...) to provide clear - // message with each assertion - expect(paragraphs, 'has expected text in each paragraph').to.deep.eq([ - 'Some text from first p', - 'More text from second p', - 'And even more text from third p', - ]) - }) - }) - - it('finds element by class name regex', () => { - cy.get('.docs-header') - .find('div') - // .should(cb) callback function will be retried - .should(($div) => { - expect($div).to.have.length(1) - - const className = $div[0].className - - expect(className).to.match(/heading-/) - }) - // .then(cb) callback is not retried, - // it either passes or fails - .then(($div) => { - expect($div, 'text content').to.have.text('Introduction') - }) - }) - - it('can throw any error', () => { - cy.get('.docs-header') - .find('div') - .should(($div) => { - if ($div.length !== 1) { - // you can throw your own errors - throw new Error('Did not find 1 element') - } - - const className = $div[0].className - - if (!className.match(/heading-/)) { - throw new Error(`Could not find class "heading-" in ${className}`) - } - }) - }) - - it('matches unknown text between two elements', () => { - /** - * Text from the first element. - * @type {string} - */ - let text - - /** - * Normalizes passed text, - * useful before comparing text with spaces and different capitalization. - * @param {string} s Text to normalize - */ - const normalizeText = (s) => s.replace(/\s/g, '').toLowerCase() - - cy.get('.two-elements') - .find('.first') - .then(($first) => { - // save text from the first element - text = normalizeText($first.text()) - }) - - cy.get('.two-elements') - .find('.second') - .should(($div) => { - // we can massage text before comparing - const secondText = normalizeText($div.text()) - - expect(secondText, 'second text').to.equal(text) - }) - }) - - it('assert - assert shape of an object', () => { - const person = { - name: 'Joe', - age: 20, - } - - assert.isObject(person, 'value is object') - }) - }) -}) diff --git a/cypress/integration/examples/connectors.spec.js b/cypress/integration/examples/connectors.spec.js deleted file mode 100644 index ae8799181d1531938ae92a3d90515ea624dd4383..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/connectors.spec.js +++ /dev/null @@ -1,97 +0,0 @@ -/// <reference types="cypress" /> - -context('Connectors', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/connectors') - }) - - it('.each() - iterate over an array of elements', () => { - // https://on.cypress.io/each - cy.get('.connectors-each-ul>li') - .each(($el, index, $list) => { - console.log($el, index, $list) - }) - }) - - it('.its() - get properties on the current subject', () => { - // https://on.cypress.io/its - cy.get('.connectors-its-ul>li') - // calls the 'length' property yielding that value - .its('length') - .should('be.gt', 2) - }) - - it('.invoke() - invoke a function on the current subject', () => { - // our div is hidden in our script.js - // $('.connectors-div').hide() - - // https://on.cypress.io/invoke - cy.get('.connectors-div').should('be.hidden') - // call the jquery method 'show' on the 'div.container' - .invoke('show') - .should('be.visible') - }) - - it('.spread() - spread an array as individual args to callback function', () => { - // https://on.cypress.io/spread - const arr = ['foo', 'bar', 'baz'] - - cy.wrap(arr).spread((foo, bar, baz) => { - expect(foo).to.eq('foo') - expect(bar).to.eq('bar') - expect(baz).to.eq('baz') - }) - }) - - describe('.then()', () => { - it('invokes a callback function with the current subject', () => { - // https://on.cypress.io/then - cy.get('.connectors-list > li') - .then(($lis) => { - expect($lis, '3 items').to.have.length(3) - expect($lis.eq(0), 'first item').to.contain('Walk the dog') - expect($lis.eq(1), 'second item').to.contain('Feed the cat') - expect($lis.eq(2), 'third item').to.contain('Write JavaScript') - }) - }) - - it('yields the returned value to the next command', () => { - cy.wrap(1) - .then((num) => { - expect(num).to.equal(1) - - return 2 - }) - .then((num) => { - expect(num).to.equal(2) - }) - }) - - it('yields the original subject without return', () => { - cy.wrap(1) - .then((num) => { - expect(num).to.equal(1) - // note that nothing is returned from this callback - }) - .then((num) => { - // this callback receives the original unchanged value 1 - expect(num).to.equal(1) - }) - }) - - it('yields the value yielded by the last Cypress command inside', () => { - cy.wrap(1) - .then((num) => { - expect(num).to.equal(1) - // note how we run a Cypress command - // the result yielded by this Cypress command - // will be passed to the second ".then" - cy.wrap(2) - }) - .then((num) => { - // this callback receives the value yielded by "cy.wrap(2)" - expect(num).to.equal(2) - }) - }) - }) -}) diff --git a/cypress/integration/examples/cookies.spec.js b/cypress/integration/examples/cookies.spec.js deleted file mode 100644 index aaf6b5de1e43d52e0c0ec39c9ce1b2346482d599..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/cookies.spec.js +++ /dev/null @@ -1,78 +0,0 @@ -/// <reference types="cypress" /> - -context('Cookies', () => { - beforeEach(() => { - Cypress.Cookies.debug(true) - - cy.visit('https://example.cypress.io/commands/cookies') - - // clear cookies again after visiting to remove - // any 3rd party cookies picked up such as cloudflare - cy.clearCookies() - }) - - it('cy.getCookie() - get a browser cookie', () => { - // https://on.cypress.io/getcookie - cy.get('#getCookie .set-a-cookie').click() - - // cy.getCookie() yields a cookie object - cy.getCookie('token').should('have.property', 'value', '123ABC') - }) - - it('cy.getCookies() - get browser cookies', () => { - // https://on.cypress.io/getcookies - cy.getCookies().should('be.empty') - - cy.get('#getCookies .set-a-cookie').click() - - // cy.getCookies() yields an array of cookies - cy.getCookies().should('have.length', 1).should((cookies) => { - - // each cookie has these properties - expect(cookies[0]).to.have.property('name', 'token') - expect(cookies[0]).to.have.property('value', '123ABC') - expect(cookies[0]).to.have.property('httpOnly', false) - expect(cookies[0]).to.have.property('secure', false) - expect(cookies[0]).to.have.property('domain') - expect(cookies[0]).to.have.property('path') - }) - }) - - it('cy.setCookie() - set a browser cookie', () => { - // https://on.cypress.io/setcookie - cy.getCookies().should('be.empty') - - cy.setCookie('foo', 'bar') - - // cy.getCookie() yields a cookie object - cy.getCookie('foo').should('have.property', 'value', 'bar') - }) - - it('cy.clearCookie() - clear a browser cookie', () => { - // https://on.cypress.io/clearcookie - cy.getCookie('token').should('be.null') - - cy.get('#clearCookie .set-a-cookie').click() - - cy.getCookie('token').should('have.property', 'value', '123ABC') - - // cy.clearCookies() yields null - cy.clearCookie('token').should('be.null') - - cy.getCookie('token').should('be.null') - }) - - it('cy.clearCookies() - clear browser cookies', () => { - // https://on.cypress.io/clearcookies - cy.getCookies().should('be.empty') - - cy.get('#clearCookies .set-a-cookie').click() - - cy.getCookies().should('have.length', 1) - - // cy.clearCookies() yields null - cy.clearCookies() - - cy.getCookies().should('be.empty') - }) -}) diff --git a/cypress/integration/examples/cypress_api.spec.js b/cypress/integration/examples/cypress_api.spec.js deleted file mode 100644 index 63997697b2d6a8a40995e7aa77bd7c56ed49dcbf..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/cypress_api.spec.js +++ /dev/null @@ -1,222 +0,0 @@ -/// <reference types="cypress" /> - -context('Cypress.Commands', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - // https://on.cypress.io/custom-commands - - it('.add() - create a custom command', () => { - Cypress.Commands.add('console', { - prevSubject: true, - }, (subject, method) => { - // the previous subject is automatically received - // and the commands arguments are shifted - - // allow us to change the console method used - method = method || 'log' - - // log the subject to the console - // @ts-ignore TS7017 - console[method]('The subject is', subject) - - // whatever we return becomes the new subject - // we don't want to change the subject so - // we return whatever was passed in - return subject - }) - - // @ts-ignore TS2339 - cy.get('button').console('info').then(($button) => { - // subject is still $button - }) - }) -}) - - -context('Cypress.Cookies', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - // https://on.cypress.io/cookies - it('.debug() - enable or disable debugging', () => { - Cypress.Cookies.debug(true) - - // Cypress will now log in the console when - // cookies are set or cleared - cy.setCookie('fakeCookie', '123ABC') - cy.clearCookie('fakeCookie') - cy.setCookie('fakeCookie', '123ABC') - cy.clearCookie('fakeCookie') - cy.setCookie('fakeCookie', '123ABC') - }) - - it('.preserveOnce() - preserve cookies by key', () => { - // normally cookies are reset after each test - cy.getCookie('fakeCookie').should('not.be.ok') - - // preserving a cookie will not clear it when - // the next test starts - cy.setCookie('lastCookie', '789XYZ') - Cypress.Cookies.preserveOnce('lastCookie') - }) - - it('.defaults() - set defaults for all cookies', () => { - // now any cookie with the name 'session_id' will - // not be cleared before each new test runs - Cypress.Cookies.defaults({ - whitelist: 'session_id', - }) - }) -}) - - -context('Cypress.Server', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - // Permanently override server options for - // all instances of cy.server() - - // https://on.cypress.io/cypress-server - it('.defaults() - change default config of server', () => { - Cypress.Server.defaults({ - delay: 0, - force404: false, - }) - }) -}) - -context('Cypress.arch', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - it('Get CPU architecture name of underlying OS', () => { - // https://on.cypress.io/arch - expect(Cypress.arch).to.exist - }) -}) - -context('Cypress.config()', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - it('Get and set configuration options', () => { - // https://on.cypress.io/config - let myConfig = Cypress.config() - - expect(myConfig).to.have.property('animationDistanceThreshold', 5) - expect(myConfig).to.have.property('baseUrl', null) - expect(myConfig).to.have.property('defaultCommandTimeout', 4000) - expect(myConfig).to.have.property('requestTimeout', 5000) - expect(myConfig).to.have.property('responseTimeout', 30000) - expect(myConfig).to.have.property('viewportHeight', 660) - expect(myConfig).to.have.property('viewportWidth', 1000) - expect(myConfig).to.have.property('pageLoadTimeout', 60000) - expect(myConfig).to.have.property('waitForAnimations', true) - - expect(Cypress.config('pageLoadTimeout')).to.eq(60000) - - // this will change the config for the rest of your tests! - Cypress.config('pageLoadTimeout', 20000) - - expect(Cypress.config('pageLoadTimeout')).to.eq(20000) - - Cypress.config('pageLoadTimeout', 60000) - }) -}) - -context('Cypress.dom', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - // https://on.cypress.io/dom - it('.isHidden() - determine if a DOM element is hidden', () => { - let hiddenP = Cypress.$('.dom-p p.hidden').get(0) - let visibleP = Cypress.$('.dom-p p.visible').get(0) - - // our first paragraph has css class 'hidden' - expect(Cypress.dom.isHidden(hiddenP)).to.be.true - expect(Cypress.dom.isHidden(visibleP)).to.be.false - }) -}) - -context('Cypress.env()', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - // We can set environment variables for highly dynamic values - - // https://on.cypress.io/environment-variables - it('Get environment variables', () => { - // https://on.cypress.io/env - // set multiple environment variables - Cypress.env({ - host: 'veronica.dev.local', - api_server: 'http://localhost:8888/v1/', - }) - - // get environment variable - expect(Cypress.env('host')).to.eq('veronica.dev.local') - - // set environment variable - Cypress.env('api_server', 'http://localhost:8888/v2/') - expect(Cypress.env('api_server')).to.eq('http://localhost:8888/v2/') - - // get all environment variable - expect(Cypress.env()).to.have.property('host', 'veronica.dev.local') - expect(Cypress.env()).to.have.property('api_server', 'http://localhost:8888/v2/') - }) -}) - -context('Cypress.log', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - it('Control what is printed to the Command Log', () => { - // https://on.cypress.io/cypress-log - }) -}) - - -context('Cypress.platform', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - it('Get underlying OS name', () => { - // https://on.cypress.io/platform - expect(Cypress.platform).to.be.exist - }) -}) - -context('Cypress.version', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - it('Get current version of Cypress being run', () => { - // https://on.cypress.io/version - expect(Cypress.version).to.be.exist - }) -}) - -context('Cypress.spec', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/cypress-api') - }) - - it('Get current spec information', () => { - // https://on.cypress.io/spec - // wrap the object so we can inspect it easily by clicking in the command log - cy.wrap(Cypress.spec).should('include.keys', ['name', 'relative', 'absolute']) - }) -}) diff --git a/cypress/integration/examples/files.spec.js b/cypress/integration/examples/files.spec.js deleted file mode 100644 index 83c651caba1b3f497ff2bc58f97e07d9c6d154f6..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/files.spec.js +++ /dev/null @@ -1,114 +0,0 @@ -/// <reference types="cypress" /> - -/// JSON fixture file can be loaded directly using -// the built-in JavaScript bundler -// @ts-ignore -const requiredExample = require('../../fixtures/example') - -context('Files', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/files') - }) - - beforeEach(() => { - // load example.json fixture file and store - // in the test context object - cy.fixture('example.json').as('example') - }) - - it('cy.fixture() - load a fixture', () => { - // https://on.cypress.io/fixture - - // Instead of writing a response inline you can - // use a fixture file's content. - - cy.server() - cy.fixture('example.json').as('comment') - // when application makes an Ajax request matching "GET comments/*" - // Cypress will intercept it and reply with object - // from the "comment" alias - cy.route('GET', 'comments/*', '@comment').as('getComment') - - // we have code that gets a comment when - // the button is clicked in scripts.js - cy.get('.fixture-btn').click() - - cy.wait('@getComment').its('responseBody') - .should('have.property', 'name') - .and('include', 'Using fixtures to represent data') - - // you can also just write the fixture in the route - cy.route('GET', 'comments/*', 'fixture:example.json').as('getComment') - - // we have code that gets a comment when - // the button is clicked in scripts.js - cy.get('.fixture-btn').click() - - cy.wait('@getComment').its('responseBody') - .should('have.property', 'name') - .and('include', 'Using fixtures to represent data') - - // or write fx to represent fixture - // by default it assumes it's .json - cy.route('GET', 'comments/*', 'fx:example').as('getComment') - - // we have code that gets a comment when - // the button is clicked in scripts.js - cy.get('.fixture-btn').click() - - cy.wait('@getComment').its('responseBody') - .should('have.property', 'name') - .and('include', 'Using fixtures to represent data') - }) - - it('cy.fixture() or require - load a fixture', function () { - // we are inside the "function () { ... }" - // callback and can use test context object "this" - // "this.example" was loaded in "beforeEach" function callback - expect(this.example, 'fixture in the test context') - .to.deep.equal(requiredExample) - - // or use "cy.wrap" and "should('deep.equal', ...)" assertion - // @ts-ignore - cy.wrap(this.example, 'fixture vs require') - .should('deep.equal', requiredExample) - }) - - it('cy.readFile() - read file contents', () => { - // https://on.cypress.io/readfile - - // You can read a file and yield its contents - // The filePath is relative to your project's root. - cy.readFile('cypress.json').then((json) => { - expect(json).to.be.an('object') - }) - }) - - it('cy.writeFile() - write to a file', () => { - // https://on.cypress.io/writefile - - // You can write to a file - - // Use a response from a request to automatically - // generate a fixture file for use later - cy.request('https://jsonplaceholder.cypress.io/users') - .then((response) => { - cy.writeFile('cypress/fixtures/users.json', response.body) - }) - cy.fixture('users').should((users) => { - expect(users[0].name).to.exist - }) - - // JavaScript arrays and objects are stringified - // and formatted into text. - cy.writeFile('cypress/fixtures/profile.json', { - id: 8739, - name: 'Jane', - email: 'jane@example.com', - }) - - cy.fixture('profile').should((profile) => { - expect(profile.name).to.eq('Jane') - }) - }) -}) diff --git a/cypress/integration/examples/local_storage.spec.js b/cypress/integration/examples/local_storage.spec.js deleted file mode 100644 index 4a03d47a04905b3d2c3b455638251f78a81c39cf..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/local_storage.spec.js +++ /dev/null @@ -1,54 +0,0 @@ -/// <reference types="cypress" /> - -import {LocalStorageHelper} from "solidify-frontend"; - -context('Local Storage', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/local-storage') - }) - // Although local storage is automatically cleared - // in between tests to maintain a clean state - // sometimes we need to clear the local storage manually - - it('cy.clearLocalStorage() - clear all data in local storage', () => { - // https://on.cypress.io/clearlocalstorage - cy.get('.ls-btn').click().should(() => { - expect(LocalStorageHelper.getItem('prop1')).to.eq('red') - expect(LocalStorageHelper.getItem('prop2')).to.eq('blue') - expect(LocalStorageHelper.getItem('prop3')).to.eq('magenta') - }) - - // clearLocalStorage() yields the localStorage object - cy.clearLocalStorage().should((ls) => { - expect(ls.getItem('prop1')).to.be.null - expect(ls.getItem('prop2')).to.be.null - expect(ls.getItem('prop3')).to.be.null - }) - - // Clear key matching string in Local Storage - cy.get('.ls-btn').click().should(() => { - expect(LocalStorageHelper.getItem('prop1')).to.eq('red') - expect(LocalStorageHelper.getItem('prop2')).to.eq('blue') - expect(LocalStorageHelper.getItem('prop3')).to.eq('magenta') - }) - - cy.clearLocalStorage('prop1').should((ls) => { - expect(ls.getItem('prop1')).to.be.null - expect(ls.getItem('prop2')).to.eq('blue') - expect(ls.getItem('prop3')).to.eq('magenta') - }) - - // Clear keys matching regex in Local Storage - cy.get('.ls-btn').click().should(() => { - expect(LocalStorageHelper.getItem('prop1')).to.eq('red') - expect(LocalStorageHelper.getItem('prop2')).to.eq('blue') - expect(LocalStorageHelper.getItem('prop3')).to.eq('magenta') - }) - - cy.clearLocalStorage(/prop1|2/).should((ls) => { - expect(ls.getItem('prop1')).to.be.null - expect(ls.getItem('prop2')).to.be.null - expect(ls.getItem('prop3')).to.eq('magenta') - }) - }) -}) diff --git a/cypress/integration/examples/location.spec.js b/cypress/integration/examples/location.spec.js deleted file mode 100644 index 299867da07ef0e82bd055098f01558d9e4230fa4..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/location.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -/// <reference types="cypress" /> - -context('Location', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/location') - }) - - it('cy.hash() - get the current URL hash', () => { - // https://on.cypress.io/hash - cy.hash().should('be.empty') - }) - - it('cy.location() - get window.location', () => { - // https://on.cypress.io/location - cy.location().should((location) => { - expect(location.hash).to.be.empty - expect(location.href).to.eq('https://example.cypress.io/commands/location') - expect(location.host).to.eq('example.cypress.io') - expect(location.hostname).to.eq('example.cypress.io') - expect(location.origin).to.eq('https://example.cypress.io') - expect(location.pathname).to.eq('/commands/location') - expect(location.port).to.eq('') - expect(location.protocol).to.eq('https:') - expect(location.search).to.be.empty - }) - }) - - it('cy.url() - get the current URL', () => { - // https://on.cypress.io/url - cy.url().should('eq', 'https://example.cypress.io/commands/location') - }) -}) diff --git a/cypress/integration/examples/misc.spec.js b/cypress/integration/examples/misc.spec.js deleted file mode 100644 index c1b962bd0541a0cee53ec5a731ff1e9a368c5a29..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/misc.spec.js +++ /dev/null @@ -1,92 +0,0 @@ -/// <reference types="cypress" /> - -context('Misc', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/misc') - }) - - it('.end() - end the command chain', () => { - // https://on.cypress.io/end - - // cy.end is useful when you want to end a chain of commands - // and force Cypress to re-query from the root element - cy.get('.misc-table').within(() => { - // ends the current chain and yields null - cy.contains('Cheryl').click().end() - - // queries the entire table again - cy.contains('Charles').click() - }) - }) - - it('cy.exec() - execute a system command', () => { - // execute a system command. - // so you can take actions necessary for - // your test outside the scope of Cypress. - // https://on.cypress.io/exec - - // we can use Cypress.platform string to - // select appropriate command - // https://on.cypress/io/platform - cy.log(`Platform ${Cypress.platform} architecture ${Cypress.arch}`) - - // on CircleCI Windows build machines we have a failure to run bash shell - // https://github.com/cypress-io/cypress/issues/5169 - // so skip some of the tests by passing flag "--env circle=true" - const isCircleOnWindows = Cypress.platform === 'win32' && Cypress.env('circle') - - if (isCircleOnWindows) { - return - } - - cy.exec('echo Jane Lane') - .its('stdout').should('contain', 'Jane Lane') - - if (Cypress.platform === 'win32') { - cy.exec('print cypress.json') - .its('stderr').should('be.empty') - } else { - cy.exec('cat cypress.json') - .its('stderr').should('be.empty') - - cy.exec('pwd') - .its('code').should('eq', 0) - } - }) - - it('cy.focused() - get the DOM element that has focus', () => { - // https://on.cypress.io/focused - cy.get('.misc-form').find('#name').click() - cy.focused().should('have.id', 'name') - - cy.get('.misc-form').find('#description').click() - cy.focused().should('have.id', 'description') - }) - - context('Cypress.Screenshot', function () { - it('cy.screenshot() - take a screenshot', () => { - // https://on.cypress.io/screenshot - cy.screenshot('my-image') - }) - - it('Cypress.Screenshot.defaults() - change default config of screenshots', function () { - Cypress.Screenshot.defaults({ - blackout: ['.foo'], - capture: 'viewport', - clip: { x: 0, y: 0, width: 200, height: 200 }, - scale: false, - disableTimersAndAnimations: true, - screenshotOnRunFailure: true, - beforeScreenshot () { }, - afterScreenshot () { }, - }) - }) - }) - - it('cy.wrap() - wrap an object', () => { - // https://on.cypress.io/wrap - cy.wrap({ foo: 'bar' }) - .should('have.property', 'foo') - .and('include', 'bar') - }) -}) diff --git a/cypress/integration/examples/navigation.spec.js b/cypress/integration/examples/navigation.spec.js deleted file mode 100644 index b85a46890c8f946ac3d9b28bb4da4dbe56ea1a89..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/navigation.spec.js +++ /dev/null @@ -1,56 +0,0 @@ -/// <reference types="cypress" /> - -context('Navigation', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io') - cy.get('.navbar-nav').contains('Commands').click() - cy.get('.dropdown-menu').contains('Navigation').click() - }) - - it('cy.go() - go back or forward in the browser\'s history', () => { - // https://on.cypress.io/go - - cy.location('pathname').should('include', 'navigation') - - cy.go('back') - cy.location('pathname').should('not.include', 'navigation') - - cy.go('forward') - cy.location('pathname').should('include', 'navigation') - - // clicking back - cy.go(-1) - cy.location('pathname').should('not.include', 'navigation') - - // clicking forward - cy.go(1) - cy.location('pathname').should('include', 'navigation') - }) - - it('cy.reload() - reload the page', () => { - // https://on.cypress.io/reload - cy.reload() - - // reload the page without using the cache - cy.reload(true) - }) - - it('cy.visit() - visit a remote url', () => { - // https://on.cypress.io/visit - - // Visit any sub-domain of your current domain - - // Pass options to the visit - cy.visit('https://example.cypress.io/commands/navigation', { - timeout: 50000, // increase total time for the visit to resolve - onBeforeLoad (contentWindow) { - // contentWindow is the remote page's window object - expect(typeof contentWindow === 'object').to.be.true - }, - onLoad (contentWindow) { - // contentWindow is the remote page's window object - expect(typeof contentWindow === 'object').to.be.true - }, - }) - }) -}) diff --git a/cypress/integration/examples/network_requests.spec.js b/cypress/integration/examples/network_requests.spec.js deleted file mode 100644 index 2c985b8d6e61c78bf9a08c5a9d5d30e15a378dd6..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/network_requests.spec.js +++ /dev/null @@ -1,195 +0,0 @@ -/// <reference types="cypress" /> - -context('Network Requests', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/network-requests') - }) - - // Manage AJAX / XHR requests in your app - - it('cy.server() - control behavior of network requests and responses', () => { - // https://on.cypress.io/server - - cy.server().should((server) => { - // the default options on server - // you can override any of these options - expect(server.delay).to.eq(0) - expect(server.method).to.eq('GET') - expect(server.status).to.eq(200) - expect(server.headers).to.be.null - expect(server.response).to.be.null - expect(server.onRequest).to.be.undefined - expect(server.onResponse).to.be.undefined - expect(server.onAbort).to.be.undefined - - // These options control the server behavior - // affecting all requests - - // pass false to disable existing route stubs - expect(server.enable).to.be.true - // forces requests that don't match your routes to 404 - expect(server.force404).to.be.false - // whitelists requests from ever being logged or stubbed - expect(server.whitelist).to.be.a('function') - }) - - cy.server({ - method: 'POST', - delay: 1000, - status: 422, - response: {}, - }) - - // any route commands will now inherit the above options - // from the server. anything we pass specifically - // to route will override the defaults though. - }) - - it('cy.request() - make an XHR request', () => { - // https://on.cypress.io/request - cy.request('https://jsonplaceholder.cypress.io/comments') - .should((response) => { - expect(response.status).to.eq(200) - expect(response.body).to.have.length(500) - expect(response).to.have.property('headers') - expect(response).to.have.property('duration') - }) - }) - - - it('cy.request() - verify response using BDD syntax', () => { - cy.request('https://jsonplaceholder.cypress.io/comments') - .then((response) => { - // https://on.cypress.io/assertions - expect(response).property('status').to.equal(200) - expect(response).property('body').to.have.length(500) - expect(response).to.include.keys('headers', 'duration') - }) - }) - - it('cy.request() with query parameters', () => { - // will execute request - // https://jsonplaceholder.cypress.io/comments?postId=1&id=3 - cy.request({ - url: 'https://jsonplaceholder.cypress.io/comments', - qs: { - postId: 1, - id: 3, - }, - }) - .its('body') - .should('be.an', 'array') - .and('have.length', 1) - .its('0') // yields first element of the array - .should('contain', { - postId: 1, - id: 3, - }) - }) - - it('cy.request() - pass result to the second request', () => { - // first, let's find out the userId of the first user we have - cy.request('https://jsonplaceholder.cypress.io/users?_limit=1') - .its('body') // yields the response object - .its('0') // yields the first element of the returned list - // the above two commands its('body').its('0') - // can be written as its('body.0') - // if you do not care about TypeScript checks - .then((user) => { - expect(user).property('id').to.be.a('number') - // make a new post on behalf of the user - cy.request('POST', 'https://jsonplaceholder.cypress.io/posts', { - userId: user.id, - title: 'Cypress Test Runner', - body: 'Fast, easy and reliable testing for anything that runs in a browser.', - }) - }) - // note that the value here is the returned value of the 2nd request - // which is the new post object - .then((response) => { - expect(response).property('status').to.equal(201) // new entity created - expect(response).property('body').to.contain({ - id: 101, // there are already 100 posts, so new entity gets id 101 - title: 'Cypress Test Runner', - }) - // we don't know the user id here - since it was in above closure - // so in this test just confirm that the property is there - expect(response.body).property('userId').to.be.a('number') - }) - }) - - it('cy.request() - save response in the shared test context', () => { - // https://on.cypress.io/variables-and-aliases - cy.request('https://jsonplaceholder.cypress.io/users?_limit=1') - .its('body').its('0') // yields the first element of the returned list - .as('user') // saves the object in the test context - .then(function () { - // NOTE đŸ‘€ - // By the time this callback runs the "as('user')" command - // has saved the user object in the test context. - // To access the test context we need to use - // the "function () { ... }" callback form, - // otherwise "this" points at a wrong or undefined object! - cy.request('POST', 'https://jsonplaceholder.cypress.io/posts', { - userId: this.user.id, - title: 'Cypress Test Runner', - body: 'Fast, easy and reliable testing for anything that runs in a browser.', - }) - .its('body').as('post') // save the new post from the response - }) - .then(function () { - // When this callback runs, both "cy.request" API commands have finished - // and the test context has "user" and "post" objects set. - // Let's verify them. - expect(this.post, 'post has the right user id').property('userId').to.equal(this.user.id) - }) - }) - - it('cy.route() - route responses to matching requests', () => { - // https://on.cypress.io/route - - let message = 'whoa, this comment does not exist' - - cy.server() - - // Listen to GET to comments/1 - cy.route('GET', 'comments/*').as('getComment') - - // we have code that gets a comment when - // the button is clicked in scripts.js - cy.get('.network-btn').click() - - // https://on.cypress.io/wait - cy.wait('@getComment').its('status').should('eq', 200) - - // Listen to POST to comments - cy.route('POST', '/comments').as('postComment') - - // we have code that posts a comment when - // the button is clicked in scripts.js - cy.get('.network-post').click() - cy.wait('@postComment').should((xhr) => { - expect(xhr.requestBody).to.include('email') - expect(xhr.requestHeaders).to.have.property('Content-Type') - expect(xhr.responseBody).to.have.property('name', 'Using POST in cy.route()') - }) - - // Stub a response to PUT comments/ **** - cy.route({ - method: 'PUT', - url: 'comments/*', - status: 404, - response: { error: message }, - delay: 500, - }).as('putComment') - - // we have code that puts a comment when - // the button is clicked in scripts.js - cy.get('.network-put').click() - - cy.wait('@putComment') - - // our 404 statusCode logic in scripts.js executed - cy.get('.network-put-comment').should('contain', message) - }) -}) diff --git a/cypress/integration/examples/querying.spec.js b/cypress/integration/examples/querying.spec.js deleted file mode 100644 index 00970480f6c8641dd2ee12a2afb417e720417454..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/querying.spec.js +++ /dev/null @@ -1,114 +0,0 @@ -/// <reference types="cypress" /> - -context('Querying', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/querying') - }) - - // The most commonly used query is 'cy.get()', you can - // think of this like the '$' in jQuery - - it('cy.get() - query DOM elements', () => { - // https://on.cypress.io/get - - cy.get('#query-btn').should('contain', 'Button') - - cy.get('.query-btn').should('contain', 'Button') - - cy.get('#querying .well>button:first').should('contain', 'Button') - // ↲ - // Use CSS selectors just like jQuery - - cy.get('[data-test-id="test-example"]').should('have.class', 'example') - - // 'cy.get()' yields jQuery object, you can get its attribute - // by invoking `.attr()` method - cy.get('[data-test-id="test-example"]') - .invoke('attr', 'data-test-id') - .should('equal', 'test-example') - - // or you can get element's CSS property - cy.get('[data-test-id="test-example"]') - .invoke('css', 'position') - .should('equal', 'static') - - // or use assertions directly during 'cy.get()' - // https://on.cypress.io/assertions - cy.get('[data-test-id="test-example"]') - .should('have.attr', 'data-test-id', 'test-example') - .and('have.css', 'position', 'static') - }) - - it('cy.contains() - query DOM elements with matching content', () => { - // https://on.cypress.io/contains - cy.get('.query-list') - .contains('bananas') - .should('have.class', 'third') - - // we can pass a regexp to `.contains()` - cy.get('.query-list') - .contains(/^b\w+/) - .should('have.class', 'third') - - cy.get('.query-list') - .contains('apples') - .should('have.class', 'first') - - // passing a selector to contains will - // yield the selector containing the text - cy.get('#querying') - .contains('ul', 'oranges') - .should('have.class', 'query-list') - - cy.get('.query-button') - .contains('Save Form') - .should('have.class', 'btn') - }) - - it('.within() - query DOM elements within a specific element', () => { - // https://on.cypress.io/within - cy.get('.query-form').within(() => { - cy.get('input:first').should('have.attr', 'placeholder', 'Email') - cy.get('input:last').should('have.attr', 'placeholder', 'Password') - }) - }) - - it('cy.root() - query the root DOM element', () => { - // https://on.cypress.io/root - - // By default, root is the document - cy.root().should('match', 'html') - - cy.get('.query-ul').within(() => { - // In this within, the root is now the ul DOM element - cy.root().should('have.class', 'query-ul') - }) - }) - - it('best practices - selecting elements', () => { - // https://on.cypress.io/best-practices#Selecting-Elements - cy.get('[data-cy=best-practices-selecting-elements]').within(() => { - // Worst - too generic, no context - cy.get('button').click() - - // Bad. Coupled to styling. Highly subject to change. - cy.get('.btn.btn-large').click() - - // Average. Coupled to the `name` attribute which has HTML semantics. - cy.get('[name=submission]').click() - - // Better. But still coupled to styling or JS event listeners. - cy.get('#main').click() - - // Slightly better. Uses an ID but also ensures the element - // has an ARIA role attribute - cy.get('#main[role=button]').click() - - // Much better. But still coupled to text content that may change. - cy.contains('Submit').click() - - // Best. Insulated from all changes. - cy.get('[data-cy=submit]').click() - }) - }) -}) diff --git a/cypress/integration/examples/spies_stubs_clocks.spec.js b/cypress/integration/examples/spies_stubs_clocks.spec.js deleted file mode 100644 index e8bdce5ff24b5c71c771311d8cc7623042ada8fe..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/spies_stubs_clocks.spec.js +++ /dev/null @@ -1,95 +0,0 @@ -/// <reference types="cypress" /> - -context('Spies, Stubs, and Clock', () => { - it('cy.spy() - wrap a method in a spy', () => { - // https://on.cypress.io/spy - cy.visit('https://example.cypress.io/commands/spies-stubs-clocks') - - const obj = { - foo () {}, - } - - const spy = cy.spy(obj, 'foo').as('anyArgs') - - obj.foo() - - expect(spy).to.be.called - }) - - it('cy.spy() retries until assertions pass', () => { - cy.visit('https://example.cypress.io/commands/spies-stubs-clocks') - - const obj = { - /** - * Prints the argument passed - * @param x {any} - */ - foo (x) { - console.log('obj.foo called with', x) - }, - } - - cy.spy(obj, 'foo').as('foo') - - setTimeout(() => { - obj.foo('first') - }, 500) - - setTimeout(() => { - obj.foo('second') - }, 2500) - - cy.get('@foo').should('have.been.calledTwice') - }) - - it('cy.stub() - create a stub and/or replace a function with stub', () => { - // https://on.cypress.io/stub - cy.visit('https://example.cypress.io/commands/spies-stubs-clocks') - - const obj = { - /** - * prints both arguments to the console - * @param a {string} - * @param b {string} - */ - foo (a, b) { - console.log('a', a, 'b', b) - }, - } - - const stub = cy.stub(obj, 'foo').as('foo') - - obj.foo('foo', 'bar') - - expect(stub).to.be.called - }) - - it('cy.clock() - control time in the browser', () => { - // https://on.cypress.io/clock - - // create the date in UTC so its always the same - // no matter what local timezone the browser is running in - const now = new Date(Date.UTC(2017, 2, 14)).getTime() - - cy.clock(now) - cy.visit('https://example.cypress.io/commands/spies-stubs-clocks') - cy.get('#clock-div').click() - .should('have.text', '1489449600') - }) - - it('cy.tick() - move time in the browser', () => { - // https://on.cypress.io/tick - - // create the date in UTC so its always the same - // no matter what local timezone the browser is running in - const now = new Date(Date.UTC(2017, 2, 14)).getTime() - - cy.clock(now) - cy.visit('https://example.cypress.io/commands/spies-stubs-clocks') - cy.get('#tick-div').click() - .should('have.text', '1489449600') - cy.tick(10000) // 10 seconds passed - cy.get('#tick-div').click() - .should('have.text', '1489449610') - }) -}) diff --git a/cypress/integration/examples/traversal.spec.js b/cypress/integration/examples/traversal.spec.js deleted file mode 100644 index 0d2cd70a28e203a3969c058a22cce927973712da..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/traversal.spec.js +++ /dev/null @@ -1,121 +0,0 @@ -/// <reference types="cypress" /> - -context('Traversal', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/traversal') - }) - - it('.children() - get child DOM elements', () => { - // https://on.cypress.io/children - cy.get('.traversal-breadcrumb') - .children('.active') - .should('contain', 'Data') - }) - - it('.closest() - get closest ancestor DOM element', () => { - // https://on.cypress.io/closest - cy.get('.traversal-badge') - .closest('ul') - .should('have.class', 'list-group') - }) - - it('.eq() - get a DOM element at a specific index', () => { - // https://on.cypress.io/eq - cy.get('.traversal-list>li') - .eq(1).should('contain', 'siamese') - }) - - it('.filter() - get DOM elements that match the selector', () => { - // https://on.cypress.io/filter - cy.get('.traversal-nav>li') - .filter('.active').should('contain', 'About') - }) - - it('.find() - get descendant DOM elements of the selector', () => { - // https://on.cypress.io/find - cy.get('.traversal-pagination') - .find('li').find('a') - .should('have.length', 7) - }) - - it('.first() - get first DOM element', () => { - // https://on.cypress.io/first - cy.get('.traversal-table td') - .first().should('contain', '1') - }) - - it('.last() - get last DOM element', () => { - // https://on.cypress.io/last - cy.get('.traversal-buttons .btn') - .last().should('contain', 'Submit') - }) - - it('.next() - get next sibling DOM element', () => { - // https://on.cypress.io/next - cy.get('.traversal-ul') - .contains('apples').next().should('contain', 'oranges') - }) - - it('.nextAll() - get all next sibling DOM elements', () => { - // https://on.cypress.io/nextall - cy.get('.traversal-next-all') - .contains('oranges') - .nextAll().should('have.length', 3) - }) - - it('.nextUntil() - get next sibling DOM elements until next el', () => { - // https://on.cypress.io/nextuntil - cy.get('#veggies') - .nextUntil('#nuts').should('have.length', 3) - }) - - it('.not() - remove DOM elements from set of DOM elements', () => { - // https://on.cypress.io/not - cy.get('.traversal-disabled .btn') - .not('[disabled]').should('not.contain', 'Disabled') - }) - - it('.parent() - get parent DOM element from DOM elements', () => { - // https://on.cypress.io/parent - cy.get('.traversal-mark') - .parent().should('contain', 'Morbi leo risus') - }) - - it('.parents() - get parent DOM elements from DOM elements', () => { - // https://on.cypress.io/parents - cy.get('.traversal-cite') - .parents().should('match', 'blockquote') - }) - - it('.parentsUntil() - get parent DOM elements from DOM elements until el', () => { - // https://on.cypress.io/parentsuntil - cy.get('.clothes-nav') - .find('.active') - .parentsUntil('.clothes-nav') - .should('have.length', 2) - }) - - it('.prev() - get previous sibling DOM element', () => { - // https://on.cypress.io/prev - cy.get('.birds').find('.active') - .prev().should('contain', 'Lorikeets') - }) - - it('.prevAll() - get all previous sibling DOM elements', () => { - // https://on.cypress.io/prevAll - cy.get('.fruits-list').find('.third') - .prevAll().should('have.length', 2) - }) - - it('.prevUntil() - get all previous sibling DOM elements until el', () => { - // https://on.cypress.io/prevUntil - cy.get('.foods-list').find('#nuts') - .prevUntil('#veggies').should('have.length', 3) - }) - - it('.siblings() - get all sibling DOM elements', () => { - // https://on.cypress.io/siblings - cy.get('.traversal-pills .active') - .siblings().should('have.length', 2) - }) -}) diff --git a/cypress/integration/examples/utilities.spec.js b/cypress/integration/examples/utilities.spec.js deleted file mode 100644 index 753336fcec01ccf7d285e1581de118b908b8cb23..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/utilities.spec.js +++ /dev/null @@ -1,133 +0,0 @@ -/// <reference types="cypress" /> - -context('Utilities', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/utilities') - }) - - it('Cypress._ - call a lodash method', () => { - // https://on.cypress.io/_ - cy.request('https://jsonplaceholder.cypress.io/users') - .then((response) => { - let ids = Cypress._.chain(response.body).map('id').take(3).value() - - expect(ids).to.deep.eq([1, 2, 3]) - }) - }) - - it('Cypress.$ - call a jQuery method', () => { - // https://on.cypress.io/$ - let $li = Cypress.$('.utility-jquery li:first') - - cy.wrap($li) - .should('not.have.class', 'active') - .click() - .should('have.class', 'active') - }) - - it('Cypress.Blob - blob utilities and base64 string conversion', () => { - // https://on.cypress.io/blob - cy.get('.utility-blob').then(($div) => - // https://github.com/nolanlawson/blob-util#imgSrcToDataURL - // get the dataUrl string for the javascript-logo - Cypress.Blob.imgSrcToDataURL('https://example.cypress.io/assets/img/javascript-logo.png', undefined, 'anonymous') - .then((dataUrl) => { - // create an <img> element and set its src to the dataUrl - let img = Cypress.$('<img />', { src: dataUrl }) - - // need to explicitly return cy here since we are initially returning - // the Cypress.Blob.imgSrcToDataURL promise to our test - // append the image - $div.append(img) - - cy.get('.utility-blob img').click() - .should('have.attr', 'src', dataUrl) - })) - }) - - it('Cypress.minimatch - test out glob patterns against strings', () => { - // https://on.cypress.io/minimatch - let matching = Cypress.minimatch('/users/1/comments', '/users/*/comments', { - matchBase: true, - }) - - expect(matching, 'matching wildcard').to.be.true - - matching = Cypress.minimatch('/users/1/comments/2', '/users/*/comments', { - matchBase: true, - }) - expect(matching, 'comments').to.be.false - - // ** matches against all downstream path segments - matching = Cypress.minimatch('/foo/bar/baz/123/quux?a=b&c=2', '/foo/**', { - matchBase: true, - }) - expect(matching, 'comments').to.be.true - - // whereas * matches only the next path segment - - matching = Cypress.minimatch('/foo/bar/baz/123/quux?a=b&c=2', '/foo/*', { - matchBase: false, - }) - expect(matching, 'comments').to.be.false - }) - - - it('Cypress.moment() - format or parse dates using a moment method', () => { - // https://on.cypress.io/moment - const time = Cypress.moment('2014-04-25T19:38:53.196Z').utc().format('h:mm A') - - expect(time).to.be.a('string') - - cy.get('.utility-moment').contains('3:38 PM') - .should('have.class', 'badge') - - // the time in the element should be between 3pm and 5pm - const start = Cypress.moment('3:00 PM', 'LT') - const end = Cypress.moment('5:00 PM', 'LT') - - cy.get('.utility-moment .badge') - .should(($el) => { - // parse American time like "3:38 PM" - const m = Cypress.moment($el.text().trim(), 'LT') - - // display hours + minutes + AM|PM - const f = 'h:mm A' - - expect(m.isBetween(start, end), - `${m.format(f)} should be between ${start.format(f)} and ${end.format(f)}`).to.be.true - }) - }) - - - it('Cypress.Promise - instantiate a bluebird promise', () => { - // https://on.cypress.io/promise - let waited = false - - /** - * @return Bluebird<string> - */ - function waitOneSecond () { - // return a promise that resolves after 1 second - // @ts-ignore TS2351 (new Cypress.Promise) - return new Cypress.Promise((resolve, reject) => { - setTimeout(() => { - // set waited to true - waited = true - - // resolve with 'foo' string - resolve('foo') - }, 1000) - }) - } - - cy.then(() => - // return a promise to cy.then() that - // is awaited until it resolves - // @ts-ignore TS7006 - waitOneSecond().then((str) => { - expect(str).to.eq('foo') - expect(waited).to.be.true - })) - }) -}) diff --git a/cypress/integration/examples/viewport.spec.js b/cypress/integration/examples/viewport.spec.js deleted file mode 100644 index dbcd7eeddd01e0c8f6b79ed2e8ebe69f67ce666d..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/viewport.spec.js +++ /dev/null @@ -1,59 +0,0 @@ -/// <reference types="cypress" /> - -context('Viewport', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/viewport') - }) - - it('cy.viewport() - set the viewport size and dimension', () => { - // https://on.cypress.io/viewport - - cy.get('#navbar').should('be.visible') - cy.viewport(320, 480) - - // the navbar should have collapse since our screen is smaller - cy.get('#navbar').should('not.be.visible') - cy.get('.navbar-toggle').should('be.visible').click() - cy.get('.nav').find('a').should('be.visible') - - // lets see what our app looks like on a super large screen - cy.viewport(2999, 2999) - - // cy.viewport() accepts a set of preset sizes - // to easily set the screen to a device's width and height - - // We added a cy.wait() between each viewport change so you can see - // the change otherwise it is a little too fast to see :) - - cy.viewport('macbook-15') - cy.wait(200) - cy.viewport('macbook-13') - cy.wait(200) - cy.viewport('macbook-11') - cy.wait(200) - cy.viewport('ipad-2') - cy.wait(200) - cy.viewport('ipad-mini') - cy.wait(200) - cy.viewport('iphone-6+') - cy.wait(200) - cy.viewport('iphone-6') - cy.wait(200) - cy.viewport('iphone-5') - cy.wait(200) - cy.viewport('iphone-4') - cy.wait(200) - cy.viewport('iphone-3') - cy.wait(200) - - // cy.viewport() accepts an orientation for all presets - // the default orientation is 'portrait' - cy.viewport('ipad-2', 'portrait') - cy.wait(200) - cy.viewport('iphone-4', 'landscape') - cy.wait(200) - - // The viewport will be reset back to the default dimensions - // in between tests (the default can be set in cypress.json) - }) -}) diff --git a/cypress/integration/examples/waiting.spec.js b/cypress/integration/examples/waiting.spec.js deleted file mode 100644 index fc5fe1f38ecb64686d40b5fa56b4200365bdbd5c..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/waiting.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -/// <reference types="cypress" /> - -context('Waiting', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/waiting') - }) - // BE CAREFUL of adding unnecessary wait times. - // https://on.cypress.io/best-practices#Unnecessary-Waiting - - // https://on.cypress.io/wait - it('cy.wait() - wait for a specific amount of time', () => { - cy.get('.wait-input1').type('Wait 1000ms after typing') - cy.wait(1000) - cy.get('.wait-input2').type('Wait 1000ms after typing') - cy.wait(1000) - cy.get('.wait-input3').type('Wait 1000ms after typing') - cy.wait(1000) - }) - - it('cy.wait() - wait for a specific route', () => { - cy.server() - - // Listen to GET to comments/1 - cy.route('GET', 'comments/*').as('getComment') - - // we have code that gets a comment when - // the button is clicked in scripts.js - cy.get('.network-btn').click() - - // wait for GET comments/1 - cy.wait('@getComment').its('status').should('eq', 200) - }) - -}) diff --git a/cypress/integration/examples/window.spec.js b/cypress/integration/examples/window.spec.js deleted file mode 100644 index f94b64971db16f7f69b38958a77897b321ffeec8..0000000000000000000000000000000000000000 --- a/cypress/integration/examples/window.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -/// <reference types="cypress" /> - -context('Window', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/window') - }) - - it('cy.window() - get the global window object', () => { - // https://on.cypress.io/window - cy.window().should('have.property', 'top') - }) - - it('cy.document() - get the document object', () => { - // https://on.cypress.io/document - cy.document().should('have.property', 'charset').and('eq', 'UTF-8') - }) - - it('cy.title() - get the title', () => { - // https://on.cypress.io/title - cy.title().should('include', 'Kitchen Sink') - }) -}) diff --git a/cypress/integration/orgunit-helper.ts b/cypress/integration/orgunit-helper.ts index 066f5a3e7b59ad292b3c57cf3bb84b6f1e0c92b2..37436d10f03815659ce8915a3068f0f7c95c027b 100644 --- a/cypress/integration/orgunit-helper.ts +++ b/cypress/integration/orgunit-helper.ts @@ -6,7 +6,7 @@ import {ModuleLoadedEnum} from "@src/app/shared/enums/module-loaded.enum"; import { Guid, isNotNullNorUndefined, -} from "solidify-frontend"; +} from "solidify-frontend/src/lib/core-resources"; import {TestHelper} from "./test-helper"; export class OrgunitHelper { diff --git a/cypress/integration/test-helper.ts b/cypress/integration/test-helper.ts index 1d6b4c429c7fb98f3a53b33f56ab7e3c8459b2c5..9f59e7d6b96311a57e96748f4caea79549a9a4bb 100644 --- a/cypress/integration/test-helper.ts +++ b/cypress/integration/test-helper.ts @@ -11,7 +11,7 @@ import { isNullOrUndefined, SessionStorageHelper, } from "solidify-frontend"; -import {cypressEnvironment} from "./environments/cypress-environment"; +import {cypressEnvironment} from "../environments/cypress-environment"; import Chainable = Cypress.Chainable; import WaitXHR = Cypress.WaitXHR; diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js deleted file mode 100644 index 809f6c88473130e44da33f61dbd049b23b1954df..0000000000000000000000000000000000000000 --- a/cypress/plugins/index.js +++ /dev/null @@ -1,28 +0,0 @@ -/// <reference types="cypress" /> -// *********************************************************** -// This example plugins/index.js can be used to load plugins -// -// You can change the location of this file or turn off loading -// the plugins file with the 'pluginsFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/plugins-guide -// *********************************************************** - -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - -const wp = require("@cypress/webpack-preprocessor"); - -/** - * @type {Cypress.PluginConfig} - */ -module.exports = (on, config) => { - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config - - const options = { - webpackOptions: require("../webpack.config.js") - }; - on("file:preprocessor", wp(options)); -} diff --git a/cypress/support/commands.js b/cypress/support/commands.js deleted file mode 100644 index 13b27fbcb91891d8fe369c97a9257e8194a679b7..0000000000000000000000000000000000000000 --- a/cypress/support/commands.js +++ /dev/null @@ -1,26 +0,0 @@ -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add("login", (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) -import 'cypress-file-upload'; diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts new file mode 100644 index 0000000000000000000000000000000000000000..cacf66cd0872d7ab3f3e8d215a768359d5ccd424 --- /dev/null +++ b/cypress/support/commands.ts @@ -0,0 +1,67 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - commands.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + + +// *********************************************** +// This example namespace declaration will help +// with Intellisense and code completion in your +// IDE or Text Editor. +// *********************************************** +// declare namespace Cypress { +// interface Chainable<Subject = any> { +// customCommand(param: any): typeof customCommand; +// } +// } +// +// function customCommand(param: any): void { +// console.warn(param); +// } +// +// NOTE: You can use it like so: +// Cypress.Commands.add('customCommand', customCommand); +// +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add("login", (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9c2c9d6c5b2e3aed5f3db115ee16f0269469552 --- /dev/null +++ b/cypress/support/e2e.ts @@ -0,0 +1,41 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - e2e.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + + +// *********************************************************** +// This example support/e2e.ts is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// When a command from ./commands is ready to use, import with `import './commands'` syntax +// import './commands'; diff --git a/cypress/support/index.js b/cypress/support/index.js deleted file mode 100644 index d68db96df2697e0835f5c490db0c2cc81673f407..0000000000000000000000000000000000000000 --- a/cypress/support/index.js +++ /dev/null @@ -1,20 +0,0 @@ -// *********************************************************** -// This example support/index.js is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/cypress/support/orgunit-helper.ts b/cypress/support/orgunit-helper.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d370a75ef4722dbddfc9ae6dd51b2d9167fbf9b --- /dev/null +++ b/cypress/support/orgunit-helper.ts @@ -0,0 +1,149 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - orgunit-helper.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + +import {Enums} from "@enums"; +import {DataTestEnum} from "@shared/enums/data-test.enum"; +import {HttpVerbEnum} from "@shared/enums/http-verb.enum"; +import { + Guid, + isNotNullNorUndefined, +} from "solidify-frontend/src/lib/core-resources"; +import {HttpStatusCode} from "../enums/http-status-code.enum"; +import {TestHelper} from "./test-helper"; + +export class OrgunitHelper { + static orgUnitBaseNamePermanent: string = "[Cypress Permanent Test Data] Org Unit"; + static orgUnitBaseNameTemporary: string = "[Cypress Temporary Test Data] Org Unit"; + + private static _generateOrgUnitName(role: Enums.Role.RoleEnum | undefined, forPrerequisiteTest: boolean): string { + let orgUnitName = forPrerequisiteTest ? this.orgUnitBaseNamePermanent : this.orgUnitBaseNameTemporary; + let forRoleText = ""; + if (isNotNullNorUndefined(role)) { + forRoleText = " for " + role; + } else { + forRoleText = " for " + "NOBODY"; + } + orgUnitName = orgUnitName + forRoleText; + if (!forPrerequisiteTest) { + orgUnitName = orgUnitName + " " + Guid.MakeNew().ToString().toLowerCase(); + } + return orgUnitName; + } + + static createIfNotExistOrgUnitForPrerequisiteTest(role: Enums.Role.RoleEnum | undefined): string { + const orgUnitName = this._generateOrgUnitName(role, true); + TestHelper.login(Enums.UserApplicationRole.UserApplicationRoleEnum.root); + + // Go to admin page + cy.get(".avatar-wrapper").first().click(); + TestHelper.getTestData(DataTestEnum.linkMenuAdmin).click(); + // TestHelper.waitModuleLoaded(ModuleLoadedEnum.adminModuleLoaded); + + // Go to org unit list page + TestHelper.getTestData(DataTestEnum.adminTileOrganizationalUnit).click(); + // TestHelper.waitModuleLoaded(ModuleLoadedEnum.adminOrganizationalUnitModuleLoaded); + + TestHelper.getTestData(DataTestEnum.adminOrgUnitListSearchName).type(orgUnitName, {delay: 0, release: false}); + + cy.get("solidify-data-table").should("attr", "data-test-info-number-line").then((numberElement: number | any) => { + if (numberElement === "1") { + return; + } else if (numberElement === "0") { + this.createOrgUnit(role, true); + } else { + expect(+numberElement).to.be.lte(1); + } + }); + + return orgUnitName; + } + + static createOrgUnit(role: Enums.Role.RoleEnum | undefined, forPrerequisiteTest: boolean = false): string { + const orgUnitName = this._generateOrgUnitName(role, forPrerequisiteTest); + TestHelper.login(Enums.UserApplicationRole.UserApplicationRoleEnum.root); + + // Go to admin page + cy.get(".avatar-wrapper").first().click(); + TestHelper.getTestData(DataTestEnum.linkMenuAdmin).click(); + // TestHelper.waitModuleLoaded(ModuleLoadedEnum.adminModuleLoaded); + + // Go to org unit list page + TestHelper.getTestData(DataTestEnum.adminTileOrganizationalUnit).click(); + + // Go to org unit creation page + TestHelper.waitXhrs([ + "admin/preservation-policies?*", + "admin/submission-policies?*", + "admin/dissemination-policies?*", + "admin/roles?*", + ], () => TestHelper.getTestData(DataTestEnum.create).click()); + + TestHelper.getTestData(DataTestEnum.adminOrgUnitName).type(orgUnitName); + + TestHelper.getTestData(DataTestEnum.adminOrgUnitSubmissionPolicy) + .click() + .get("solidify-multi-select-default-value-content li") + .first() + .click(); + + TestHelper.clickBackdrop(); + + TestHelper.getTestData(DataTestEnum.adminOrgUnitPreservationPolicy) + .click() + .get("solidify-multi-select-default-value-content li") + .first() + .click(); + + TestHelper.clickBackdrop(); + + if (isNotNullNorUndefined(role)) { + TestHelper.getTestData(DataTestEnum.sharedPersonOrgUnitRoleButtonAdd).click(); + + cy.intercept("*/admin/people?*") + .as("personInit"); + cy.intercept("*/admin/people/search?*") + .as("personSearch"); + TestHelper.getTestData(DataTestEnum.sharedPersonOrgUnitRoleInputPerson) + .last() + .click() + .wait("@personInit") + .get("solidify-searchable-single-select-content input") + .type("USER Last Name") + .wait("@personSearch") + .get("solidify-searchable-single-select-content li") + .first() + .click(); + + TestHelper.getTestData(DataTestEnum.sharedPersonOrgUnitRoleInputRole) + .last() + .click(); + TestHelper.getTestData(role as any).click(); + } + + TestHelper.waitXhr("admin/organizational-units/*", () => TestHelper.getTestData(DataTestEnum.save).click(), { + expectedHttpCode: HttpStatusCode.Ok, + method: HttpVerbEnum.GET, + }); + return orgUnitName; + } +} diff --git a/cypress/support/test-helper.ts b/cypress/support/test-helper.ts new file mode 100644 index 0000000000000000000000000000000000000000..89588608d7e60eb969deed561b4bb82887980dde --- /dev/null +++ b/cypress/support/test-helper.ts @@ -0,0 +1,124 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - test-helper.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + +import {Enums} from "@enums"; +import {DataTestEnum} from "@shared/enums/data-test.enum"; +import {HttpVerbEnum} from "@shared/enums/http-verb.enum"; +import {Interception} from "cypress/types/net-stubbing"; +import {isNotNullNorUndefined, isNullOrUndefined} from "solidify-frontend/src/lib/core-resources"; +import {cypressEnvironment} from "../environments/cypress-environment"; +// import {Interception} from "cypress/types/net-stubbing"; +// import { +// isNotNullNorUndefined, +// isNullOrUndefined, +// } from "solidify-frontend/src/lib/core-resources"; +import {HttpStatusCode} from "../enums/http-status-code.enum"; +import Chainable = Cypress.Chainable; + +// import Chainable = Cypress.Chainable; + +export class TestHelper { + static testData(dataTest: DataTestEnum | string): string { + return `[data-test=${dataTest}]`; + } + + static getTestData(dataTest: DataTestEnum): Cypress.Chainable<JQuery<HTMLElement>> { + return cy.get(this.testData(dataTest)); + } + + static login(applicationRole: Enums.UserApplicationRole.UserApplicationRoleEnum): void { + let token: string | undefined = undefined; + if (!cypressEnvironment.localAuth) { + switch (applicationRole) { + case Enums.UserApplicationRole.UserApplicationRoleEnum.root: + token = cypressEnvironment.tokenRoot; + break; + case Enums.UserApplicationRole.UserApplicationRoleEnum.admin: + token = cypressEnvironment.tokenAdmin; + break; + case Enums.UserApplicationRole.UserApplicationRoleEnum.user: + token = cypressEnvironment.tokenUser; + break; + case Enums.UserApplicationRole.UserApplicationRoleEnum.guest: + default: + this.logout(); + return; + } + if (isNotNullNorUndefined(token)) { + sessionStorage.setItem("access_token", token as string); + } + } + } + + static logout(): void { + sessionStorage.removeItem("access_token"); + sessionStorage.removeItem("refresh_token"); + } + + static waitXhrs(listUrls: string[], triggerCallback: () => any | undefined): Cypress.Chainable<Interception[]> { + const listAlias: string[] = []; + const baseNameAliasXhr = "xhr"; + listUrls.forEach((url, index) => { + const nameAliasXhr = baseNameAliasXhr + index; + cy.intercept(url).as(nameAliasXhr); + listAlias.push("@" + nameAliasXhr); + }); + if (isNotNullNorUndefined(triggerCallback)) { + triggerCallback(); + } + return cy.wait(listAlias); + } + + static waitXhr(url: string, triggerCallback: () => any | undefined, opts?: WaitXhrOptions): Chainable<Interception> { + let options = new WaitXhrOptions(); + if (isNotNullNorUndefined(opts)) { + options = opts as WaitXhrOptions; + } + if (isNullOrUndefined(options.method)) { + cy.intercept(url).as("xhr"); + } else { + cy.intercept(options.method, url).as("xhr"); + } + if (isNotNullNorUndefined(triggerCallback)) { + triggerCallback(); + } + return cy.wait("@xhr").then((xhr) => { + if (isNotNullNorUndefined(options.expectedHttpCode)) { + expect(xhr.response.statusCode).to.eq(options.expectedHttpCode); + + expect(xhr.response.statusCode).eq(200); + // cy.wait("@search").its("response.statusCode").should("eq", 200); + + } + }); + } + + static clickBackdrop(): void { + cy.get(".cdk-overlay-backdrop").click(); + } +} + +export class WaitXhrOptions { + method?: HttpVerbEnum = HttpVerbEnum.GET; + expectedHttpCode?: number = HttpStatusCode.Ok; +} diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index 155c8257fab8c7bbc65842a046b9c8bbdcdb54cf..e759f369a128a797688b7e7b5b73d2c02af5e463 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -1,62 +1,8 @@ { "extends": "../tsconfig.json", - "include": [ - "*/*.ts", - "./integration/environments/*.ts", - "../node_modules/cypress", - "../node_modules/solidify-frontend" - ], + "include": ["**/*.ts"], "compilerOptions": { - "strict": true, - "target": "es5", - "types": [ - "cypress" - ], - "lib": [ - "es5", - "dom" - ], - "baseUrl": "..", - "paths": { - "@src/*": [ - "src/*" - ], - "@cypress-environments/*": [ - "environments/*" - ], - "@environments/*": [ - "environments/*" - ], - "@app/*": [ - "app/*" - ], - "@shared/*": [ - "app/shared/*" - ], - "@admin/*": [ - "app/features/admin/*" - ], - "@deposit/*": [ - "app/features/deposit/*" - ], - "@home/*": [ - "app/features/home/*" - ], - "@preservation-space/*": [ - "app/features/preservation-space/*" - ], - "@preservation-planning/*": [ - "app/features/preservation-planning/*" - ], - "@order/*": [ - "app/features/order/*" - ], - "@models": [ - "app/models/index" - ], - "@enums": [ - "app/enums/index" - ] - } + "sourceMap": false, + "types": ["cypress"], } -} \ No newline at end of file +} diff --git a/cypress/videos/examples/actions.spec.js.mp4 b/cypress/videos/examples/actions.spec.js.mp4 deleted file mode 100644 index e7f7a256156a2df5f147ae59a47edda0c091e596..0000000000000000000000000000000000000000 Binary files a/cypress/videos/examples/actions.spec.js.mp4 and /dev/null differ diff --git a/cypress/webpack.config.js b/cypress/webpack.config.js deleted file mode 100644 index 3d79af0e7386fa608a5419b16318aa883b218272..0000000000000000000000000000000000000000 --- a/cypress/webpack.config.js +++ /dev/null @@ -1,41 +0,0 @@ -var path = require('path'); - -module.exports = { - mode: 'development', - resolve: { - extensions: ['.ts', '.js'], - alias: { - '@src': path.resolve(__dirname, '../src'), - '@shared': path.resolve(__dirname, '../src/app/shared'), - '@cypress-environments': path.resolve(__dirname, './environments'), - '@environments': path.resolve(__dirname, '../src/environments'), - '@app': path.resolve(__dirname, '../src/app'), - '@admin': path.resolve(__dirname, '../src/app/features/admin'), - '@deposit': path.resolve(__dirname, '../src/app/features/deposit'), - '@home': path.resolve(__dirname, '../src/app/features/home'), - '@preservation-planning': path.resolve(__dirname, '../src/app/features/preservation-planning'), - '@preservation-space': path.resolve(__dirname, '../src/app/features/preservation-space'), - '@order': path.resolve(__dirname, '../src/app/features/order'), - '@models': path.resolve(__dirname, '../src/app/models/index'), - '@enums': path.resolve(__dirname, '../src/app/enums/index'), - 'solidify-frontend': path.resolve(__dirname, '../node_modules/solidify-frontend') - } - }, - module: { - rules: [ - { - test: /\.ts$/, - exclude: [/node_modules/], - use: [ - { - loader: 'ts-loader', - options: { - // skip typechecking for speed - transpileOnly: true - } - } - ] - } - ] - } -} \ No newline at end of file diff --git a/e2e/protractor.conf.js b/e2e/protractor.conf.js deleted file mode 100644 index 86776a391a5b48b32506eb0fa62b15ed6c926b69..0000000000000000000000000000000000000000 --- a/e2e/protractor.conf.js +++ /dev/null @@ -1,28 +0,0 @@ -// Protractor configuration file, see link for more information -// https://github.com/angular/protractor/blob/master/lib/config.ts - -const { SpecReporter } = require('jasmine-spec-reporter'); - -exports.config = { - allScriptsTimeout: 11000, - specs: [ - './src/**/*.e2e-spec.ts' - ], - capabilities: { - 'browserName': 'chrome' - }, - directConnect: true, - baseUrl: 'http://localhost:4200/', - framework: 'jasmine', - jasmineNodeOpts: { - showColors: true, - defaultTimeoutInterval: 30000, - print: function() {} - }, - onPrepare() { - require('ts-node').register({ - project: require('path').join(__dirname, './tsconfig.e2e.json') - }); - jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); - } -}; \ No newline at end of file diff --git a/e2e/src/app.e2e-spec.ts b/e2e/src/app.e2e-spec.ts deleted file mode 100644 index cc6d21232abda94f1b8cb2698983a2cfa0d0b711..0000000000000000000000000000000000000000 --- a/e2e/src/app.e2e-spec.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { - browser, - logging, -} from "protractor"; -import {AppPage} from "./app.po"; - -describe("workspace-project App", () => { - let page: AppPage; - - beforeEach(() => { - page = new AppPage(); - }); - - it("should display welcome message", () => { - page.navigateTo(); - expect(page.getTitleText()).toEqual("Welcome to dlcm-portal!"); - }); - - afterEach(async () => { - // Assert that there are no errors emitted from the browser - const logs = await browser.manage().logs().get(logging.Type.BROWSER); - expect(logs).not.toContain(jasmine.objectContaining({ - level: logging.Level.SEVERE, - } as logging.Entry)); - }); -}); diff --git a/e2e/src/app.po.ts b/e2e/src/app.po.ts deleted file mode 100644 index 8e1d613d0803a40fc0f774bf1761d9294c97e2bf..0000000000000000000000000000000000000000 --- a/e2e/src/app.po.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { - browser, - by, - element, -} from "protractor"; - -export class AppPage { - navigateTo(): Promise<any> { - return browser.get(browser.baseUrl) as Promise<any>; - } - - getTitleText(): Promise<string> { - return element(by.css("dlcm-root h1")).getText() as Promise<string>; - } -} diff --git a/e2e/tsconfig.e2e.json b/e2e/tsconfig.e2e.json deleted file mode 100644 index a6dd6220282460dae17d69fc030b94ab1e81d960..0000000000000000000000000000000000000000 --- a/e2e/tsconfig.e2e.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/app", - "module": "commonjs", - "target": "es5", - "types": [ - "jasmine", - "jasminewd2", - "node" - ] - } -} \ No newline at end of file diff --git a/package.json b/package.json index e6c398ea0f6f56b9050db07a8d80ed81bfb8c10c..c862fce952904df99bd56c39006f0d442d6aec18 100644 --- a/package.json +++ b/package.json @@ -29,15 +29,16 @@ "compress": "gzipper compress ./dist/dlcm-portal/browser --gzip-level 9 --exclude json,sh", "test": "pnpm run prepare && ng test --no-progress --code-coverage", "test:ci": "pnpm run prepare && ng test --code-coverage --watch=false --no-progress --browsers=ChromeNoSandboxHeadless", + "e2e": "ng e2e", "cypress": "concurrently \"pnpm run start\" \"pnpm run cypress-open\"", - "cypress-open": "pnpm run cypress-environment-local && cypress open", + "cypress:open": "pnpm run cypress-environment-local && cypress open", "cypress:ci": "pnpm run cypress-environment-local && cypress run", "prepare": "pnpm run generate-version && pnpm run environment-local && pnpm run server-environment-local && pnpm run server-environment-runtime-local && pnpm run environment-runtime-local && pnpm run proxy-conf-local && pnpm run generate-models", "environment-local": "(cp -n src/assets/files-to-copy/environment.local.ts-to-copy.txt src/environments/environment.local.ts || echo environment.local.ts already exists)", "server-environment-local": "(cp -n src/assets/files-to-copy/server-environment.local.ts-to-copy.txt src/server-environments/server-environment.local.ts || echo server-environment.local.ts already exists)", "server-environment-runtime-local": "(cp -n src/assets/files-to-copy/server-environment.runtime-local.json-to-copy.txt src/server-environments/server-environment.runtime-local.json || echo server-environment.runtime-local.json already exists)", "environment-runtime-local": "(cp -n src/assets/files-to-copy/environment.runtime-local.json-to-copy.txt src/server-environments/environment.runtime-local.json || echo environment.runtime-local.json already exists)", - "cypress-environment-local": "(cp -n src/assets/files-to-copy/cypress-environment.local.ts-to-copy.txt cypress/integration/environments/cypress-environment.local.ts || echo cypress-environment.local.ts already exists)", + "cypress-environment-local": "(cp -n src/assets/files-to-copy/cypress-environment.local.ts-to-copy.txt cypress/environments/cypress-environment.local.ts || echo cypress-environment.local.ts already exists)", "proxy-conf-local": "(cp -n src/assets/files-to-copy/proxy.conf.local.js-to-copy.txt proxy.conf.local.js || echo proxy.conf.local.js already exists)", "clean": "(rm -rf node_modules || echo node_modules directory is absent)", "lint": "ng lint", @@ -163,6 +164,7 @@ "@angular/cli": "18.2.7", "@angular/compiler-cli": "18.2.7", "@angular/language-service": "18.2.7", + "@cypress/schematic": "3.0.0", "@cypress/webpack-preprocessor": "6.0.2", "@ngxs/devtools-plugin": "18.1.1", "@openapitools/openapi-generator-cli": "2.13.13", @@ -176,8 +178,11 @@ "@vendure/ngx-translate-extract": "9.2.1", "codelyzer": "6.0.2", "concurrently": "9.0.1", - "cypress": "13.15.0", - "cypress-file-upload": "5.0.8", + "cypress": "14.0.0", + "cypress-intellij-reporter": "0.0.7", + "cypress-multi-reporters": "2.0.5", + "cypress-skip-and-only-ui": "1.2.19", + "cypress-wait-until": "3.0.2", "esbuild": "0.24.0", "eslint": "9.12.0", "eslint-plugin-import": "2.31.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f39cf91a383d165ca2790e36a84c95dd65545dfa..bccb16a471ff5b0619d0ca92634f855dc98e565f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -269,6 +269,9 @@ importers: '@angular/language-service': specifier: 18.2.7 version: 18.2.7 + '@cypress/schematic': + specifier: 3.0.0 + version: 3.0.0(@angular/cli@18.2.7(chokidar@3.6.0))(@angular/core@18.2.7(rxjs@7.8.1)(zone.js@0.14.10)) '@cypress/webpack-preprocessor': specifier: 6.0.2 version: 6.0.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(babel-loader@9.1.3(@babel/core@7.25.2)(webpack@5.95.0(esbuild@0.24.0)))(webpack@5.95.0(esbuild@0.24.0)) @@ -309,11 +312,20 @@ importers: specifier: 9.0.1 version: 9.0.1 cypress: - specifier: 13.15.0 - version: 13.15.0 - cypress-file-upload: - specifier: 5.0.8 - version: 5.0.8(cypress@13.15.0) + specifier: 14.0.0 + version: 14.0.0 + cypress-intellij-reporter: + specifier: 0.0.7 + version: 0.0.7 + cypress-multi-reporters: + specifier: 2.0.5 + version: 2.0.5(mocha@11.1.0) + cypress-skip-and-only-ui: + specifier: 1.2.19 + version: 1.2.19 + cypress-wait-until: + specifier: 3.0.2 + version: 3.0.2 esbuild: specifier: 0.24.0 version: 0.24.0 @@ -1375,6 +1387,12 @@ packages: resolution: {integrity: sha512-LzxlLEMbBOPYB85uXrDqvD4MgcenjRBLIns3zyhx7vTPj/0u2eQhzXvPiGcaJrV38Q9dbkExWp6cOHPJ+EtFYg==} engines: {node: '>= 6'} + '@cypress/schematic@3.0.0': + resolution: {integrity: sha512-LFT0sl4HOykGWwrDfvHnQxucSvT2P/VA+GOk89dbSRMkXLG8u8h9GfbqK+9keoJBGTnfJFU8MWTtwjyYwPZW6w==} + peerDependencies: + '@angular/cli': '>=17.2' + '@angular/core': '>=17.2' + '@cypress/webpack-preprocessor@6.0.2': resolution: {integrity: sha512-0+1+4iy4W9PE6R5ywBNKAZoFp8Sf//w3UJ+CKTqkcAjA29b+dtsD0iFT70DsYE0BMqUM1PO7HXFGbXllQ+bRAA==} peerDependencies: @@ -3057,6 +3075,11 @@ packages: peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + acorn@7.4.1: + resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==} + engines: {node: '>=0.4.0'} + hasBin: true + acorn@8.14.0: resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} engines: {node: '>=0.4.0'} @@ -3384,6 +3407,9 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + browser-stdout@1.3.1: + resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} + browserslist@4.24.3: resolution: {integrity: sha512-1CPmv8iobE2fyRMV97dAcMVegvvWKxmq94hkLiAkUGwKVTyDLw33K+ZxiFrREKmmps4rIw6grcCFCnTMSZ/YiA==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -3455,6 +3481,10 @@ packages: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} + camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + caniuse-lite@1.0.30001689: resolution: {integrity: sha512-CmeR2VBycfa+5/jOfnp/NpWPGd06nf1XYiefUvhXFfZE4GkRc9jv+eGPS4nT558WS/8lYCzV8SlANCIPvbWP1g==} @@ -3509,8 +3539,8 @@ packages: resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} engines: {node: '>=6.0'} - ci-info@3.9.0: - resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} + ci-info@4.1.0: + resolution: {integrity: sha512-HutrvTNsF48wnxkzERIXOe5/mlcfFcbfCmwcg6CJnizbSue78AbDt+1cgl26zwn61WFxhcPykPfZrbqjGmBb4A==} engines: {node: '>=8'} clean-stack@2.2.0: @@ -3847,15 +3877,24 @@ packages: custom-event@1.0.1: resolution: {integrity: sha512-GAj5FOq0Hd+RsCGVJxZuKaIDXDf3h6GQoNEjFgbLLI/trgtavwUbSnZ5pVfg27DVCaWjIohryS0JFwIJyT2cMg==} - cypress-file-upload@5.0.8: - resolution: {integrity: sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g==} - engines: {node: '>=8.2.1'} + cypress-intellij-reporter@0.0.7: + resolution: {integrity: sha512-P4A0BPz5h9TWLZFVhMJsAMktqCEdeKA0+bS+zfTGLohUtM89pmU5kAWLEGFOYRcRlVR39XbUWhyFyTjs8AoFLA==} + + cypress-multi-reporters@2.0.5: + resolution: {integrity: sha512-5ReXlNE7C/9/rpDI3z0tAJbPXsTHK7P3ogvUtBntQlmctRQ+sSMts7dIQY5MTb0XfBSge3CuwvNvaoqtw90KSQ==} + engines: {node: '>=6.0.0'} peerDependencies: - cypress: '>3.0.0' + mocha: '>=3.1.2' + + cypress-skip-and-only-ui@1.2.19: + resolution: {integrity: sha512-IP3JEXxRCGEgwRburoT7ar4FVhSf1WNIIDHs+eH7AdE09l9Qqnb9ucDOvGwDojxYy1kz/AGdnXOYPtDsu2DUmw==} + + cypress-wait-until@3.0.2: + resolution: {integrity: sha512-iemies796dD5CgjG5kV0MnpEmKSH+s7O83ZoJLVzuVbZmm4lheMsZqAVT73hlMx4QlkwhxbyUzhOBUOZwoOe0w==} - cypress@13.15.0: - resolution: {integrity: sha512-53aO7PwOfi604qzOkCSzNlWquCynLlKE/rmmpSPcziRH6LNfaDUAklQT6WJIsD8ywxlIy+uVZsnTMCCQVd2kTw==} - engines: {node: ^16.0.0 || ^18.0.0 || >=20.0.0} + cypress@14.0.0: + resolution: {integrity: sha512-kEGqQr23so5IpKeg/dp6GVi7RlHx1NmW66o2a2Q4wk9gRaAblLZQSiZJuDI8UMC4LlG5OJ7Q6joAiqTrfRNbTw==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true damerau-levenshtein@1.0.8: @@ -3929,6 +3968,10 @@ packages: supports-color: optional: true + decamelize@4.0.0: + resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} + engines: {node: '>=10'} + declare.js@0.0.8: resolution: {integrity: sha512-O659hy1gcHef7JnwtqdQlrj2c5DAEgtxm8pgFXofW7eUE1L4FjsSLlziovWcrOJAOFlEPaOJshY+0hBWCG/AnA==} @@ -4014,6 +4057,10 @@ packages: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} + diff@5.2.0: + resolution: {integrity: sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==} + engines: {node: '>=0.3.1'} + dns-packet@5.6.1: resolution: {integrity: sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==} engines: {node: '>=6'} @@ -4401,6 +4448,10 @@ packages: resolution: {integrity: sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==} engines: {'0': node >=0.6.0} + falafel@2.2.5: + resolution: {integrity: sha512-HuC1qF9iTnHDnML9YZAdCDQwT0yKl/U55K4XSUXqGAA2GLoafFgWRqdAbhWJxXaYD4pyoVxAJ8wH670jMpI9DQ==} + engines: {node: '>=0.4.0'} + fast-csv@2.5.0: resolution: {integrity: sha512-M/9ezLU9/uDwvDZTt9sNFJa0iLDUsbhYJwPtnE0D9MjeuB6DY9wRCyUPZta9iI6cSz5wBWGaUPL61QH8h92cNA==} engines: {node: '>=4.0.0'} @@ -4987,10 +5038,6 @@ packages: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} - is-ci@3.0.1: - resolution: {integrity: sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==} - hasBin: true - is-core-module@2.16.0: resolution: {integrity: sha512-urTSINYfAYgcbLb0yDQ6egFm6h3Mo1DcF9EkyXSRjjzdHbsulg01qhwWuXdOoUBuTkbQ80KDboXa0vFJ+BDH+g==} engines: {node: '>= 0.4'} @@ -5091,6 +5138,10 @@ packages: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} + is-plain-obj@2.1.0: + resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} + engines: {node: '>=8'} + is-plain-obj@3.0.0: resolution: {integrity: sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==} engines: {node: '>=10'} @@ -5607,6 +5658,10 @@ packages: resolution: {integrity: sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==} engines: {node: '>= 12.0.0'} + loose-envify@1.4.0: + resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} + hasBin: true + lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} @@ -5801,6 +5856,10 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + minimatch@8.0.4: resolution: {integrity: sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==} engines: {node: '>=16 || 14 >=14.17'} @@ -5861,6 +5920,11 @@ packages: engines: {node: '>=10'} hasBin: true + mocha@11.1.0: + resolution: {integrity: sha512-8uJR5RTC2NgpY3GrYcgpZrsEd9zKbPDpob1RezyR2upGHRQtHWofmzTMzTMSV6dru3tj5Ukt0+Vnq1qhFEEwAg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + hasBin: true + moment@2.30.1: resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} @@ -6503,6 +6567,9 @@ packages: resolution: {integrity: sha512-QfazNrhMakEdRG57IoYFwffUIr04LWJxbS/ZkidRFXYCQt63c1gK6Z7IHUXMx/Vh25WgPBU42oBaNzQ0K1R/xw==} engines: {npm: '>=8.2.3'} + ramda@0.29.1: + resolution: {integrity: sha512-OfxIeWzd4xdUNxlWhgFazxsA/nl3mS4/jGZI5n00uWOoSSFRhC1b6gl6xvmzUamgmqELraWp0J/qqVlXYPDPyA==} + randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} @@ -6514,6 +6581,15 @@ packages: resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==} engines: {node: '>= 0.8'} + react-dom@18.2.0: + resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} + peerDependencies: + react: ^18.2.0 + + react@18.2.0: + resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} + engines: {node: '>=0.10.0'} + read-installed-packages@2.0.1: resolution: {integrity: sha512-t+fJOFOYaZIjBpTVxiV8Mkt7yQyy4E6MSrrnt5FmPd4enYvpU/9DYGirDmN1XQwkfeuWIhM/iu0t2rm6iSr0CA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -6735,6 +6811,9 @@ packages: sax@1.4.1: resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==} + scheduler@0.23.2: + resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} + schema-utils@3.3.0: resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==} engines: {node: '>= 10.13.0'} @@ -7703,6 +7782,9 @@ packages: resolution: {integrity: sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg==} engines: {node: '>=12.17'} + workerpool@6.5.1: + resolution: {integrity: sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==} + wrap-ansi@6.2.0: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} engines: {node: '>=8'} @@ -7792,6 +7874,10 @@ packages: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} + yargs-unparser@2.0.0: + resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} + engines: {node: '>=10'} + yargs@16.2.0: resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} engines: {node: '>=10'} @@ -9149,6 +9235,13 @@ snapshots: tunnel-agent: 0.6.0 uuid: 8.3.2 + '@cypress/schematic@3.0.0(@angular/cli@18.2.7(chokidar@3.6.0))(@angular/core@18.2.7(rxjs@7.8.1)(zone.js@0.14.10))': + dependencies: + '@angular/cli': 18.2.7(chokidar@3.6.0) + '@angular/core': 18.2.7(rxjs@7.8.1)(zone.js@0.14.10) + jsonc-parser: 3.3.1 + rxjs: 7.8.1 + '@cypress/webpack-preprocessor@6.0.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(babel-loader@9.1.3(@babel/core@7.25.2)(webpack@5.95.0(esbuild@0.24.0)))(webpack@5.95.0(esbuild@0.24.0))': dependencies: '@babel/core': 7.25.2 @@ -10629,6 +10722,8 @@ snapshots: dependencies: acorn: 8.14.0 + acorn@7.4.1: {} + acorn@8.14.0: {} adjust-sourcemap-loader@4.0.0: @@ -10992,6 +11087,8 @@ snapshots: dependencies: fill-range: 7.1.1 + browser-stdout@1.3.1: {} + browserslist@4.24.3: dependencies: caniuse-lite: 1.0.30001689 @@ -11065,6 +11162,8 @@ snapshots: callsites@3.1.0: {} + camelcase@6.3.0: {} + caniuse-lite@1.0.30001689: {} canvas-datagrid@0.4.7: @@ -11124,7 +11223,7 @@ snapshots: chrome-trace-event@1.0.4: {} - ci-info@3.9.0: {} + ci-info@4.1.0: {} clean-stack@2.2.0: {} @@ -11483,11 +11582,29 @@ snapshots: custom-event@1.0.1: {} - cypress-file-upload@5.0.8(cypress@13.15.0): + cypress-intellij-reporter@0.0.7: + dependencies: + mocha: 11.1.0 + + cypress-multi-reporters@2.0.5(mocha@11.1.0): + dependencies: + debug: 4.4.0(supports-color@8.1.1) + lodash: 4.17.21 + mocha: 11.1.0 + semver: 7.6.3 + transitivePeerDependencies: + - supports-color + + cypress-skip-and-only-ui@1.2.19: dependencies: - cypress: 13.15.0 + falafel: 2.2.5 + ramda: 0.29.1 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + + cypress-wait-until@3.0.2: {} - cypress@13.15.0: + cypress@14.0.0: dependencies: '@cypress/request': 3.0.7 '@cypress/xvfb': 1.2.4(supports-color@8.1.1) @@ -11500,6 +11617,7 @@ snapshots: cachedir: 2.4.0 chalk: 4.1.2 check-more-types: 2.24.0 + ci-info: 4.1.0 cli-cursor: 3.1.0 cli-table3: 0.6.5 commander: 6.2.1 @@ -11514,7 +11632,6 @@ snapshots: figures: 3.2.0 fs-extra: 9.1.0 getos: 3.2.1 - is-ci: 3.0.1 is-installed-globally: 0.4.0 lazy-ass: 1.6.0 listr2: 3.14.0(enquirer@2.4.1) @@ -11529,6 +11646,7 @@ snapshots: semver: 7.6.3 supports-color: 8.1.1 tmp: 0.2.3 + tree-kill: 1.2.2 untildify: 4.0.0 yauzl: 2.10.0 @@ -11592,6 +11710,8 @@ snapshots: optionalDependencies: supports-color: 8.1.1 + decamelize@4.0.0: {} + declare.js@0.0.8: {} decompress-response@4.2.1: @@ -11656,6 +11776,8 @@ snapshots: diff@4.0.2: {} + diff@5.2.0: {} + dns-packet@5.6.1: dependencies: '@leichtgewicht/ip-codec': 2.0.5 @@ -12273,6 +12395,11 @@ snapshots: extsprintf@1.3.0: {} + falafel@2.2.5: + dependencies: + acorn: 7.4.1 + isarray: 2.0.5 + fast-csv@2.5.0: dependencies: extended: 0.0.6 @@ -12916,10 +13043,6 @@ snapshots: is-callable@1.2.7: {} - is-ci@3.0.1: - dependencies: - ci-info: 3.9.0 - is-core-module@2.16.0: dependencies: hasown: 2.0.2 @@ -12997,6 +13120,8 @@ snapshots: is-path-inside@3.0.3: {} + is-plain-obj@2.1.0: {} + is-plain-obj@3.0.0: {} is-plain-object@2.0.4: @@ -13612,6 +13737,10 @@ snapshots: safe-stable-stringify: 2.5.0 triple-beam: 1.4.1 + loose-envify@1.4.0: + dependencies: + js-tokens: 4.0.0 + lru-cache@10.4.3: {} lru-cache@5.1.1: @@ -13838,6 +13967,10 @@ snapshots: dependencies: brace-expansion: 1.1.11 + minimatch@5.1.6: + dependencies: + brace-expansion: 2.0.1 + minimatch@8.0.4: dependencies: brace-expansion: 2.0.1 @@ -13893,6 +14026,29 @@ snapshots: mkdirp@1.0.4: {} + mocha@11.1.0: + dependencies: + ansi-colors: 4.1.3 + browser-stdout: 1.3.1 + chokidar: 3.6.0 + debug: 4.4.0(supports-color@8.1.1) + diff: 5.2.0 + escape-string-regexp: 4.0.0 + find-up: 5.0.0 + glob: 10.4.5 + he: 1.2.0 + js-yaml: 4.1.0 + log-symbols: 4.1.0 + minimatch: 5.1.6 + ms: 2.1.3 + serialize-javascript: 6.0.2 + strip-json-comments: 3.1.1 + supports-color: 8.1.1 + workerpool: 6.5.1 + yargs: 17.7.2 + yargs-parser: 21.1.1 + yargs-unparser: 2.0.0 + moment@2.30.1: {} morgan@1.10.0: @@ -14573,6 +14729,8 @@ snapshots: parchment: 3.0.0 quill-delta: 5.1.0 + ramda@0.29.1: {} + randombytes@2.1.0: dependencies: safe-buffer: 5.2.1 @@ -14586,6 +14744,16 @@ snapshots: iconv-lite: 0.4.24 unpipe: 1.0.0 + react-dom@18.2.0(react@18.2.0): + dependencies: + loose-envify: 1.4.0 + react: 18.2.0 + scheduler: 0.23.2 + + react@18.2.0: + dependencies: + loose-envify: 1.4.0 + read-installed-packages@2.0.1: dependencies: '@npmcli/fs': 3.1.1 @@ -14849,6 +15017,10 @@ snapshots: sax@1.4.1: {} + scheduler@0.23.2: + dependencies: + loose-envify: 1.4.0 + schema-utils@3.3.0: dependencies: '@types/json-schema': 7.0.15 @@ -16034,6 +16206,8 @@ snapshots: wordwrapjs@5.1.0: {} + workerpool@6.5.1: {} + wrap-ansi@6.2.0: dependencies: ansi-styles: 4.3.0 @@ -16101,6 +16275,13 @@ snapshots: yargs-parser@21.1.1: {} + yargs-unparser@2.0.0: + dependencies: + camelcase: 6.3.0 + decamelize: 4.0.0 + flat: 5.0.2 + is-plain-obj: 2.1.0 + yargs@16.2.0: dependencies: cliui: 7.0.4 diff --git a/src/app/components/presentationals/user-menu/user-menu.presentational.html b/src/app/components/presentationals/user-menu/user-menu.presentational.html index 4237588df44f5a2fdfc96b144fbd1194fc1ce6c7..4bd3d149bbc749cd983aacafd5b75bf4ead77bba 100644 --- a/src/app/components/presentationals/user-menu/user-menu.presentational.html +++ b/src/app/components/presentationals/user-menu/user-menu.presentational.html @@ -1,4 +1,5 @@ <div [matMenuTriggerFor]="menu" + [solidifyDataTest]="dataTestEnum.linkUserMenu" class="avatar-wrapper" > <solidify-avatar [photoUser]="photoUser" diff --git a/src/app/enums/index.ts b/src/app/enums/index.ts index bc40f96dbaea46d3ddde70c37e678976490f09e8..8cff2f1b13455d6cd2cbab47325aaf84fec2c4ad 100644 --- a/src/app/enums/index.ts +++ b/src/app/enums/index.ts @@ -42,14 +42,16 @@ import {SubmissionPolicy as SubmissionPolicyPartial} from "@app/generated-api/mo import {LabelTranslateEnum} from "@shared/enums/label-translate.enum"; import {KeyValueInfo} from "@shared/models/key-value-info.model"; import { - ColorHexaEnum, - FacetNamePartialEnum, - HighlightJsLanguagePartialEnum, KeyValue, MARK_AS_TRANSLATABLE, StatusModel, StringUtil, -} from "solidify-frontend"; + ColorHexaEnum, +} from "solidify-frontend/src/lib/core-resources"; +import { + FacetNamePartialEnum, + HighlightJsLanguagePartialEnum, +} from "solidify-frontend/src/lib/core/enums"; import {Deposit as DepositPartial} from "../generated-api/model/deposit.partial.model"; import {DisseminationPolicy as DisseminationPolicyPartial} from "../generated-api/model/dissemination-policy.partial.model"; /* eslint-enable no-restricted-imports */ diff --git a/src/app/features/deposit/components/presentationals/deposit-form/deposit-form.presentational.html b/src/app/features/deposit/components/presentationals/deposit-form/deposit-form.presentational.html index 532c20209bb8285b68ded5f36fe4b7837d5a8311..e8053e15db7e11e1849856baad7365cf95ec062b 100644 --- a/src/app/features/deposit/components/presentationals/deposit-form/deposit-form.presentational.html +++ b/src/app/features/deposit/components/presentationals/deposit-form/deposit-form.presentational.html @@ -168,6 +168,7 @@ *ngIf="!readonly && personConnected && !personConnectedAlreadyInAuthor()" color="primary" mat-flat-button + [solidifyDataTest]="dataTestEnum.depositAddMeAsAuthor" solidifyShortCuts > <solidify-icon [iconName]="iconNameEnum.create"></solidify-icon> diff --git a/src/app/features/deposit/components/routables/deposit-create/deposit-create.routable.ts b/src/app/features/deposit/components/routables/deposit-create/deposit-create.routable.ts index 4260f5222f6ae08fb366d72e93115aa17ec05cf6..9418ef542ff20ea9d8120ff521f1caa5e2c68ba5 100644 --- a/src/app/features/deposit/components/routables/deposit-create/deposit-create.routable.ts +++ b/src/app/features/deposit/components/routables/deposit-create/deposit-create.routable.ts @@ -117,7 +117,7 @@ export class DepositCreateRoutable extends AbstractCreateRoutable<Deposit, Depos icon: IconNameEnum.save, labelToTranslate: (current) => LabelTranslateEnum.save, order: 40, - dataTest: DataTestEnum.save, + dataTest: DataTestEnum.depositSave, callback: () => this.formPresentational.onSubmit(), displayCondition: (resource) => true, disableCondition: () => this.formPresentational?.form?.pristine || this.formPresentational?.form?.invalid || this.formPresentational?.formFormly?.invalid, diff --git a/src/app/shared/enums/api-resource-name.enum.ts b/src/app/shared/enums/api-resource-name.enum.ts index 36569e4fa5b60472be7dde819d2e1c27f14e6519..fb4b050d89d7123695baadf6a1763a7537092d9d 100644 --- a/src/app/shared/enums/api-resource-name.enum.ts +++ b/src/app/shared/enums/api-resource-name.enum.ts @@ -21,7 +21,7 @@ * ----------------------------------------------------------------------------------------------%% */ -import {ApiResourceNamePartialEnum} from "solidify-frontend"; +import {ApiResourceNamePartialEnum} from "solidify-frontend/src/lib/core/enums"; enum ApiResourceNameExtendEnum { DEPOSIT = "deposits", diff --git a/src/app/shared/enums/data-test.enum.ts b/src/app/shared/enums/data-test.enum.ts index 2985a788173ad27aeea3160ec1fdba892091a605..610af5c1c2a6d03ae93a6522ecb760c8763f1e24 100644 --- a/src/app/shared/enums/data-test.enum.ts +++ b/src/app/shared/enums/data-test.enum.ts @@ -21,7 +21,7 @@ * ----------------------------------------------------------------------------------------------%% */ -import {DataTestPartialEnum} from "solidify-frontend"; +import {DataTestPartialEnum} from "solidify-frontend/src/lib/core-resources"; enum DataTestExtendEnum { // Auth @@ -30,6 +30,7 @@ enum DataTestExtendEnum { logoutMobileInput = "logout-mobile-input", // Link Angular Module + linkUserMenu = "link-user-menu", linkMenuDeposit = "link-menu-deposit", linkMenuAdmin = "link-menu-admin", linkMenuPreservationPlanning = "link-menu-preservation-planning", @@ -37,12 +38,6 @@ enum DataTestExtendEnum { linkMenuOrder = "link-menu-order", linkMenuHome = "link-menu-home", - // Main Button - back = "back", - create = "create", - save = "save", - delete = "delete", - // Home homeSearchInput = "home-search-input", homeDataTableSearch = "home-data-table-search", @@ -61,7 +56,7 @@ enum DataTestExtendEnum { depositPublicationDate = "deposit-publicationDate", depositAccessLevel = "deposit-accessLevel", depositDataSensitivity = "deposit-dataSensitivity", - depositAddMeAuthor = "deposit-addMeAuthor", + depositAddMeAsAuthor = "deposit-addMeAsAuthor", depositLanguage = "deposit-language", depositLicenseId = "deposit-licenseId", depositSubmissionPolicy = "deposit-submissionPolicy", @@ -69,6 +64,7 @@ enum DataTestExtendEnum { depositDataType = "deposit-data-type", depositFileDataTable = "deposit-file-data-table", depositDataCategory = "deposit-data-category", + depositSave = "deposit-save", // Preservation Space preservationSpaceTabOrgUnit = "preservationSpace-tab-orgUnit", diff --git a/src/app/shared/enums/label-translate.enum.ts b/src/app/shared/enums/label-translate.enum.ts index 0cb20448848c9f155054f48544ff8d25bc610122..19ed31aa37961c5da35246ed2d0a700992616022 100644 --- a/src/app/shared/enums/label-translate.enum.ts +++ b/src/app/shared/enums/label-translate.enum.ts @@ -21,7 +21,7 @@ * ----------------------------------------------------------------------------------------------%% */ -import {MARK_AS_TRANSLATABLE} from "solidify-frontend"; +import {MARK_AS_TRANSLATABLE} from "solidify-frontend/src/lib/core-resources"; export class LabelTranslateEnum { static back: string = MARK_AS_TRANSLATABLE("general.button.back"); diff --git a/src/app/shared/models/key-value-info.model.ts b/src/app/shared/models/key-value-info.model.ts index 8fa49cbf913833f82c8b6203e4710a4af1fd9283..852bb9b682bb045595c833967bcd3332a14f7ab5 100644 --- a/src/app/shared/models/key-value-info.model.ts +++ b/src/app/shared/models/key-value-info.model.ts @@ -21,7 +21,7 @@ * ----------------------------------------------------------------------------------------------%% */ -import {KeyValue} from "solidify-frontend"; +import {KeyValue} from "solidify-frontend/src/lib/core-resources"; export interface KeyValueInfo extends KeyValue { infoToTranslate?: string; diff --git a/src/assets/files-to-copy/cypress-environment.local.ts-to-copy.txt b/src/assets/files-to-copy/cypress-environment.local.ts-to-copy.txt index 9166c80bd94c50550913f28f2a884012bd7fc1a7..7e584bf25abf09de0ec37740052ad698359ed043 100644 --- a/src/assets/files-to-copy/cypress-environment.local.ts-to-copy.txt +++ b/src/assets/files-to-copy/cypress-environment.local.ts-to-copy.txt @@ -1,3 +1,26 @@ +/*- + * %%---------------------------------------------------------------------------------------------- + * DLCM Technology - DLCM Portal - cypress-environment.local.ts + * SPDX-License-Identifier: GPL-2.0-or-later + * %----------------------------------------------------------------------------------------------% + * Copyright (C) 2017 - 2025 University of Geneva + * %----------------------------------------------------------------------------------------------% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * ----------------------------------------------------------------------------------------------%% + */ + import {CypressEnvironmentModel} from "./cypress-environment.model"; export const cypressEnvironmentLocal: CypressEnvironmentModel | any = {