From 133f81d89378adbb3ec786ac541d0137b58a3ec8 Mon Sep 17 00:00:00 2001 From: Alejandro Brugarolas <117646518+abrugaro@users.noreply.github.com> Date: Fri, 17 Nov 2023 17:14:46 +0100 Subject: [PATCH] [RFR] [JF] Adapt migration waves crud test (#818) * adapt migration waves crud test Signed-off-by: Alejandro Brugarolas * fix stakeholder-group interlinked test Signed-off-by: Alejandro Brugarolas --------- Signed-off-by: Alejandro Brugarolas --- .../stakeholdergroups/interlinked.test.ts | 44 +++++++------------ .../migration/migration-waves/crud.test.ts | 2 +- 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/cypress/e2e/tests/migration/controls/stakeholdergroups/interlinked.test.ts b/cypress/e2e/tests/migration/controls/stakeholdergroups/interlinked.test.ts index 52fb7c2c5..bae46fb9a 100644 --- a/cypress/e2e/tests/migration/controls/stakeholdergroups/interlinked.test.ts +++ b/cypress/e2e/tests/migration/controls/stakeholdergroups/interlinked.test.ts @@ -33,8 +33,8 @@ import { expandRow } from "../../../../views/common.view"; import * as data from "../../../../../utils/data_utils"; import { stakeHoldersTable } from "../../../../views/stakeholders.view"; -var stakeholdersList: Array = []; -var membersList: Array = []; +let stakeholdersList: Array = []; +const membersList: Array = []; describe(["@tier1"], "Stakeholder group linked to stakeholder members", () => { before("Login and Create Test Data", function () { @@ -49,7 +49,7 @@ describe(["@tier1"], "Stakeholder group linked to stakeholder members", () => { beforeEach("Interceptors", function () { // Interceptors for stakeholder groups cy.intercept("POST", "/hub/stakeholdergroups*").as("postStakeholdergroups"); - cy.intercept("GET", "/hub/stakeholdergroups*").as("getStakeholdergroups"); + cy.intercept("GET", "/hub/stakeholdergroups*").as("getStakeholderGroups"); // Interceptors for stakeholders cy.intercept("POST", "/hub/stakeholder*").as("postStakeholder"); @@ -59,22 +59,19 @@ describe(["@tier1"], "Stakeholder group linked to stakeholder members", () => { it("stakeholders attach, update and delete dependency on stakeholder group", function () { selectUserPerspective(migration); - // Create new stakeholder group and attach two stakeholder members - const stakeholdergroup = new Stakeholdergroups( + const stakeholderGroup = new Stakeholdergroups( data.getCompanyName(), data.getDescription(), membersList ); - stakeholdergroup.create(); + stakeholderGroup.create(); cy.wait("@postStakeholdergroups"); - exists(stakeholdergroup.name); + exists(stakeholderGroup.name); // Check if two stakeholder members attached to stakeholder group selectItemsPerPage(100); cy.wait(2000); - cy.get(tdTag) - .contains(stakeholdergroup.name) - .parent(tdTag) + cy.contains(tdTag, stakeholderGroup.name) .parent(trTag) .within(() => { click(expandRow); @@ -84,14 +81,14 @@ describe(["@tier1"], "Stakeholder group linked to stakeholder members", () => { .and("contain", membersList[1]); // Update name of second stakeholder - var updatedStakeholderName = data.getFullName(); + const updatedStakeholderName = data.getFullName(); stakeholdersList[1].edit({ name: updatedStakeholderName }); cy.wait("@getStakeholders"); // Update name of stakeholder group - var updatedStakeholdergroupName = data.getFullName(); - stakeholdergroup.edit({ name: updatedStakeholdergroupName }); - cy.wait("@getStakeholdergroups"); + const updatedStakeholderGroupName = data.getFullName(); + stakeholderGroup.edit({ name: updatedStakeholderGroupName }); + cy.wait("@getStakeholderGroups"); // Go to stakeholder group page clickByText(navTab, stakeholderGroups); @@ -99,9 +96,7 @@ describe(["@tier1"], "Stakeholder group linked to stakeholder members", () => { // Check if second stakeholder's name attached to stakeholder group updated selectItemsPerPage(100); cy.wait(2000); - cy.get(tdTag) - .contains(stakeholdergroup.name) - .parent(tdTag) + cy.contains(tdTag, stakeholderGroup.name) .parent(trTag) .within(() => { click(expandRow); @@ -109,21 +104,16 @@ describe(["@tier1"], "Stakeholder group linked to stakeholder members", () => { .get("div > dd") .should("contain", updatedStakeholderName); - // Delete second stakeholder stakeholdersList[1].delete(); cy.wait("@getStakeholders"); - // Assert that second stakeholder deleted notExists(stakeholdersList[1].name, stakeHoldersTable); - // Go to stakeholder group page clickByText(navTab, stakeholderGroups); // Check if second stakeholder's name detached from stakeholder group selectItemsPerPage(100); cy.wait(2000); - cy.get(tdTag) - .contains(stakeholdergroup.name) - .parent(tdTag) + cy.contains(tdTag, stakeholderGroup.name) .parent(trTag) .within(() => { click(expandRow); @@ -131,12 +121,10 @@ describe(["@tier1"], "Stakeholder group linked to stakeholder members", () => { .get("div > dd") .should("not.contain", updatedStakeholderName); - // Delete stakeholder group - stakeholdergroup.delete(); - cy.wait("@getStakeholdergroups"); - notExists(stakeholdergroup.name); + stakeholderGroup.delete(); + cy.wait("@getStakeholderGroups"); + notExists(stakeholderGroup.name); - // Delete first stakeholder stakeholdersList[0].delete(); cy.wait("@getStakeholders"); notExists(stakeholdersList[0].name, stakeHoldersTable); diff --git a/cypress/e2e/tests/migration/migration-waves/crud.test.ts b/cypress/e2e/tests/migration/migration-waves/crud.test.ts index e01f8d8ae..e405e5fac 100644 --- a/cypress/e2e/tests/migration/migration-waves/crud.test.ts +++ b/cypress/e2e/tests/migration/migration-waves/crud.test.ts @@ -149,7 +149,7 @@ describe(["@tier0"], "Migration Waves CRUD operations", () => { after("Clear test data", function () { deleteAllStakeholders(); - deleteAllStakeholderGroups(); + deleteByList(stakeHolderGroups); deleteByList(applications); });