Skip to content

Commit

Permalink
Merge pull request #1241 from ORCID/fix-cypress-tests
Browse files Browse the repository at this point in the history
change base url in cypress tests
  • Loading branch information
bobcaprice authored Aug 7, 2024
2 parents 536d5ef + 5a6eade commit 5218052
Show file tree
Hide file tree
Showing 20 changed files with 58 additions and 60 deletions.
10 changes: 5 additions & 5 deletions ui/cypress/e2e/reset-test-data.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ describe("Add new user", () => {

it("Remove all affiliations from test group", function () {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
cy.visit("ui/en/affiliations");
cy.visit("en/affiliations");
cy.get(".btn-group").each(($e) => {
cy.wrap($e).children().last().click();
cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click();
});
cy.visit("ui/en/users");
cy.visit("en/users");
cy.get(".btn-group").each(($e) => {
cy.wrap($e)
.children()
Expand All @@ -32,7 +32,7 @@ describe("Add new user", () => {

it("Remove all affiliations from test member", function () {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
cy.visit("ui/en/users");
cy.visit("en/users");
cy.get(".btn-group").each(($e) => {
cy.wrap($e)
.children()
Expand All @@ -52,7 +52,7 @@ describe("Add new user", () => {
data.csvMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/affiliations");
cy.visit("en/affiliations");
cy.get(".btn-group").each(($e) => {
cy.wrap($e).children().last().click();
cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click();
Expand All @@ -65,7 +65,7 @@ describe("Add new user", () => {
data.notificationsMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/affiliations");
cy.visit("en/affiliations");
cy.get(".btn-group").each(($e) => {
cy.wrap($e).children().last().click();
cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click();
Expand Down
8 changes: 4 additions & 4 deletions ui/cypress/e2e/retention/add-affiliation.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("Add and remove affiliation", () => {

it("Add affiliation", function () {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
cy.visit("ui/en/affiliations/new");
cy.visit("en/affiliations/new");

cy.get("#field_email").type(record.invalidEmail);
cy.get("small.text-danger").should("exist");
Expand Down Expand Up @@ -71,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("ui/en/affiliations");
cy.visit("en/affiliations");
cy.get("tbody").children().first().children().eq(0).contains(record.email);
cy.get("tbody")
.children()
Expand Down Expand Up @@ -141,15 +141,15 @@ describe("Add and remove affiliation", () => {

it("Confirm UI changes on the assertion page", () => {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
cy.visit("ui/en/affiliations");
cy.visit("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();
});

it("Delete affiliation", () => {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
cy.visit("ui/en/affiliations");
cy.visit("en/affiliations");
cy.get(".btn-group").each(($e) => {
cy.wrap($e).children().last().click();
cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click();
Expand Down
4 changes: 2 additions & 2 deletions ui/cypress/e2e/retention/add-member.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { salesforceId, clientName, clientId } = data.member;
describe('Test "Add member" functionality', () => {
it("Add member", function () {
cy.programmaticSignin(credentials.adminEmail, credentials.adminPassword);
cy.visit("ui/en/members");
cy.visit("en/members");
cy.get("tbody")
.children()
// Fetch existing salesforce id
Expand All @@ -15,7 +15,7 @@ describe('Test "Add member" functionality', () => {
.first()
.then((existingSfId) => {
// Check required field flags
cy.visit("ui/en/members/new");
cy.visit("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
Expand Down
4 changes: 2 additions & 2 deletions ui/cypress/e2e/retention/add-user.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("ui/en/users/new");
cy.visit("en/users/new");
// type in invalid email address
cy.get("#field_email").type(data.invalidEmail);
// type in name and surname
Expand Down Expand Up @@ -62,7 +62,7 @@ describe("Add new user", () => {

it("Remove added user", function () {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
cy.visit("ui/en/users");
cy.visit("en/users");
cy.get(".btn-group").each(($e) => {
cy.wrap($e)
.children()
Expand Down
2 changes: 1 addition & 1 deletion ui/cypress/e2e/retention/csv-add-affiliations.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("Test adding affiliations via CSV", () => {
data.csvMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/affiliations/");
cy.visit("en/affiliations/");
});

it("Upload CSV and check inbox for the confirmation email", function () {
Expand Down
2 changes: 1 addition & 1 deletion ui/cypress/e2e/retention/csv-edit-affiliations.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Test updating affiliations via CSV", () => {
data.csvPopulatedMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/affiliations/");
cy.visit("en/affiliations/");
});

it("Edit the contents of the existing CSV file", function () {
Expand Down
2 changes: 1 addition & 1 deletion ui/cypress/e2e/retention/csv-invalid-affiliations.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Test invalid CSV upload", () => {
data.csvMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/affiliations/");
cy.visit("en/affiliations/");
cy.uploadCsv("../fixtures/invalidAffiliations.csv");
cy.task("checkInbox", {
subject: data.outbox.csvUpload,
Expand Down
6 changes: 3 additions & 3 deletions ui/cypress/e2e/retention/edit-affiliation.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ describe("Edit an affiliation", () => {
);
});
it("Edit affiliation in the member portal", function () {
cy.visit("ui/en/affiliations");
cy.visit(`ui/en/affiliations/${record.affiliation.id}/edit`);
cy.visit("en/affiliations");
cy.visit(`en/affiliations/${record.affiliation.id}/edit`);

cy.get("#field_orgName").clear().type(testString);
cy.get("#field_orgCity").clear().type(testString);
Expand Down Expand Up @@ -56,7 +56,7 @@ describe("Edit an affiliation", () => {
delay: 30000, // delay before next iteration, ms
},
);
cy.visit("ui/en/affiliations/");
cy.visit("en/affiliations/");
cy.get("tbody").children().first().children().eq(4).contains("In ORCID");
});
});
2 changes: 1 addition & 1 deletion ui/cypress/e2e/retention/edit-member.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { salesforceId, clientName, clientId } = data.member;
describe("Manage members menu", () => {
it("Test edit member form", function () {
cy.programmaticSignin(credentials.adminEmail, credentials.adminPassword);
cy.visit(`ui/en/members/${data.member.id}/edit`);
cy.visit(`en/members/${data.member.id}/edit`);
cy.get("#field_isConsortiumLead").should("be.checked").uncheck();
cy.get("#field_salesforceId").invoke("attr", "disabled").should("exist");
cy.get("#field_parentSalesforceId").clear().type(clientName);
Expand Down
2 changes: 1 addition & 1 deletion ui/cypress/e2e/retention/edit-user.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Test the edit user form", () => {
data.populatedMember.users.owner.email,
credentials.password,
);
cy.visit(`ui/en/users/${data.populatedMember.users.owner.id}/edit`);
cy.visit(`en/users/${data.populatedMember.users.owner.id}/edit`);
// Clear first name input field
cy.get("#field_firstName").clear();
// Shouldn't be possible to save with an empty name field
Expand Down
8 changes: 4 additions & 4 deletions ui/cypress/e2e/retention/notifications.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Test notifications", () => {
data.notificationsMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/affiliations/new");
cy.visit("en/affiliations/new");
cy.get("#field_email").type(record.nonregisteredEmail);
cy.get("#field_affiliationSection").select(type);
cy.get("#field_orgName").type(data.testString);
Expand All @@ -30,7 +30,7 @@ describe("Test notifications", () => {
data.notificationsMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/affiliations/new");
cy.visit("en/affiliations/new");
cy.get("#field_email").type(record.email);
cy.get("#field_affiliationSection").select(type);
cy.get("#field_orgName").type(data.testString + " 2");
Expand All @@ -40,7 +40,7 @@ describe("Test notifications", () => {
cy.get("#field_disambiguatedOrgId").type(ror.id);
cy.get("#save-entity").click();
cy.get(".alert-success").should("exist");
cy.visit("ui/en/affiliations");
cy.visit("en/affiliations");
cy.get("button").filter('[data-cy="sendNotifications"]').click();
cy.get("#langKey").should("have.value", data.italianLanguageCode);
cy.get("button").filter('[data-cy="confirmCsvUpload"]').click();
Expand Down Expand Up @@ -122,7 +122,7 @@ describe("Test notifications", () => {
data.notificationsMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/affiliations");
cy.visit("en/affiliations");
cy.get(".btn-group").each(($e) => {
cy.wrap($e).children().last().click();
cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click();
Expand Down
4 changes: 2 additions & 2 deletions ui/cypress/e2e/retention/reset-password.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import credentials from "../../fixtures/credentials.json";

describe("Test the password reset functionality", () => {
it("Forgot your password?", function () {
cy.visit("ui/en/reset/request");
cy.visit("en/reset/request");
cy.get("#email").type(data.invalidEmail);
cy.get("small").filter('[data-cy="emailInvalid"]').should("exist");
cy.get("button")
Expand Down Expand Up @@ -34,7 +34,7 @@ describe("Test the password reset functionality", () => {
data.populatedMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/password");
cy.visit("en/password");
cy.get("#currentPassword").type(credentials.wrongConfirmationPasssword);
cy.processPasswordForm("#newPassword");
cy.get(".alert-danger")
Expand Down
8 changes: 4 additions & 4 deletions ui/cypress/e2e/retention/restricted-access.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Test restricted access", () => {
data.populatedMember.users.user.email,
credentials.password,
);
cy.visit("ui/en/members");
cy.visit("en/members");
cy.get("h1")
.filter('[data-cy="cannotProcessRequest"]')
.contains("Your request cannot be processed");
Expand All @@ -27,7 +27,7 @@ describe("Test restricted access", () => {
data.populatedMember.users.user.email,
credentials.password,
);
cy.visit("ui/en/users");
cy.visit("en/users");
cy.get("h1")
.filter('[data-cy="cannotProcessRequest"]')
.contains("Your request cannot be processed");
Expand All @@ -42,7 +42,7 @@ describe("Test restricted access", () => {
data.populatedMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/members");
cy.visit("en/members");
cy.get("h1")
.filter('[data-cy="cannotProcessRequest"]')
.contains("Your request cannot be processed");
Expand All @@ -57,7 +57,7 @@ describe("Test restricted access", () => {
data.homepageTestMembers.consortiumLeadAndMember.email,
credentials.password,
);
cy.visit("ui/en/affiliations");
cy.visit("en/affiliations");
cy.get("h1")
.filter('[data-cy="cannotProcessRequest"]')
.contains("Your request cannot be processed");
Expand Down
8 changes: 4 additions & 4 deletions ui/cypress/e2e/retention/ui-authorities.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("Test authorities", () => {
data.populatedMember.users.user.email,
credentials.password,
);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("#admin-menu").should("not.exist");
cy.get("#entity-menu").should("exist");
cy.get("a").filter('[routerLink="/affiliations"]').should("exist");
Expand Down Expand Up @@ -113,7 +113,7 @@ describe("Test authorities", () => {
data.populatedMember.users.owner.email,
credentials.password,
);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("#admin-menu").should("exist");
cy.get("#entity-menu").should("exist");
cy.get("a").filter('[routerlink="/users"]').should("exist");
Expand Down Expand Up @@ -203,7 +203,7 @@ describe("Test authorities", () => {

it("Admin", function () {
cy.programmaticSignin(credentials.adminEmail, credentials.adminPassword);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("#admin-menu").should("exist");
cy.get("#entity-menu").should("exist");
cy.get("a").filter('[routerlink="/users"]').should("exist");
Expand Down Expand Up @@ -289,7 +289,7 @@ describe("Test authorities", () => {
data.homepageTestMembers.consortiumLeadAndMember.email,
credentials.password,
);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("#admin-menu").should("not.exist");
cy.get("#entity-menu").should("not.exist");
cy.get("a").filter('[routerlink="/users"]').should("not.exist");
Expand Down
6 changes: 3 additions & 3 deletions ui/cypress/e2e/retention/ui-homepage-edit.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ describe("Test editing member details", () => {
it("Editing Almonds Forest member details", function () {
const date = Date.now();
cy.programmaticSignin(email, credentials.password);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("app-member-info").contains(date).should("not.exist");
cy.visit("ui/en/edit");
cy.visit("en/edit");
cy.get(".text-danger").should("not.exist");
// wait for data to load
cy.intercept(
Expand Down Expand Up @@ -70,7 +70,7 @@ describe("Test editing member details", () => {
cy.get("app-member-info").contains(
`YES - ORCID can use trademarked assets`,
);
cy.visit("ui/en/edit");
cy.visit("en/edit");
// wait for data to load
cy.intercept(
`/services/memberservice/api/members/${data.homepageTestMembers.consortiumMember.salesforceId}/member-contacts`,
Expand Down
12 changes: 6 additions & 6 deletions ui/cypress/e2e/retention/ui-homepage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Test homepage", () => {
data.homepageTestMembers.directMemberEmail,
credentials.password,
);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("app-member-info", { timeout: 20000 });
cy.get(".side-bar").contains("Public details");
cy.get(".side-bar").contains("Website");
Expand All @@ -28,7 +28,7 @@ describe("Test homepage", () => {
data.homepageTestMembers.consortiumLeadEmail,
credentials.password,
);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("app-member-info", { timeout: 20000 });
cy.get(".side-bar").contains("Public details");
cy.get(".side-bar").contains("Website");
Expand All @@ -50,7 +50,7 @@ describe("Test homepage", () => {
data.homepageTestMembers.consortiumMember.email,
credentials.password,
);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("app-member-info", { timeout: 20000 });
cy.get(".side-bar").contains("Public details");
cy.get(".side-bar").contains("Website");
Expand All @@ -74,7 +74,7 @@ describe("Test homepage", () => {
data.homepageTestMembers.consortiumMemberEmail2,
credentials.password,
);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("app-member-info", { timeout: 20000 });
cy.get(".side-bar").contains("Public details");
cy.get(".side-bar").contains("Website");
Expand All @@ -94,7 +94,7 @@ describe("Test homepage", () => {
data.homepageTestMembers.consortiumLeadAndMember.email,
credentials.password,
);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("app-member-info", { timeout: 20000 });
cy.get(".side-bar").contains("Public details");
cy.get(".side-bar").contains("Website");
Expand All @@ -115,7 +115,7 @@ describe("Test homepage", () => {
data.homepageTestMembers.inactiveConsortiumMemberEmail,
credentials.password,
);
cy.visit("ui/en/");
cy.visit("en/");
cy.get("app-member-info", { timeout: 20000 }).contains(
"Something has gone wrong...",
);
Expand Down
2 changes: 1 addition & 1 deletion ui/cypress/e2e/retention/ui-login.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import credentials from "../../fixtures/credentials.json";

describe("Test sign in form", () => {
it("Sign in", function () {
cy.visit(`ui/en/`);
cy.visit(`en/`);
cy.get("#username").clear().type(data.member.users.owner.email);
cy.get("#password").type(credentials.password);
cy.get("button").filter('[type="submit"]').click();
Expand Down
Loading

0 comments on commit 5218052

Please sign in to comment.