diff --git a/tests/cypress/integration/actions_organizations/case_113_new_organization_pipeline.js b/tests/cypress/integration/actions_organizations/case_113_new_organization_pipeline.js index 332ff280..fcde75a8 100644 --- a/tests/cypress/integration/actions_organizations/case_113_new_organization_pipeline.js +++ b/tests/cypress/integration/actions_organizations/case_113_new_organization_pipeline.js @@ -6,28 +6,35 @@ context('New organization pipeline.', () => { const caseId = '113'; + const firstUserName = 'Firstuser'; const secondUserName = 'Seconduser'; const thirdUserName = 'Thirduser'; - - const firstUser = { - firstName: `${firstUserName} fitstname`, - lastName: `${firstUserName} lastname`, - emailAddr: `${firstUserName.toLowerCase()}@local.local`, - password: 'UfdU21!dds', - }; - const secondUser = { - firstName: `${secondUserName} fitstname`, - lastName: `${secondUserName} lastname`, - emailAddr: `${secondUserName.toLowerCase()}@local.local`, - password: 'UfdU21!dds', - }; - const thirdUser = { - firstName: `${thirdUserName} fitstname`, - lastName: `${thirdUserName} lastname`, - emailAddr: `${thirdUserName.toLowerCase()}@local.local`, - password: 'Fv5Df3#f55g', + const users = { + thirdUser: { + name: thirdUserName, + firstName: `${thirdUserName} fitstname`, + lastName: `${thirdUserName} lastname`, + emailAddr: `${thirdUserName.toLowerCase()}@local.local`, + password: 'Fv5Df3#f55g', + }, + secondUser: { + name: secondUserName, + firstName: `${secondUserName} fitstname`, + lastName: `${secondUserName} lastname`, + emailAddr: `${secondUserName.toLowerCase()}@local.local`, + password: 'UfdU21!dds', + }, + firstUser: { + name: firstUserName, + firstName: `${firstUserName} fitstname`, + lastName: `${firstUserName} lastname`, + emailAddr: `${firstUserName.toLowerCase()}@local.local`, + password: 'UfdU21!dds', + }, }; + const { firstUser, secondUser, thirdUser } = users; + const organizationParams = { shortName: 'TestOrganization', fullName: 'Organization full name. Only for test.', @@ -94,34 +101,21 @@ context('New organization pipeline.', () => { cy.createZipArchive(directoryToArchive, archivePath); cy.logout(); - cy.goToRegisterPage(); - cy.userRegistration( - secondUser.firstName, - secondUser.lastName, - secondUserName, - secondUser.emailAddr, - secondUser.password, - ); - cy.logout(secondUserName); - - cy.goToRegisterPage(); - cy.userRegistration( - thirdUser.firstName, - thirdUser.lastName, - thirdUserName, - thirdUser.emailAddr, - thirdUser.password, - ); - cy.logout(thirdUserName); - - cy.goToRegisterPage(); - cy.userRegistration( - firstUser.firstName, - firstUser.lastName, - firstUserName, - firstUser.emailAddr, - firstUser.password, - ); + for (const user of Object.values(users)) { + // When we continuously register users, elements on login/register page become detached from DOM + // because of our re-renders after additional requests, waiting is workaround for this issue + // https://github.com/cypress-io/cypress/issues/7306 + cy.wait(1000); + cy.goToRegisterPage(); + cy.userRegistration( + user.firstName, + user.lastName, + user.name, + user.emailAddr, + user.password, + ); + if (user.name !== firstUserName) cy.logout(user.name); + } }); beforeEach(() => {