From a82754c43de9ad74e1deea01b5ad6634e1a1a7f4 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Thu, 26 Jan 2023 14:44:10 +0200 Subject: [PATCH 1/4] restore disabled sf id check --- gateway/cypress/integration/retention/edit-member.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gateway/cypress/integration/retention/edit-member.js b/gateway/cypress/integration/retention/edit-member.js index 852dbc8cf..1e65bee1a 100644 --- a/gateway/cypress/integration/retention/edit-member.js +++ b/gateway/cypress/integration/retention/edit-member.js @@ -10,8 +10,8 @@ describe('Manage members menu', () => { cy.get('#field_isConsortiumLead') .should('be.checked') .uncheck(); - // cy.get('#field_salesforceId').invoke('attr', 'disabled') - // .should('exist'); + cy.get('#field_salesforceId').invoke('attr', 'disabled') + .should('exist'); cy.get('#field_parentSalesforceId') .clear() .type(clientName); From fb80ead8f5f6267ee52002f6ce07e6c28a03b6f7 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Thu, 26 Jan 2023 15:20:11 +0200 Subject: [PATCH 2/4] check for invalid parent sf id --- .../integration/retention/edit-member.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gateway/cypress/integration/retention/edit-member.js b/gateway/cypress/integration/retention/edit-member.js index 1e65bee1a..b43cd8013 100644 --- a/gateway/cypress/integration/retention/edit-member.js +++ b/gateway/cypress/integration/retention/edit-member.js @@ -10,8 +10,9 @@ describe('Manage members menu', () => { cy.get('#field_isConsortiumLead') .should('be.checked') .uncheck(); - cy.get('#field_salesforceId').invoke('attr', 'disabled') - .should('exist'); + cy.get('#field_salesforceId') + .invoke('attr', 'disabled') + .should('exist'); cy.get('#field_parentSalesforceId') .clear() .type(clientName); @@ -54,6 +55,17 @@ describe('Manage members menu', () => { cy.get('#field_parentSalesforceId') .clear() .type(salesforceId); - cy.get('#save-entity').click(); + cy.get('#save-entity') + .invoke('attr', 'disabled') + .should('exist'); + + cy.get('#field_salesforceId') + .invoke('val') + .then(id => { + cy.get('#field_parentSalesforceId') + .clear() + .type(id); + cy.get('#save-entity').click(); + }); }); }); From 75c8fbab22786996db42b7c6f7857b25e11a3616 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Thu, 26 Jan 2023 16:27:27 +0200 Subject: [PATCH 3/4] adjust parent sf id check --- .../integration/retention/add-member.js | 145 ++++++++++-------- .../integration/retention/edit-member.js | 1 - .../integration/retention/ui-homepage.js | 2 +- 3 files changed, 79 insertions(+), 69 deletions(-) diff --git a/gateway/cypress/integration/retention/add-member.js b/gateway/cypress/integration/retention/add-member.js index 11d59e15d..2e4db291d 100644 --- a/gateway/cypress/integration/retention/add-member.js +++ b/gateway/cypress/integration/retention/add-member.js @@ -6,73 +6,84 @@ const { salesforceId, clientName, clientId } = data.member; describe('Test "Add member" functionality', () => { it('Add member', function() { cy.programmaticSignin(credentials.adminEmail, credentials.adminPassword); - cy.visit('/member/new'); - // Check required field flags - 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'); - // 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'); - // Enter existing salesforce id to generate an error - cy.get('#field_salesforceId').type(salesforceId); - 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(); - // Two error messages should appear for existing salesforce id and member name - cy.get('.validation-errors') + cy.visit('/member'); + cy.get('tbody') .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'); - // 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'); - // Check the enable assertions checkbox - 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') - .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); - // Save button should be clickable - cy.get('#save-entity') - .invoke('attr', 'disabled') - .should('not.exist'); + // Fetch existing salesforce id + .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'); + // Save button should be disabled + 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'); + // Enter existing salesforce id to generate an error + 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(); + // Two error messages should appear for existing salesforce id and member name + 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'); + // 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'); + // Check the enable assertions checkbox + 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') + .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); + // 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'); + }); }); }); diff --git a/gateway/cypress/integration/retention/edit-member.js b/gateway/cypress/integration/retention/edit-member.js index b43cd8013..a3002fae8 100644 --- a/gateway/cypress/integration/retention/edit-member.js +++ b/gateway/cypress/integration/retention/edit-member.js @@ -58,7 +58,6 @@ describe('Manage members menu', () => { cy.get('#save-entity') .invoke('attr', 'disabled') .should('exist'); - cy.get('#field_salesforceId') .invoke('val') .then(id => { diff --git a/gateway/cypress/integration/retention/ui-homepage.js b/gateway/cypress/integration/retention/ui-homepage.js index fd1f2cf9a..4ecdba8c0 100644 --- a/gateway/cypress/integration/retention/ui-homepage.js +++ b/gateway/cypress/integration/retention/ui-homepage.js @@ -28,7 +28,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://www.testtest.com") + cy.get('.side-bar').contains("http://www.testtest.com") cy.get('.side-bar').contains("No email added") cy.get('.main-section').contains("Consortium lead") cy.get('.main-section').contains("Mambo No 5") From af3decc384aa91960a6d0c4911772054cc477a5f Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Thu, 26 Jan 2023 16:30:04 +0200 Subject: [PATCH 4/4] fix url --- gateway/cypress/integration/retention/ui-homepage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gateway/cypress/integration/retention/ui-homepage.js b/gateway/cypress/integration/retention/ui-homepage.js index 4ecdba8c0..229abe797 100644 --- a/gateway/cypress/integration/retention/ui-homepage.js +++ b/gateway/cypress/integration/retention/ui-homepage.js @@ -28,7 +28,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("http://www.testtest.com") + cy.get('.side-bar').contains("http://testtest.com") cy.get('.side-bar').contains("No email added") cy.get('.main-section').contains("Consortium lead") cy.get('.main-section').contains("Mambo No 5")