From 2d7505e6a20cd339c19b657b57d39d88b78ecb19 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 22 May 2024 11:06:28 +0300 Subject: [PATCH] clean up tests --- ui/cypress/e2e/retention/restricted-access.cy.js | 12 ------------ ui/cypress/e2e/retention/ui-authorities.cy.js | 11 ----------- ui/cypress/e2e/retention/ui-pagination.cy.js | 10 ---------- ui/cypress/fixtures/editAffiliations.csv | 14 +++++++------- ui/cypress/support/commands.js | 6 +++--- 5 files changed, 10 insertions(+), 43 deletions(-) diff --git a/ui/cypress/e2e/retention/restricted-access.cy.js b/ui/cypress/e2e/retention/restricted-access.cy.js index e590e0c8f..2f6a38a8d 100644 --- a/ui/cypress/e2e/retention/restricted-access.cy.js +++ b/ui/cypress/e2e/retention/restricted-access.cy.js @@ -66,16 +66,4 @@ describe("Test restricted access", () => { .invoke("attr", "hidden") .should("not.exist"); }); - - /* it('Anonymous users cannot access anything', function() { - cy.visit('/assertion'); - cy.get('h1').filter('[data-cy="cannotProcessRequest"]').contains('Your request cannot be processed') - cy.get('div').filter('[data-cy="notAuthorized"]').invoke('attr', 'hidden').should('not.exist') - cy.visit('/user'); - cy.get('h1').filter('[data-cy="cannotProcessRequest"]').contains('Your request cannot be processed') - cy.get('div').filter('[data-cy="notAuthorized"]').invoke('attr', 'hidden').should('not.exist') - cy.visit('/member'); - cy.get('h1').filter('[data-cy="cannotProcessRequest"]').contains('Your request cannot be processed') - cy.get('div').filter('[data-cy="notAuthorized"]').invoke('attr', 'hidden').should('not.exist') - }); */ }); diff --git a/ui/cypress/e2e/retention/ui-authorities.cy.js b/ui/cypress/e2e/retention/ui-authorities.cy.js index 5ca44e3c7..173b11e16 100644 --- a/ui/cypress/e2e/retention/ui-authorities.cy.js +++ b/ui/cypress/e2e/retention/ui-authorities.cy.js @@ -365,15 +365,4 @@ describe("Test authorities", () => { // TODO: Awaiting endpoint changes cy.getAssertions(200); }); - - // TODO: enable once the issue with signed out users not being able to visit routes is fixed - it("Anonymous", function () { - cy.programmaticSignin(credentials.adminEmail, credentials.adminPassword); - cy.visit("ui/en/"); - cy.get("#admin-menu").should("not.exist"); - cy.get("#entity-menu").should("not.exist"); - cy.get("a").filter('[routerLink="/users"]').should("not.exist"); - cy.get("a").filter('[routerLink="/affiliations"]').should("not.exist"); - cy.get("a").filter('[routerLink="/members"]').should("not.exist"); - }); }); diff --git a/ui/cypress/e2e/retention/ui-pagination.cy.js b/ui/cypress/e2e/retention/ui-pagination.cy.js index 5a7c73bbe..20155e708 100644 --- a/ui/cypress/e2e/retention/ui-pagination.cy.js +++ b/ui/cypress/e2e/retention/ui-pagination.cy.js @@ -16,11 +16,6 @@ describe("Test pagination", () => { it('Test the "Manage users" page', function () { cy.visit("ui/en/users"); - /* - cy.get('.container-fluid').within(() => { - cy.get('p') - .contains('Showing 1 - 20 of 22 items') - })*/ cy.get("tbody").children().should("have.length", 20); cy.get(".pagination").contains("1"); cy.get(".pagination").contains("3").should("not.exist"); @@ -37,11 +32,6 @@ describe("Test pagination", () => { it('Test the "Affiliations" page', function () { cy.visit("ui/en/affiliations"); - /* - cy.get('.container-fluid').within(() => { - cy.get('p') - .contains('Showing 1 - 20 of 22 items') - })*/ cy.get("tbody").children().should("have.length", 20); cy.get(".pagination").contains("1"); cy.get(".pagination").contains("2"); diff --git a/ui/cypress/fixtures/editAffiliations.csv b/ui/cypress/fixtures/editAffiliations.csv index a5d31e664..63fec2d79 100644 --- a/ui/cypress/fixtures/editAffiliations.csv +++ b/ui/cypress/fixtures/editAffiliations.csv @@ -1,8 +1,8 @@ email,affiliation-section,department-name,role-title,start-date,end-date,org-name,org-country,org-city,org-region,disambiguation-source,disambiguated-organization-identifier,external-id,external-id-type,external-id-url,url,id -qa+mp_csv_populated_record@mailinator.com,INVITED_POSITION," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 "," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",AL," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,ROR,https://ror.org/04z60tq39,,,,,626bcaacadbe1d00081abab3 -qa+mp_csv_populated_record@mailinator.com,DISTINCTION," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 "," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",AL," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,ROR,https://ror.org/04z60tq39,,,,,626bcadbadbe1d00081abab4 -qa+mp_csv_populated_record@mailinator.com,MEMBERSHIP," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 "," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",AL," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,ROR,https://ror.org/04z60tq39,,,,,626bcaf3adbe1d00081abab5 -qa+mp_csv_populated_record@mailinator.com,SERVICE," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 "," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",AL," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,ROR,https://ror.org/04z60tq39,,,,,626bcb07adbe1d00081abab6 -qa+mp_csv_populated_record@mailinator.com,QUALIFICATION," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 "," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",AL," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,ROR,https://ror.org/04z60tq39,,,,,626bcb67adbe1d00081abab7 -qa+mp_csv_populated_record@mailinator.com,EMPLOYMENT," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 "," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",AL," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,ROR,https://ror.org/04z60tq39,,,,,626bcb7dadbe1d00081abab8 -qa+mp_csv_populated_record@mailinator.com,EDUCATION," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 "," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",AL," !@#$%^&*()-=_ 斯的 2024-05-20t16-45-52 ",,ROR,https://ror.org/04z60tq39,,,,,626bc955adbe1d00081abaaf +qa+mp_csv_populated_record@mailinator.com,INVITED_POSITION," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 "," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",AL," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,ROR,https://ror.org/04z60tq39,,,,,626bcaacadbe1d00081abab3 +qa+mp_csv_populated_record@mailinator.com,DISTINCTION," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 "," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",AL," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,ROR,https://ror.org/04z60tq39,,,,,626bcadbadbe1d00081abab4 +qa+mp_csv_populated_record@mailinator.com,MEMBERSHIP," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 "," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",AL," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,ROR,https://ror.org/04z60tq39,,,,,626bcaf3adbe1d00081abab5 +qa+mp_csv_populated_record@mailinator.com,SERVICE," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 "," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",AL," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,ROR,https://ror.org/04z60tq39,,,,,626bcb07adbe1d00081abab6 +qa+mp_csv_populated_record@mailinator.com,QUALIFICATION," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 "," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",AL," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,ROR,https://ror.org/04z60tq39,,,,,626bcb67adbe1d00081abab7 +qa+mp_csv_populated_record@mailinator.com,EMPLOYMENT," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 "," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",AL," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,ROR,https://ror.org/04z60tq39,,,,,626bcb7dadbe1d00081abab8 +qa+mp_csv_populated_record@mailinator.com,EDUCATION," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 "," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",AL," !@#$%^&*()-=_ 經航 2024-05-21t13-47-19 ",,ROR,https://ror.org/04z60tq39,,,,,626bc955adbe1d00081abaaf diff --git a/ui/cypress/support/commands.js b/ui/cypress/support/commands.js index c89dfb95a..d26b0618d 100644 --- a/ui/cypress/support/commands.js +++ b/ui/cypress/support/commands.js @@ -29,7 +29,7 @@ import credentials from "../fixtures/credentials.json"; import record from "../fixtures/orcid-record.json"; Cypress.Commands.add("signin", (email, password) => { - cy.visit("./"); + cy.visit("ui/en/"); cy.get("#username") .clear() .type(email) @@ -54,7 +54,7 @@ Cypress.Commands.add("programmaticSignin", (username, password) => { cy.getCookie("XSRF-TOKEN").then((csrfCookie) => { if (!csrfCookie) { return cy - .visit("/") + .visit("ui/en/") .getCookie("XSRF-TOKEN") .then(() => cy.programmaticSignin(username, password)); } else { @@ -161,7 +161,7 @@ Cypress.Commands.add("removeAffiliation", ($e) => { }); Cypress.Commands.add("changeOrgOwner", () => { - cy.visit(`/user/${data.member.users.owner.id}/edit`); + cy.visit(`ui/en/users/${data.member.users.owner.id}/edit`); cy.get("#field_mainContact").click(); cy.get("#save-entity").click(); cy.get(".alert-success").should("exist");