Skip to content

Commit

Permalink
Merge pull request #1033 from ORCID/tweak-affiliation-tests
Browse files Browse the repository at this point in the history
tweak affiliation tests
  • Loading branch information
amontenegro authored Aug 24, 2023
2 parents 381a399 + 664baad commit 7033975
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
28 changes: 13 additions & 15 deletions gateway/cypress/integration/retention/add-affiliation.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ const months = {
const { country, countryCode, url, invalidUrl, startDate, endDate, type } = record.affiliation;
const { ringgold, grid, ror } = record.affiliation.org;
describe('Add and remove affiliation', () => {
/* beforeEach(() => {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
});
/* beforeEach(() => {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
});
afterEach(() => {
cy.programmaticSignout();
});*/

afterEach(() => {
cy.programmaticSignout();
});*/

it('Add affiliation', function() {
it('Add affiliation', function () {
cy.programmaticSignin(data.member.users.owner.email, credentials.password);
cy.visit('/assertion/new');

Expand Down Expand Up @@ -67,7 +67,7 @@ describe('Add and remove affiliation', () => {
cy.get('.alerts')
.children()
.should('have.length', 1);

cy.get('#save-entity').click();
cy.get('.alerts')
.children()
Expand All @@ -89,7 +89,7 @@ describe('Add and remove affiliation', () => {
cy.get('tbody').children().first().children().eq(1).should('not.contain', record.id);
cy.get('tbody').children().first().children().eq(2).contains(record.affiliation.type);
cy.get('tbody').children().first().children().eq(4).contains('Pending');

cy.fetchLinkAndGrantPermission(record.email);

recurse(
Expand All @@ -103,10 +103,9 @@ describe('Add and remove affiliation', () => {
expect(res.body['affiliation-group']).to.have.length(1);
expect(service['department-name']).to.eq(data.testString);
expect(service['role-title']).to.eq(data.testString);
expect(service['organization']['address']['city']).to.eq(data.testString);
expect(service['organization']['address']['city']).to.eq(data.testString.trim());
expect(service['organization']['address']['country']).to.eq(countryCode);
expect(service['organization']['name']).to.eq(data.testString);
expect(service['department-name']).to.eq(data.testString);
expect(service['organization']['name']).to.eq(data.testString.trim());
expect(service['url']['value']).to.eq(url);
expect(service['start-date']['year']['value']).to.eq(startDate.year);
expect(service['start-date']['month']['value']).to.eq(months[startDate.month]);
Expand All @@ -116,15 +115,14 @@ describe('Add and remove affiliation', () => {
expect(service['end-date']['day']['value']).to.eq(endDate.day);
expect(service['organization']['disambiguated-organization']['disambiguated-organization-identifier']).to.eq(ror.id);
expect(service['organization']['disambiguated-organization']['disambiguation-source']).to.eq(ror.name);
expect(service['department-name']).to.eq(data.testString);
},
{
log: true,
limit: 20, // max number of iterations
timeout: 600000, // time limit in ms
delay: 30000 // delay before next iteration, ms
}
);
);
});

it('Confirm UI changes on the assertion page', () => {
Expand Down
4 changes: 2 additions & 2 deletions gateway/cypress/integration/retention/edit-affiliation.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ describe('Edit an affiliation', () => {
expect(res.body['affiliation-group']).to.have.length(1);
expect(education['department-name']).to.eq(testString);
expect(education['role-title']).to.eq(testString);
expect(education['organization']['address']['city']).to.eq(testString);
expect(education['organization']['name']).to.eq(testString);
expect(education['organization']['address']['city']).to.eq(testString.trim());
expect(education['organization']['name']).to.eq(testString.trim());
},
{
log: true,
Expand Down

0 comments on commit 7033975

Please sign in to comment.