From 664baad639ac2cba679afec1633efe242a694c31 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Thu, 24 Aug 2023 18:17:10 +0300 Subject: [PATCH] tweak affiliation tests --- .../integration/retention/add-affiliation.js | 28 +++++++++---------- .../integration/retention/edit-affiliation.js | 4 +-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/gateway/cypress/integration/retention/add-affiliation.js b/gateway/cypress/integration/retention/add-affiliation.js index 883657dbf..c9d672210 100644 --- a/gateway/cypress/integration/retention/add-affiliation.js +++ b/gateway/cypress/integration/retention/add-affiliation.js @@ -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'); @@ -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() @@ -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( @@ -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]); @@ -116,7 +115,6 @@ 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, @@ -124,7 +122,7 @@ describe('Add and remove affiliation', () => { timeout: 600000, // time limit in ms delay: 30000 // delay before next iteration, ms } - ); + ); }); it('Confirm UI changes on the assertion page', () => { diff --git a/gateway/cypress/integration/retention/edit-affiliation.js b/gateway/cypress/integration/retention/edit-affiliation.js index 1b77a4bec..00276d04c 100644 --- a/gateway/cypress/integration/retention/edit-affiliation.js +++ b/gateway/cypress/integration/retention/edit-affiliation.js @@ -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,