Skip to content

Commit

Permalink
Merge pull request #1186 from ORCID/fix-more-cy-tests
Browse files Browse the repository at this point in the history
fix more tests
  • Loading branch information
bobcaprice authored May 15, 2024
2 parents 7874748 + b49a890 commit e472af6
Show file tree
Hide file tree
Showing 26 changed files with 1,258 additions and 879 deletions.
118 changes: 68 additions & 50 deletions ui/cypress/e2e/reset-test-data.cy.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,75 @@
/// <reference types="cypress" />
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";

describe('Add new user', () => {
it('Reset organization owner', () => {
cy.programmaticSignin(credentials.adminEmail, credentials.adminPassword)
cy.changeOrgOwner()
})
describe("Add new user", () => {
it("Reset organization owner", () => {
cy.programmaticSignin(credentials.adminEmail, credentials.adminPassword);
cy.changeOrgOwner();
});

it('Remove all affiliations from test group', function () {
cy.programmaticSignin(data.member.users.owner.email, credentials.password)
cy.visit('/assertion')
cy.get('.btn-group').each($e => {
cy.wrap($e).children().last().click()
cy.get('#jhi-confirm-delete-assertion').click()
})
cy.visit('/user')
cy.get('.btn-group').each($e => {
cy.wrap($e).children().last().invoke('attr', 'disabled').then((disabled) => {
disabled ? cy.log("Skipping user, button is disabled") : cy.removeAffiliation($e)
})
})
cy.programmaticSignout()
})
it("Remove all affiliations from test group", function () {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
cy.visit("/assertion");
cy.get(".btn-group").each(($e) => {
cy.wrap($e).children().last().click();
cy.get("button").filter('[data-cy="confirmDeleteAssertion"]').click();
});
cy.visit("/user");
cy.get(".btn-group").each(($e) => {
cy.wrap($e)
.children()
.last()
.invoke("attr", "disabled")
.then((disabled) => {
disabled
? cy.log("Skipping user, button is disabled")
: cy.removeAffiliation($e);
});
});
cy.programmaticSignout();
});

it('Remove all affiliations from test member', function () {
cy.programmaticSignin(data.member.users.owner.email, credentials.password)
cy.visit('/user')
cy.get('.btn-group').each($e => {
cy.wrap($e).children().last().invoke('attr', 'disabled').then((disabled) => {
disabled ? cy.log("Skipping user, button is disabled") : cy.removeAffiliation($e)
})
})
cy.programmaticSignout()
})
it("Remove all affiliations from test member", function () {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
cy.visit("/user");
cy.get(".btn-group").each(($e) => {
cy.wrap($e)
.children()
.last()
.invoke("attr", "disabled")
.then((disabled) => {
disabled
? cy.log("Skipping user, button is disabled")
: cy.removeAffiliation($e);
});
});
cy.programmaticSignout();
});

it('Remove all affiliations from csv test member', function () {
cy.programmaticSignin(data.csvMember.users.owner.email, credentials.password)
cy.visit('/assertion')
cy.get('.btn-group').each($e => {
cy.wrap($e).children().last().click()
cy.get('#jhi-confirm-delete-assertion').click()
})
cy.programmaticSignout()
})
it("Remove all affiliations from csv test member", function () {
cy.programmaticSignin(
data.csvMember.users.owner.email,
credentials.password,
);
cy.visit("/assertion");
cy.get(".btn-group").each(($e) => {
cy.wrap($e).children().last().click();
cy.get("button").filter('[data-cy="confirmDeleteAssertion"]').click();
});
cy.programmaticSignout();
});

it('Remove all affiliations from the notifications member', function() {
cy.programmaticSignin(data.notificationsMember.users.owner.email, credentials.password);
cy.visit('/assertion')
cy.get('.btn-group').each($e => {
cy.wrap($e).children().last().click()
cy.get('#jhi-confirm-delete-assertion').click()
})
cy.programmaticSignout()
it("Remove all affiliations from the notifications member", function () {
cy.programmaticSignin(
data.notificationsMember.users.owner.email,
credentials.password,
);
cy.visit("/assertion");
cy.get(".btn-group").each(($e) => {
cy.wrap($e).children().last().click();
cy.get("button").filter('[data-cy="confirmDeleteAssertion"]').click();
});
cy.programmaticSignout();
});
})
});
Loading

0 comments on commit e472af6

Please sign in to comment.