From 9026c492bbcd97c9102fd9ac6cd9e33205bf6c1b Mon Sep 17 00:00:00 2001 From: laura stordeur Date: Wed, 8 May 2024 13:39:20 +0200 Subject: [PATCH] Update e2e tests to match compliance adjustments --- cypress/e2e/scenario-1-environment.cy.js | 72 +++++++++++----------- cypress/e2e/scenario-2.4-expert-mode.cy.js | 8 +-- cypress/e2e/scenario-4-desired-state.cy.js | 44 ++++++------- cypress/e2e/scenario-6-resources.cy.js | 38 +++++++----- 4 files changed, 83 insertions(+), 79 deletions(-) diff --git a/cypress/e2e/scenario-1-environment.cy.js b/cypress/e2e/scenario-1-environment.cy.js index 930cb583d..7da929be4 100644 --- a/cypress/e2e/scenario-1-environment.cy.js +++ b/cypress/e2e/scenario-1-environment.cy.js @@ -317,31 +317,31 @@ describe("Environment", () => { '[aria-label="EnumInput-agent_trigger_method_on_auto_deployFilterInput"]', ).click(); cy.get('[role="option"]').contains("push_full_deploy").click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-agent_trigger_method_on_auto_deploy"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get( '[aria-label="EnumInput-agent_trigger_method_on_auto_deployFilterInput"]', ).should("have.value", "push_full_deploy"); //Change auto_deploy cy.get('[aria-label="Row-auto_deploy"]').find(".pf-v5-c-switch").click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-auto_deploy"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); //Change auto_full_compile cy.get('[aria-label="Row-auto_full_compile"]').clear(); cy.get('[aria-label="Row-auto_full_compile"]').type("1 2 3 4 5"); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-auto_full_compile"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get('[aria-label="Row-auto_full_compile"]') .find(".pf-v5-c-form-control input") .should("have.value", "1 2 3 4 5"); @@ -350,11 +350,11 @@ describe("Environment", () => { cy.get('[aria-label="Row-autostart_agent_deploy_interval"]') .find(".pf-v5-c-form-control") .type("{selectAll}610"); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-autostart_agent_deploy_interval"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get('[aria-label="Row-autostart_agent_deploy_interval"]') .find(".pf-v5-c-form-control input") .should("have.value", "610"); @@ -363,11 +363,11 @@ describe("Environment", () => { cy.get('[aria-label="Row-autostart_agent_deploy_splay_time"]') .find(".pf-v5-c-form-control") .type("{selectAll}20"); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-autostart_agent_deploy_splay_time"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get('[aria-label="Row-autostart_agent_deploy_splay_time"]') .find(".pf-v5-c-form-control input") .should("have.value", "20"); @@ -379,11 +379,11 @@ describe("Environment", () => { return $el.value === "local:"; }) .type("{selectAll}{backspace}new value"); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-autostart_agent_map"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get('[aria-label="Row-autostart_agent_map"]') .find('[aria-label="editEntryValue"]') .should("have.value", "new value"); @@ -392,11 +392,11 @@ describe("Environment", () => { cy.get('[aria-label="Row-autostart_agent_repair_interval"]') .find(".pf-v5-c-form-control") .type("{selectAll}86410"); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-autostart_agent_repair_interval"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get('[aria-label="Row-autostart_agent_repair_interval"]') .find(".pf-v5-c-form-control input") .should("have.value", "86410"); @@ -405,11 +405,11 @@ describe("Environment", () => { cy.get('[aria-label="Row-autostart_agent_repair_splay_time"]') .find(".pf-v5-c-form-control") .type("{selectAll}610"); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-autostart_agent_repair_splay_time"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get('[aria-label="Row-autostart_agent_repair_splay_time"]') .find(".pf-v5-c-form-control input") .should("have.value", "610"); @@ -418,21 +418,21 @@ describe("Environment", () => { cy.get('[aria-label="Row-autostart_on_start"]') .find(".pf-v5-c-switch") .click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-autostart_on_start"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); //Change available_versions_to_keep cy.get('[aria-label="Row-available_versions_to_keep"]') .find(".pf-v5-c-form-control") .type("{selectAll}110"); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-available_versions_to_keep"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get('[aria-label="Row-available_versions_to_keep"]') .find(".pf-v5-c-form-control input") .should("have.value", "110"); @@ -442,11 +442,11 @@ describe("Environment", () => { '[aria-label="EnumInput-environment_agent_trigger_methodFilterInput"]', ).click(); cy.get('[role="option"]').contains("push_full_deploy").click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-environment_agent_trigger_method"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get( '[aria-label="EnumInput-environment_agent_trigger_methodFilterInput"]', ).should("have.value", "push_full_deploy"); @@ -458,22 +458,22 @@ describe("Environment", () => { .find(".pf-v5-c-switch") .click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-lsm_partial_compile"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); } //change notification_retention cy.get('[aria-label="Row-notification_retention"]') .find(".pf-v5-c-form-control") .type("{selectAll}375"); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-notification_retention"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get('[aria-label="Row-notification_retention"]') .find(".pf-v5-c-form-control input") .should("have.value", "375"); @@ -482,52 +482,52 @@ describe("Environment", () => { cy.get('[aria-label="Row-protected_environment"]') .find(".pf-v5-c-switch") .click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-protected_environment"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); //Change push_on_auto_deploy cy.get('[aria-label="Row-push_on_auto_deploy"]') .find(".pf-v5-c-switch") .click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-push_on_auto_deploy"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); //Change resource_action_logs_retention cy.get('[aria-label="Row-resource_action_logs_retention"]') .find(".pf-v5-c-form-control") .type("{selectAll}8"); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-resource_action_logs_retention"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get('[aria-label="Row-resource_action_logs_retention"]') .find(".pf-v5-c-form-control input") .should("have.value", "8"); //change server_compile cy.get('[aria-label="Row-server_compile"]').find(".pf-v5-c-switch").click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-server_compile"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); //re-enable to delete env cy.get('[aria-label="Row-protected_environment"]') .find(".pf-v5-c-switch") .click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-protected_environment"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get(".pf-v5-c-tabs__list") .find("button") diff --git a/cypress/e2e/scenario-2.4-expert-mode.cy.js b/cypress/e2e/scenario-2.4-expert-mode.cy.js index c0f9467c4..0f6ce48db 100644 --- a/cypress/e2e/scenario-2.4-expert-mode.cy.js +++ b/cypress/e2e/scenario-2.4-expert-mode.cy.js @@ -114,11 +114,11 @@ if (Cypress.env("edition") === "iso") { cy.get('[aria-label="Row-enable_lsm_expert_mode"]') .find(".pf-v5-c-switch") .click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-enable_lsm_expert_mode"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get("[id='expert-mode-banner']") .should("exist") .and("contain", "LSM expert mode is enabled, proceed with caution."); @@ -353,11 +353,11 @@ if (Cypress.env("edition") === "iso") { cy.get('[aria-label="Row-enable_lsm_expert_mode"]') .find(".pf-v5-c-switch") .click(); - cy.get('[aria-label="Warning"]').should("exist"); + cy.get('[data-testid="Warning"]').should("exist"); cy.get('[aria-label="Row-enable_lsm_expert_mode"]') .find('[aria-label="SaveAction"]') .click(); - cy.get('[aria-label="Warning"]').should("not.exist"); + cy.get('[data-testid="Warning"]').should("not.exist"); cy.get("[id='expert-mode-banner']").should("not.exist"); }); }); diff --git a/cypress/e2e/scenario-4-desired-state.cy.js b/cypress/e2e/scenario-4-desired-state.cy.js index fbf6665d6..88eaf8918 100644 --- a/cypress/e2e/scenario-4-desired-state.cy.js +++ b/cypress/e2e/scenario-4-desired-state.cy.js @@ -128,7 +128,7 @@ describe("Scenario 4 Desired State", () => { } else { cy.get('[aria-label="DesiredStatesView-Success"]', { timeout: 60000 }) .find("tbody", { timeout: 60000 }) - .should("have.length", 2); + .should("have.length", 3); cy.get("tbody") .eq(0) .should("contain", "lsm_export") @@ -198,7 +198,7 @@ describe("Scenario 4 Desired State", () => { cy.get(".pf-v5-c-description-list__group") .eq(1) .find(".pf-v5-c-description-list__description") - .should("have.text", "3"); + .should("have.text", "4"); cy.get(".pf-v5-c-description-list__group") .eq(2) @@ -313,7 +313,7 @@ describe("Scenario 4 Desired State", () => { // the first element in the table shouldn't be available to promote, since it is already active. cy.get("tbody").eq(0).find('[aria-label="actions-toggle"]').click(); - cy.get('[aria-label="promote"]').find("button").should("be.disabled"); + cy.get('[data-testid="promote"]').find("button").should("be.disabled"); }); // Update the settings to disable the auto-deploy setting. @@ -400,14 +400,14 @@ describe("Scenario 4 Desired State", () => { ); cy.get('[aria-label="DiffItemList"]').within(() => { if (isIso) { - cy.get("#toggle-button").eq(0).click(); - cy.get("#toggle-button").eq(1).click(); + cy.get('[aria-label="Details"]').eq(0).click(); + cy.get('[aria-label="Details"]').eq(1).click(); } else { - cy.get("#toggle-button").eq(0).click(); - cy.get("#toggle-button").eq(1).click(); - cy.get("#toggle-button").eq(2).click(); - cy.get("#toggle-button").eq(3).click(); - cy.get("#toggle-button").eq(4).click(); + cy.get('[aria-label="Details"]').eq(0).click(); + cy.get('[aria-label="Details"]').eq(1).click(); + cy.get('[aria-label="Details"]').eq(2).click(); + cy.get('[aria-label="Details"]').eq(3).click(); + cy.get('[aria-label="Details"]').eq(4).click(); } }); @@ -469,14 +469,14 @@ describe("Scenario 4 Desired State", () => { ); cy.get('[aria-label="DiffItemList"]').within(() => { if (isIso) { - cy.get("#toggle-button").eq(0).click(); - cy.get("#toggle-button").eq(1).click(); + cy.get('[aria-label="Details"]').eq(0).click(); + cy.get('[aria-label="Details"]').eq(1).click(); } else { - cy.get("#toggle-button").eq(0).click(); - cy.get("#toggle-button").eq(1).click(); - cy.get("#toggle-button").eq(2).click(); - cy.get("#toggle-button").eq(3).click(); - cy.get("#toggle-button").eq(4).click(); + cy.get('[aria-label="Details"]').eq(0).click(); + cy.get('[aria-label="Details"]').eq(1).click(); + cy.get('[aria-label="Details"]').eq(2).click(); + cy.get('[aria-label="Details"]').eq(3).click(); + cy.get('[aria-label="Details"]').eq(4).click(); } }); @@ -538,13 +538,13 @@ describe("Scenario 4 Desired State", () => { cy.get('[aria-label="StatusFilter"]').click(); cy.get('[aria-label="DiffItemList"]').within(() => { - cy.get("#toggle-button").eq(0).click(); - cy.get("#toggle-button").eq(1).click(); + cy.get('[aria-label="Details"]').eq(0).click(); + cy.get('[aria-label="Details"]').eq(1).click(); if (!isIso) { - cy.get("#toggle-button").eq(2).click(); - cy.get("#toggle-button").eq(3).click(); - cy.get("#toggle-button").eq(4).click(); + cy.get('[aria-label="Details"]').eq(2).click(); + cy.get('[aria-label="Details"]').eq(3).click(); + cy.get('[aria-label="Details"]').eq(4).click(); } }); // expect the view to still contain the diff of the last dry-run comparison diff --git a/cypress/e2e/scenario-6-resources.cy.js b/cypress/e2e/scenario-6-resources.cy.js index 44744a89e..f48ddad79 100644 --- a/cypress/e2e/scenario-6-resources.cy.js +++ b/cypress/e2e/scenario-6-resources.cy.js @@ -231,7 +231,9 @@ describe("Scenario 6 : Resources", () => { ); // make sure the default is 100 instead of 20 like on other pages with pagination. - cy.get('[aria-label="PaginationWidget"] .pf-v5-c-menu-toggle').click(); + cy.get( + '[aria-label="PaginationWidget-top"] .pf-v5-c-menu-toggle', + ).click(); cy.contains(".pf-v5-c-menu__list-item", "100") .find("svg") .should("exist"); @@ -568,38 +570,38 @@ describe("Scenario 6 : Resources", () => { "49", ); - cy.get("#options-menu-top-toggle > span > b") - .eq(0) - .should("have.text", "1 - 20"); + cy.get( + "#PaginationWidget-top-top-toggle > .pf-v5-c-pagination__total-items > b:first-of-type", + ).should("have.text", "1 - 20"); //Go to next page cy.get('[aria-label="Go to next page"]').first().click(); cy.get('[aria-label="ResourcesView-Success"]').should("be.visible"); - cy.get("#options-menu-top-toggle > span > b") - .eq(0) - .should("have.text", "21 - 40"); + cy.get( + "#PaginationWidget-top-top-toggle > .pf-v5-c-pagination__total-items > b:first-of-type", + ).should("have.text", "21 - 40"); //Go to last page cy.get('[aria-label="Go to next page"]').first().click(); cy.get('[aria-label="ResourcesView-Success"]').should("be.visible"); - cy.get("#options-menu-top-toggle > span > b") - .eq(0) - .should("have.text", "41 - 49"); + cy.get( + "#PaginationWidget-top-top-toggle > .pf-v5-c-pagination__total-items > b:first-of-type", + ).should("have.text", "41 - 49"); //Go to previous page cy.get('[aria-label="Go to previous page"]').first().click(); cy.get('[aria-label="ResourcesView-Success"]').should("be.visible"); - cy.get("#options-menu-top-toggle > span > b") - .eq(0) - .should("have.text", "21 - 40"); + cy.get( + "#PaginationWidget-top-top-toggle > .pf-v5-c-pagination__total-items > b:first-of-type", + ).should("have.text", "21 - 40"); //Change page and come back to check if we are at the same page as we was cy.get(".pf-v5-c-nav__link").contains("Dashboard").click(); cy.go("back"); - cy.get("#options-menu-top-toggle > span > b") - .eq(0) - .should("have.text", "21 - 40"); + cy.get( + "#PaginationWidget-top-top-toggle > .pf-v5-c-pagination__total-items > b:first-of-type", + ).should("have.text", "21 - 40"); }); } else { it("6.6 Resources for OSS", () => { @@ -721,7 +723,9 @@ describe("Scenario 6 : Resources", () => { ); // make sure the default is 100 instead of 20 like on other pages with pagination. - cy.get('[aria-label="PaginationWidget"] .pf-v5-c-menu-toggle').click(); + cy.get( + '[aria-label="PaginationWidget-top"] .pf-v5-c-menu-toggle', + ).click(); cy.contains(".pf-v5-c-menu__list-item", "100") .find("svg") .should("exist");