diff --git a/cypress/e2e/models/migration/applicationinventory/assessment.ts b/cypress/e2e/models/migration/applicationinventory/assessment.ts index 07eb9ec6b..31e32532c 100644 --- a/cypress/e2e/models/migration/applicationinventory/assessment.ts +++ b/cypress/e2e/models/migration/applicationinventory/assessment.ts @@ -36,13 +36,12 @@ import { assessmentColumnSelector, questionBlock, radioInput, - stakeholdergroupsSelect, - stakeholderSelect, stack, assessmentBlock, victoryContainer, donutChart, donutChartImage, + stakeholdersAndGroupsSelect, } from "../../../views/assessment.view"; import { criticalityInput, @@ -57,15 +56,15 @@ import { notYetReviewed, reviewItems } from "../../../views/archetype.view"; import { plainButton, tableRowActions, splitItem } from "../../../views/common.view"; export class Assessment { - public static selectStakeholders(stakeholders: Stakeholders[]): void { - stakeholders.forEach(function (stakeholder) { - selectFormItems(stakeholderSelect, stakeholder.name); + public static selectStakeholdersAndGroups( + stakeholders?: Stakeholders[], + stakeholderGroups?: Stakeholdergroups[] + ): void { + stakeholders?.forEach(function (stakeholder) { + selectFormItems(stakeholdersAndGroupsSelect, stakeholder.name); }); - } - - public static selectStakeholderGroups(stakeholderGroups: Stakeholdergroups[]): void { - stakeholderGroups.forEach(function (stakeholderGroup) { - selectFormItems(stakeholdergroupsSelect, stakeholderGroup.name); + stakeholderGroups?.forEach(function (stakeholderGroup) { + selectFormItems(stakeholdersAndGroupsSelect, stakeholderGroup.name); }); } @@ -215,8 +214,8 @@ export class Assessment { stakeholderGroups?: Stakeholdergroups[], saveAndReview = false ): void { - if (stakeholders) this.selectStakeholders(stakeholders); - if (stakeholderGroups) this.selectStakeholderGroups(stakeholderGroups); + if (stakeholders || stakeholderGroups) + this.selectStakeholdersAndGroups(stakeholders, stakeholderGroups); clickJs(commonView.nextButton); cy.wait(SEC); this.selectAnswers(risk, saveAndReview); diff --git a/cypress/e2e/tests/migration/applicationinventory/applications/interlinked.test.ts b/cypress/e2e/tests/migration/applicationinventory/applications/interlinked.test.ts index 5b89b57ec..3a90fbf1a 100644 --- a/cypress/e2e/tests/migration/applicationinventory/applications/interlinked.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/applications/interlinked.test.ts @@ -28,11 +28,7 @@ import { selectItemsPerPage, } from "../../../../../utils/utils"; import { businessColumnSelector } from "../../../../views/applicationinventory.view"; -import { - continueButton, - stakeholdergroupsSelect, - stakeholderSelect, -} from "../../../../views/assessment.view"; +import { continueButton, stakeholdersAndGroupsSelect } from "../../../../views/assessment.view"; import { navMenu } from "../../../../views/menu.view"; import { Stakeholders } from "../../../../models/migration/controls/stakeholders"; import { Stakeholdergroups } from "../../../../models/migration/controls/stakeholdergroups"; @@ -150,8 +146,7 @@ describe(["@tier3"], "Applications interlinked to tags and business service", () clickByText(button, "Retake"); //Verify that values show blank - cy.get(stakeholderSelect).should("have.value", ""); - cy.get(stakeholdergroupsSelect).should("have.value", ""); + cy.get(stakeholdersAndGroupsSelect).should("have.value", ""); clickByText(button, "Cancel"); cy.get(continueButton).click(); }); diff --git a/cypress/e2e/views/assessment.view.ts b/cypress/e2e/views/assessment.view.ts index 72c2d8db3..7b2fb6040 100644 --- a/cypress/e2e/views/assessment.view.ts +++ b/cypress/e2e/views/assessment.view.ts @@ -13,8 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -export const stakeholderSelect = "input[aria-label='stakeholder-select-toggle']"; -export const stakeholdergroupsSelect = "input[aria-label='stakeholder-groups-select-toggle']"; +export const stakeholdersAndGroupsSelect = + "input[aria-label='stakeholders-and-groups-select-toggle']"; export const questionBlock = "div[cy-data='question']"; export const assessmentBlock = "li.pf-v5-c-wizard__nav-item"; export const radioInput = "input[type='radio']";