From c096bb5e5be921465027db59dfb3157db4b70d17 Mon Sep 17 00:00:00 2001 From: Rahul Barwal Date: Fri, 7 Jun 2024 15:24:07 +0530 Subject: [PATCH] test: Failing cypress tests due to removal of empty canvas prompts (#34037) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description This PR fixes impact of https://github.com/appsmithorg/appsmith/pull/33993 Refactors visual regression tests to use PageList for page generation; remove obsolete empty canvas spec and related selectors. * Removed unncessary: `cypress/e2e/Regression/ClientSide/OtherUIFeatures/EmptyCanvas_spec.js` * Fixes `cypress/e2e/Regression/ClientSide/VisualTests/AppPageLayout_spec.js` **RCA:** The [original PR](https://github.com/appsmithorg/appsmith/pull/33993) catered to removal of empty canvas prompts and visual tests were not run leading to subsequent failures in the CI for EmptyCanvas_spec & AppPageLayout_spec. This PR caters to failing visual tests, while running `@tag.Visual` we noticed that other (unrelated) visual specs started failing. These new failures fail in local as well. Whereas they were not failing in TBP or `@tag.All` runs and `@tag.All` succeeded for this PR as well. Fixes https://github.com/appsmithorg/appsmith/issues/33874 _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: b6d7f6012e0f2c3f3e030ad280354cc3d22f57ad > Cypress dashboard url: Click here! ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit - **Refactor** - Updated method call for adding a new page in visual regression tests to improve code clarity and maintainability. - **Chores** - Removed unused locators and declarations to clean up the codebase. --------- Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com> --- .../OtherUIFeatures/EmptyCanvas_spec.js | 31 ------------------- .../VisualTests/AppPageLayout_spec.js | 3 +- app/client/cypress/locators/GeneratePage.json | 1 - app/client/cypress/support/Pages/HomePage.ts | 1 - 4 files changed, 2 insertions(+), 34 deletions(-) delete mode 100644 app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EmptyCanvas_spec.js diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EmptyCanvas_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EmptyCanvas_spec.js deleted file mode 100644 index a3d9d72532..0000000000 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EmptyCanvas_spec.js +++ /dev/null @@ -1,31 +0,0 @@ -import { WIDGET } from "../../../../locators/WidgetLocators"; -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; -import EditorNavigation, { - EntityType, -} from "../../../../support/Pages/EditorNavigation"; -import PageList from "../../../../support/Pages/PageList"; - -const { CommonLocators: locators, EntityExplorer: ee } = ObjectsRegistry; - -describe("Empty canvas ctas", () => { - it("1. Ctas validations", () => { - cy.wait(3000); // for page to load, failing in CI - //Ctas should not be shown in the second page - cy.get(locators._emptyCanvasCta).should("be.visible"); - PageList.AddNewPage(); - cy.get(locators._emptyCanvasCta).should("not.exist"); - EditorNavigation.SelectEntityByName("Page1", EntityType.Page); - - //Ctas should continue to show on refresh - cy.get(locators._emptyCanvasCta).should("be.visible"); - cy.reload(); - cy.get(locators._emptyCanvasCta).should("be.visible"); - - //Hide cta on adding a widget - cy.get(locators._emptyCanvasCta).should("be.visible"); - ee.DragDropWidgetNVerify(WIDGET.BUTTON, 200, 200); - cy.get(locators._emptyCanvasCta).should("not.exist"); - PageList.AddNewPage(); - cy.get(locators._emptyCanvasCta).should("not.exist"); - }); -}); diff --git a/app/client/cypress/e2e/Regression/ClientSide/VisualTests/AppPageLayout_spec.js b/app/client/cypress/e2e/Regression/ClientSide/VisualTests/AppPageLayout_spec.js index d46e558fa9..bc76f3bb8b 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/VisualTests/AppPageLayout_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/VisualTests/AppPageLayout_spec.js @@ -1,5 +1,6 @@ import homePage from "../../../../locators/HomePage"; import * as _ from "../../../../support/Objects/ObjectsCore"; +import PageList from "../../../../support/Pages/PageList"; describe("Visual regression tests", { tags: ["@tag.Visual"] }, () => { // for any changes in UI, update the screenshot in snapshot folder, to do so: @@ -18,7 +19,7 @@ describe("Visual regression tests", { tags: ["@tag.Visual"] }, () => { cy.get("#root").matchImageSnapshot("apppage"); //Layout validation for Quick page wizard - cy.get("[data-testid='generate-app']").click(); + PageList.AddNewPage(Cypress.env("MESSAGES").GENERATE_PAGE_ACTION_TITLE()); cy.wait(2000); // taking screenshot of generate crud page cy.get("#root").matchImageSnapshot("quickPageWizard"); diff --git a/app/client/cypress/locators/GeneratePage.json b/app/client/cypress/locators/GeneratePage.json index fafd5d1c4b..e6925eb1e7 100644 --- a/app/client/cypress/locators/GeneratePage.json +++ b/app/client/cypress/locators/GeneratePage.json @@ -1,5 +1,4 @@ { - "generateCRUDPageActionCard": "[data-testid='generate-app']", "selectDatasourceDropdown": "[data-testid=t--datasource-dropdown]", "datasourceDropdownOption": "[data-testid=t--datasource-dropdown-option]", "selectTableDropdown": "[data-testid=t--table-dropdown]", diff --git a/app/client/cypress/support/Pages/HomePage.ts b/app/client/cypress/support/Pages/HomePage.ts index ee55d6323b..2ae8b77ff8 100644 --- a/app/client/cypress/support/Pages/HomePage.ts +++ b/app/client/cypress/support/Pages/HomePage.ts @@ -68,7 +68,6 @@ export class HomePage { _applicationName = ".t--application-name"; private _editAppName = "bp3-editable-text-editing"; private _appMenu = ".ads-v2-menu__menu-item-children"; - _buildFromDataTableActionCard = "[data-testid='generate-app']"; private _selectRole = "//span[text()='Select a role']/ancestor::div"; private _searchInput = "input[type='text']"; _appHoverIcon = (action: string) => ".t--application-" + action + "-link";