diff --git a/ui/cypress/e2e/reset-test-data.cy.js b/ui/cypress/e2e/reset-test-data.cy.js index 10f2d29a1..ea7437460 100644 --- a/ui/cypress/e2e/reset-test-data.cy.js +++ b/ui/cypress/e2e/reset-test-data.cy.js @@ -13,7 +13,7 @@ describe("Add new user", () => { cy.visit("/assertion"); cy.get(".btn-group").each(($e) => { cy.wrap($e).children().last().click(); - cy.get("button").filter('[data-cy="confirmDeleteAssertion"]').click(); + cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click(); }); cy.visit("/user"); cy.get(".btn-group").each(($e) => { @@ -55,7 +55,7 @@ describe("Add new user", () => { cy.visit("/assertion"); cy.get(".btn-group").each(($e) => { cy.wrap($e).children().last().click(); - cy.get("button").filter('[data-cy="confirmDeleteAssertion"]').click(); + cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click(); }); cy.programmaticSignout(); }); @@ -68,7 +68,7 @@ describe("Add new user", () => { cy.visit("/assertion"); cy.get(".btn-group").each(($e) => { cy.wrap($e).children().last().click(); - cy.get("button").filter('[data-cy="confirmDeleteAssertion"]').click(); + cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click(); }); cy.programmaticSignout(); }); diff --git a/ui/cypress/e2e/retention/add-affiliation.cy.js b/ui/cypress/e2e/retention/add-affiliation.cy.js index 36b825f9a..051f19910 100644 --- a/ui/cypress/e2e/retention/add-affiliation.cy.js +++ b/ui/cypress/e2e/retention/add-affiliation.cy.js @@ -32,7 +32,7 @@ describe("Add and remove affiliation", () => { it("Add affiliation", function () { cy.programmaticSignin(data.member.users.owner.email, credentials.password); - cy.visit("/assertion/new"); + cy.visit("ui/en/affiliations/new"); cy.get("#field_email").type(record.invalidEmail); cy.get("small.text-danger").should("exist"); @@ -54,9 +54,7 @@ describe("Add and remove affiliation", () => { cy.get("#field_endYear").select(endDate.year); cy.get("#field_endMonth").select(endDate.month); cy.get("#field_endDay").select(endDate.day); - cy.get("small") - .filter('[jhitranslate="entity.validation.endDate.string"]') - .should("exist"); + cy.get("small").filter('[data-cy="invalidDateWarning"]').should("exist"); cy.get("#save-entity").invoke("attr", "disabled").should("exist"); cy.get("#field_startDay").select(startDate.day); cy.get("small").should("not.exist"); @@ -73,7 +71,7 @@ describe("Add and remove affiliation", () => { it("Grant permission and check ORCID record for added affiliation", () => { cy.programmaticSignin(data.member.users.owner.email, credentials.password); // Get permission link - cy.visit("/assertion"); + cy.visit("ui/en/affiliations"); cy.get("tbody").children().first().children().eq(0).contains(record.email); cy.get("tbody") .children() @@ -143,7 +141,7 @@ describe("Add and remove affiliation", () => { it("Confirm UI changes on the assertion page", () => { cy.programmaticSignin(data.member.users.owner.email, credentials.password); - cy.visit("/assertion"); + cy.visit("ui/en/affiliations"); cy.get("tbody").children().first().children().eq(1).contains(record.id); cy.get("tbody").children().first().children().eq(4).contains("In ORCID"); cy.programmaticSignout(); @@ -151,10 +149,10 @@ describe("Add and remove affiliation", () => { it("Delete affiliation", () => { cy.programmaticSignin(data.member.users.owner.email, credentials.password); - cy.visit("/assertion"); + cy.visit("ui/en/affiliations"); cy.get(".btn-group").each(($e) => { cy.wrap($e).children().last().click(); - cy.get("button").filter('[data-cy="confirmDeleteAssertion"]').click(); + cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click(); }); recurse( () => diff --git a/ui/cypress/e2e/retention/add-member.cy.js b/ui/cypress/e2e/retention/add-member.cy.js index 2e4db291d..697bafda7 100644 --- a/ui/cypress/e2e/retention/add-member.cy.js +++ b/ui/cypress/e2e/retention/add-member.cy.js @@ -1,89 +1,62 @@ /// -import data from '../../fixtures/test-data.json'; -import credentials from '../../fixtures/credentials.json'; +import data from "../../fixtures/test-data.json"; +import credentials from "../../fixtures/credentials.json"; const { salesforceId, clientName, clientId } = data.member; describe('Test "Add member" functionality', () => { - it('Add member', function() { + it("Add member", function () { cy.programmaticSignin(credentials.adminEmail, credentials.adminPassword); - cy.visit('/member'); - cy.get('tbody') + cy.visit("ui/en/members"); + cy.get("tbody") .children() // Fetch existing salesforce id - .first().children().first().then(existingSfId => { + .first() + .children() + .first() + .then((existingSfId) => { // Check required field flags - cy.visit('/member/new') - cy.get('#field_salesforceId').should('have.class', 'ng-invalid'); - cy.get('#field_clientName').should('have.class', 'ng-invalid'); + cy.visit("ui/en/members/new"); + cy.get("#field_salesforceId").should("have.class", "ng-invalid"); + cy.get("#field_clientName").should("have.class", "ng-invalid"); // Save button should be disabled - cy.get('#save-entity') - .invoke('attr', 'disabled') - .should('exist'); + cy.get("#save-entity").invoke("attr", "disabled").should("exist"); // Check salesforce id warning message when field is clear - cy.get('#field_salesforceId') - .type(salesforceId) - .clear(); - cy.get('small').should('exist'); - cy.get('#save-entity') - .invoke('attr', 'disabled') - .should('exist'); + cy.get("#field_salesforceId").type(salesforceId).clear(); + cy.get("small").should("exist"); + cy.get("#save-entity").invoke("attr", "disabled").should("exist"); // Enter existing salesforce id to generate an error - cy.get('#field_salesforceId').type(existingSfId.text()); - cy.get('#field_parentSalesforceId').type(clientName); + cy.get("#field_salesforceId").type(existingSfId.text()); + cy.get("#field_parentSalesforceId").type(clientName); // Enter invalid client name to generate an error - cy.get('#field_clientName') - .type(data.invalidString) - .clear(); - cy.get('small').should('exist'); - cy.get('#save-entity') - .invoke('attr', 'disabled') - .should('exist'); - cy.get('#field_clientName').type(data.populatedMember.clientName); - cy.get('#save-entity').click(); + cy.get("#field_clientName").type(data.invalidString).clear(); + cy.get("small").should("exist"); + cy.get("#save-entity").invoke("attr", "disabled").should("exist"); + cy.get("#field_clientName").type(data.populatedMember.clientName); + cy.get("#save-entity").click(); // Two error messages should appear for existing salesforce id and member name - cy.get('.validation-errors') - .children() - .should('have.length', 2); + cy.get(".validation-errors").children().should("have.length", 2); // Enter invalid client id to generate an error - cy.get('#field_clientId').type(data.invalidString); - cy.get('small').should('exist'); + cy.get("#field_clientId").type(data.invalidString); + cy.get("small").should("exist"); // Check for flag on client id input field - cy.get('#field_clientId').should('have.class', 'ng-invalid'); - cy.get('#save-entity') - .invoke('attr', 'disabled') - .should('exist'); + cy.get("#field_clientId").should("have.class", "ng-invalid"); + cy.get("#save-entity").invoke("attr", "disabled").should("exist"); // Check the enable assertions checkbox - cy.get('#field_assertionServiceEnabled').check(); - cy.get('#field_clientId') - .clear() - .type(clientId); - cy.get('#field_clientName') - .clear() - .type(clientName); + cy.get("#field_assertionServiceEnabled").check(); + cy.get("#field_clientId").clear().type(clientId); + cy.get("#field_clientName").clear().type(clientName); // Checkbox should be unchecked after clearing client id field - cy.get('#field_assertionServiceEnabled') - .should('not.be.checked') + cy.get("#field_assertionServiceEnabled") + .should("not.be.checked") .check(); // Parent salesforce id for consortium lead members must match salesforce id or be blank - cy.get('#field_isConsortiumLead') - .should('not.be.checked') - .check(); - cy.get('#save-entity') - .invoke('attr', 'disabled') - .should('exist'); - cy.get('#field_parentSalesforceId') - .clear() - .type(salesforceId); + cy.get("#field_isConsortiumLead").should("not.be.checked").check(); + cy.get("#save-entity").invoke("attr", "disabled").should("exist"); + cy.get("#field_parentSalesforceId").clear().type(salesforceId); // Save button should still be disabled due to invalid parent SF id - cy.get('#save-entity') - .invoke('attr', 'disabled') - .should('exist'); - cy.get('#field_parentSalesforceId') - .clear() - .type(existingSfId.text()); - cy.get('#save-entity') - .invoke('attr', 'disabled') - .should('not.exist'); + cy.get("#save-entity").invoke("attr", "disabled").should("exist"); + cy.get("#field_parentSalesforceId").clear().type(existingSfId.text()); + cy.get("#save-entity").invoke("attr", "disabled").should("not.exist"); }); }); }); diff --git a/ui/cypress/e2e/retention/add-user.cy.js b/ui/cypress/e2e/retention/add-user.cy.js index a848c3ec1..ac86e068a 100644 --- a/ui/cypress/e2e/retention/add-user.cy.js +++ b/ui/cypress/e2e/retention/add-user.cy.js @@ -6,7 +6,7 @@ describe("Add new user", () => { it("Add user", function () { // enter email cy.programmaticSignin(data.member.users.owner.email, credentials.password); - cy.visit("/user/new"); + cy.visit("ui/en/users/new"); // type in invalid email address cy.get("#field_email").type(data.invalidEmail); // type in name and surname @@ -64,7 +64,7 @@ describe("Add new user", () => { it("Remove added user", function () { cy.programmaticSignin(data.member.users.owner.email, credentials.password); - cy.visit("/user"); + cy.visit("ui/en/users"); cy.get(".btn-group").each(($e) => { cy.wrap($e) .children() diff --git a/ui/cypress/e2e/retention/notifications.cy.js b/ui/cypress/e2e/retention/notifications.cy.js index ffcdfdbeb..abcf36e1d 100644 --- a/ui/cypress/e2e/retention/notifications.cy.js +++ b/ui/cypress/e2e/retention/notifications.cy.js @@ -122,10 +122,10 @@ describe("Test notifications", () => { data.notificationsMember.users.owner.email, credentials.password, ); - cy.visit("/assertion"); + cy.visit("ui/en/affiliations"); cy.get(".btn-group").each(($e) => { cy.wrap($e).children().last().click(); - cy.get("button").filter('[data-cy="confirmDeleteAssertion"]').click(); + cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click(); }); cy.programmaticSignout(); }); diff --git a/ui/cypress/e2e/retention/reset-password.cy.js b/ui/cypress/e2e/retention/reset-password.cy.js index 0ad752bf1..314ad2cd7 100644 --- a/ui/cypress/e2e/retention/reset-password.cy.js +++ b/ui/cypress/e2e/retention/reset-password.cy.js @@ -40,7 +40,7 @@ describe("Test the password reset functionality", () => { cy.get("#currentPassword").type(credentials.wrongConfirmationPasssword); cy.processPasswordForm("#newPassword"); cy.get(".alert-danger") - .filter('data-cy="passwordChangeError"]') + .filter('[data-cy="passwordChangeError"]') .should("exist"); cy.get("#currentPassword").clear().type(credentials.password); cy.get("button").filter('[type="submit"]').click(); diff --git a/ui/cypress/e2e/retention/restricted-access.cy.js b/ui/cypress/e2e/retention/restricted-access.cy.js index 5a01abff7..e590e0c8f 100644 --- a/ui/cypress/e2e/retention/restricted-access.cy.js +++ b/ui/cypress/e2e/retention/restricted-access.cy.js @@ -17,7 +17,7 @@ describe("Test restricted access", () => { .filter('[data-cy="cannotProcessRequest"]') .contains("Your request cannot be processed"); cy.get("div") - .filter('[data-cy="notauthorized"]') + .filter('[data-cy="notAuthorized"]') .invoke("attr", "hidden") .should("not.exist"); }); @@ -32,7 +32,7 @@ describe("Test restricted access", () => { .filter('[data-cy="cannotProcessRequest"]') .contains("Your request cannot be processed"); cy.get("div") - .filter('[data-cy="notauthorized"]') + .filter('[data-cy="notAuthorized"]') .invoke("attr", "hidden") .should("not.exist"); }); @@ -47,7 +47,7 @@ describe("Test restricted access", () => { .filter('[data-cy="cannotProcessRequest"]') .contains("Your request cannot be processed"); cy.get("div") - .filter('[data-cy="notauthorized"]') + .filter('[data-cy="notAuthorized"]') .invoke("attr", "hidden") .should("not.exist"); }); @@ -62,7 +62,7 @@ describe("Test restricted access", () => { .filter('[data-cy="cannotProcessRequest"]') .contains("Your request cannot be processed"); cy.get("div") - .filter('[data-cy="notauthorized"]') + .filter('[data-cy="notAuthorized"]') .invoke("attr", "hidden") .should("not.exist"); }); @@ -70,12 +70,12 @@ describe("Test restricted access", () => { /* 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.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.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') + cy.get('div').filter('[data-cy="notAuthorized"]').invoke('attr', 'hidden').should('not.exist') }); */ }); diff --git a/ui/cypress/e2e/retention/ui-homepage.cy.js b/ui/cypress/e2e/retention/ui-homepage.cy.js index ac9da56d8..908ef8b23 100644 --- a/ui/cypress/e2e/retention/ui-homepage.cy.js +++ b/ui/cypress/e2e/retention/ui-homepage.cy.js @@ -55,7 +55,7 @@ describe("Test homepage", () => { cy.get(".side-bar").contains("Public details"); cy.get(".side-bar").contains("Website"); cy.get(".side-bar").contains("Email"); - cy.get(".side-bar").contains("https://orcid.org"); + cy.get(".side-bar").contains("No website added"); cy.get(".side-bar").contains("@orcid.org"); cy.get(".main-section").contains( "Consortium/Parent organization: Mambo No 5", @@ -63,7 +63,7 @@ describe("Test homepage", () => { cy.get(".main-section").first().contains("Membership:"); cy.get(".main-section").first().contains("Active"); cy.get(".main-section").contains("The Almond Forest"); - cy.get(".main-section").contains("Lorem ipsum"); + cy.get(".main-section").contains("Description"); cy.get(".main-section").contains("Contacts"); cy.get(".main-section").contains("Agreement signatory (OFFICIAL)"); cy.get(".main-section").contains("last@orcid.org"); @@ -102,9 +102,8 @@ describe("Test homepage", () => { cy.get(".side-bar").contains("www.haevesting.com"); cy.get(".side-bar").contains("hhh@hhh.com"); cy.get(".main-section").contains("Consortium lead"); - cy.get(".main-section").contains("Consortium Members (2)"); + cy.get(".main-section").contains("Consortium Members (1)"); cy.get(".main-section").contains("Member name"); - cy.get(".main-section").contains("Yellow member"); cy.get(".main-section").contains("The Harvest Ascendancy"); cy.get(".main-section").contains("Contacts"); cy.get(".main-section").contains("Product Contact"); diff --git a/ui/cypress/fixtures/test-data.json b/ui/cypress/fixtures/test-data.json index cd6cc5fca..54935cf04 100644 --- a/ui/cypress/fixtures/test-data.json +++ b/ui/cypress/fixtures/test-data.json @@ -3,7 +3,7 @@ "invalidEmail": "@test@email.com", "invalidWebsite": "orcid.org", "invalidString": "a", - "italianLanguageCode": "7: it", + "italianLanguageCode": "4: it", "outbox": { "email": "info@member-portal.qa.orcid.org", "updateEmail": "update@notify.orcid.org", diff --git a/ui/cypress/support/commands.js b/ui/cypress/support/commands.js index b86cc60c6..88c74aa83 100644 --- a/ui/cypress/support/commands.js +++ b/ui/cypress/support/commands.js @@ -104,7 +104,7 @@ Cypress.Commands.add("processPasswordForm", (newPasswordFieldId) => { .clear() .type(credentials.shortConfirmationPassword); // check for min length error messages - cy.get("small").filter('[data-cy="passwordTooShort"').should("exist"); + cy.get("small").filter('[data-cy="passwordTooShort"]').should("exist"); cy.get("small") .filter('[data-cy="confirmationPasswordTooShort"]') .should("exist"); @@ -134,7 +134,13 @@ Cypress.Commands.add("visitLinkFromEmail", (email) => { const href = htmlDom.querySelector( 'a[href*="https://member-portal.qa.orcid.org/reset/finish?key="]', ).href; - cy.visit(href); + // TODO: remove the replace bit when migrated + cy.visit( + href.replace( + "https://member-portal.qa.orcid.org/", + "https://member-portal.qa.orcid.org/ui/en/", + ), + ); }); Cypress.Commands.add("checkInbox", (subject, recipient, date) => { @@ -199,19 +205,10 @@ Cypress.Commands.add("fetchLinkAndGrantPermission", (email) => { .children() .last() .within(() => { - cy.get("a") - .filter( - '[jhitranslate="gatewayApp.assertionServiceAssertion.details.string"]', - ) - .click(); + cy.get("a").filter('[data-cy="viewDetailsButton"]').click(); }); cy.get(".jh-entity-details").within(() => - cy - .get("button") - .filter( - '[jhitranslate="gatewayApp.assertionServiceAssertion.copyClipboard.string"]', - ) - .click(), + cy.get("button").filter('[data-cy="copyToClipboard"]').click(), ); cy.task("getClipboard").then((link) => { cy.visit(link); diff --git a/ui/package-lock.json b/ui/package-lock.json index 1d91d30d4..bdc1493d4 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -24,6 +24,7 @@ "bootstrap": "^5.3.2", "clipboardy": "^2.3.0", "cypress-file-upload": "^5.0.8", + "cypress-recurse": "^1.35.3", "jsrsasign": "^11.1.0", "jsrsasign-util": "^1.0.5", "moment": "^2.29.4", @@ -7433,6 +7434,14 @@ "cypress": ">3.0.0" } }, + "node_modules/cypress-recurse": { + "version": "1.35.3", + "resolved": "https://registry.npmjs.org/cypress-recurse/-/cypress-recurse-1.35.3.tgz", + "integrity": "sha512-NbFOpEuZT4tFqAB0jQqel7WtVNDe8pvSHE2TfXvYk4pspf3wq98OC2RhhLn3bMnoCnPtY4IHO7e37c+CZ9HnMA==", + "dependencies": { + "humanize-duration": "^3.27.3" + } + }, "node_modules/cypress/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -10131,6 +10140,11 @@ "node": ">=10.17.0" } }, + "node_modules/humanize-duration": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/humanize-duration/-/humanize-duration-3.32.0.tgz", + "integrity": "sha512-6WsXYTHJr7hXKqoqf5zoWza/lANRAqGlbnZnm0cjDykbXuez1JVXOQGmq0EPB45pXYAJyueRA3S3hfhmMbrMEQ==" + }, "node_modules/humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -22623,6 +22637,14 @@ "integrity": "sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g==", "requires": {} }, + "cypress-recurse": { + "version": "1.35.3", + "resolved": "https://registry.npmjs.org/cypress-recurse/-/cypress-recurse-1.35.3.tgz", + "integrity": "sha512-NbFOpEuZT4tFqAB0jQqel7WtVNDe8pvSHE2TfXvYk4pspf3wq98OC2RhhLn3bMnoCnPtY4IHO7e37c+CZ9HnMA==", + "requires": { + "humanize-duration": "^3.27.3" + } + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -24530,6 +24552,11 @@ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true }, + "humanize-duration": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/humanize-duration/-/humanize-duration-3.32.0.tgz", + "integrity": "sha512-6WsXYTHJr7hXKqoqf5zoWza/lANRAqGlbnZnm0cjDykbXuez1JVXOQGmq0EPB45pXYAJyueRA3S3hfhmMbrMEQ==" + }, "humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", diff --git a/ui/package.json b/ui/package.json index 2ccd871a0..b2b4f2b3d 100644 --- a/ui/package.json +++ b/ui/package.json @@ -30,6 +30,7 @@ "bootstrap": "^5.3.2", "clipboardy": "^2.3.0", "cypress-file-upload": "^5.0.8", + "cypress-recurse": "^1.35.3", "jsrsasign": "^11.1.0", "jsrsasign-util": "^1.0.5", "moment": "^2.29.4", diff --git a/ui/src/app/affiliation/affiliation-delete.component.html b/ui/src/app/affiliation/affiliation-delete.component.html index eb04d5be6..0d7bddf1e 100644 --- a/ui/src/app/affiliation/affiliation-delete.component.html +++ b/ui/src/app/affiliation/affiliation-delete.component.html @@ -3,7 +3,7 @@ -
- + Start date cannot be greater than the end date
diff --git a/ui/src/app/affiliation/affiliations.component.html b/ui/src/app/affiliation/affiliations.component.html index d7b8f44ec..d0f2ca79b 100644 --- a/ui/src/app/affiliation/affiliations.component.html +++ b/ui/src/app/affiliation/affiliations.component.html @@ -187,6 +187,7 @@

View details