From 959fdce6ac2b7521d44934fe7f0a00ece69c1ec0 Mon Sep 17 00:00:00 2001 From: Aishwarya-U-R <91450662+Aishwarya-U-R@users.noreply.github.com> Date: Sat, 17 Jun 2023 00:10:10 +0530 Subject: [PATCH] test: Cypress | Flaky fixes (#24508) ## Description - This PR improves the sign up method to work even if telemetry related details are not asked at start - Also alters the Commit message based on the repository/workflow or push runs - Improves DragDropWidgetNVerify() - Fixes flaky TableV2/Inline_editing_spec.js spec with TS methods - Improved EditTableCell() - Skipping deleting apps during local runs for debugging purpose - Fixes PropertyPane_Search_spec.ts - Fixed ever flaky AppNavigationWithMultiplePages_spec, AppNavigationWithAutoLayout_spec #### Type of change - Script fix (non-breaking change which fixes an issue) ## Testing > #### How Has This Been Tested? - [X] Cypress CI runs > > ## Checklist: #### QA activity: - [ ] Added `Test Plan Approved` label after changes were reviewed --- .github/workflows/ci-test-limited.yml | 6 +- .github/workflows/ci-test.yml | 14 +- .../AppNavigationWithAutoLayout_spec.ts | 8 +- .../AppNavigationWithMultiplePages_spec.ts | 8 +- .../DynamicHeight/TextWidget_Spec.ts | 14 +- .../ClientSide/Linting/ErrorReporting_spec.ts | 2 +- .../AutoDimension_1_spec.ts | 95 ++++++------- .../AutoDimension_2_spec.ts | 128 ++++++++---------- .../OtherUIFeatures/Analytics_spec.js | 4 +- .../PropertyPane/PropertyPane_Search_spec.ts | 5 +- .../Widgets/ListV2/Listv2_onItemClick_spec.js | 6 +- .../ClientSide/Widgets/Migration_Spec.js | 1 + .../Others/StatBox_DragAndDrop_spec.js | 26 ++-- .../Widgets/TableV1/TableBugs_Spec.ts | 4 +- .../Widgets/TableV2/Inline_editing_spec.js | 94 +++++++------ .../ServerSide/QueryPane/S3_1_spec.js | 2 +- .../fixtures/Table/InlineEditingDSL.json | 16 +-- app/client/cypress/locators/WidgetLocators.ts | 1 + .../cypress/support/Pages/AggregateHelper.ts | 32 +++-- .../support/Pages/AppSettings/AppSettings.ts | 1 + .../cypress/support/Pages/AssertHelper.ts | 21 +-- .../cypress/support/Pages/AutoLayout.ts | 32 ++--- .../cypress/support/Pages/DeployModeHelper.ts | 2 +- .../cypress/support/Pages/EntityExplorer.ts | 32 +++-- .../cypress/support/Pages/PropertyPane.ts | 9 +- app/client/cypress/support/Pages/Table.ts | 83 +++++++++--- app/client/cypress/support/commands.js | 15 +- app/client/cypress/support/e2e.js | 13 +- 28 files changed, 370 insertions(+), 304 deletions(-) diff --git a/.github/workflows/ci-test-limited.yml b/.github/workflows/ci-test-limited.yml index 2dfcf2526a..861524c041 100644 --- a/.github/workflows/ci-test-limited.yml +++ b/.github/workflows/ci-test-limited.yml @@ -256,7 +256,7 @@ jobs: # https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#environment-files run: | echo COMMIT_INFO_BRANCH=$(git rev-parse --abbrev-ref HEAD) >> $GITHUB_ENV - echo COMMIT_INFO_MESSAGE=Run from $(git rev-parse --abbrev-ref HEAD) on commit $(git show -s --pretty=%H | cut -c 1-7)>> $GITHUB_ENV + echo COMMIT_INFO_MESSAGE=Run from $(git rev-parse --abbrev-ref HEAD) on commit $(git show -s --pretty=%H | cut -c 1-7) >> $GITHUB_ENV echo COMMIT_INFO_EMAIL=$(git show -s --pretty=%ae) >> $GITHUB_ENV echo COMMIT_INFO_AUTHOR=$(git show -s --pretty=%an) >> $GITHUB_ENV echo COMMIT_INFO_SHA=$(git show -s --pretty=%H) >> $GITHUB_ENV @@ -320,7 +320,7 @@ jobs: CYPRESS_AIRGAPPED: false APPSMITH_DISABLE_TELEMETRY: true APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }} - COMMIT_INFO_MESSAGE: ${{ env.COMMIT_INFO_MESSAGE || github.event.pull_request.title }} + COMMIT_INFO_MESSAGE: ${{ env.COMMIT_INFO_MESSAGE }} CYPRESS_VERIFY_TIMEOUT: 100000 with: browser: ${{ env.BROWSER_PATH }} @@ -382,7 +382,7 @@ jobs: CYPRESS_AIRGAPPED: false APPSMITH_DISABLE_TELEMETRY: true APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }} - COMMIT_INFO_MESSAGE: ${{ env.COMMIT_INFO_MESSAGE || github.event.pull_request.title }} + COMMIT_INFO_MESSAGE: ${{ env.COMMIT_INFO_MESSAGE }} CYPRESS_VERIFY_TIMEOUT: 100000 with: browser: ${{ env.BROWSER_PATH }} diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 4f92af2609..2eb67038c0 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -254,7 +254,7 @@ jobs: # https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#environment-files run: | echo COMMIT_INFO_BRANCH=$(git rev-parse --abbrev-ref HEAD) >> $GITHUB_ENV - echo COMMIT_INFO_MESSAGE=Run from $(git rev-parse --abbrev-ref HEAD) on commit $(git show -s --pretty=%H | cut -c 1-7)>> $GITHUB_ENV + echo COMMIT_INFO_MESSAGE=Run from PR# ${{ inputs.pr }} on commit $(git show -s --pretty=%H | cut -c 1-7) >> $GITHUB_ENV echo COMMIT_INFO_EMAIL=$(git show -s --pretty=%ae) >> $GITHUB_ENV echo COMMIT_INFO_AUTHOR=$(git show -s --pretty=%an) >> $GITHUB_ENV echo COMMIT_INFO_SHA=$(git show -s --pretty=%H) >> $GITHUB_ENV @@ -273,6 +273,14 @@ jobs: echo Timestamp $COMMIT_INFO_TIMESTAMP echo Remote $COMMIT_INFO_REMOTE + - name: Set Commit Message + run: | + if [[ ${{ inputs.pr }} -ne 0 ]]; then + echo COMMIT_INFO_MESSAGE=Run from PR# ${{ inputs.pr }} on commit $(git show -s --pretty=%H | cut -c 1-7) >> $GITHUB_ENV + else + echo COMMIT_INFO_MESSAGE= ${{ github.event.pull_request.title }} >> $GITHUB_ENV + fi + - name: Run the cypress test if: steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest' uses: cypress-io/github-action@v2 @@ -318,7 +326,7 @@ jobs: CYPRESS_AIRGAPPED: false APPSMITH_DISABLE_TELEMETRY: true APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }} - COMMIT_INFO_MESSAGE: ${{ env.COMMIT_INFO_MESSAGE || github.event.pull_request.title }} + COMMIT_INFO_MESSAGE: ${{ env.COMMIT_INFO_MESSAGE }} CYPRESS_VERIFY_TIMEOUT: 100000 with: browser: ${{ env.BROWSER_PATH }} @@ -380,7 +388,7 @@ jobs: CYPRESS_AIRGAPPED: false APPSMITH_DISABLE_TELEMETRY: true APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }} - COMMIT_INFO_MESSAGE: ${{ env.COMMIT_INFO_MESSAGE || github.event.pull_request.title }} + COMMIT_INFO_MESSAGE: ${{ env.COMMIT_INFO_MESSAGE }} with: browser: ${{ env.BROWSER_PATH }} headless: true diff --git a/app/client/cypress/e2e/Regression/ClientSide/AppNavigation/AppNavigationWithAutoLayout_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/AppNavigation/AppNavigationWithAutoLayout_spec.ts index 2011d40c75..c457265c23 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/AppNavigation/AppNavigationWithAutoLayout_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/AppNavigation/AppNavigationWithAutoLayout_spec.ts @@ -24,12 +24,8 @@ describe("Validating multiple widgets in auto layout mode with App navigation se agHelper.GetNClick( appSettings.locators._navigationSettings._orientationOptions._side, ); - agHelper.GetNClickByContains( - appSettings.locators._navigationMenuItem, - "Page1", - ); - agHelper.Sleep(3000); //wait a bit before proceeding, for CI! - agHelper.AssertNetworkStatus("@getWorkspace"); + agHelper.AssertElementExist(appSettings.locators._sideNavbar); + agHelper.GetNClick(locators._canvas); agHelper.AssertElementExist(locators._widgetInCanvas("inputwidgetv2")); agHelper.AssertElementExist(locators._widgetInCanvas("inputwidgetv2"), 1); agHelper.AssertElementExist(locators._fixedLayout); diff --git a/app/client/cypress/e2e/Regression/ClientSide/AppNavigation/AppNavigationWithMultiplePages_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/AppNavigation/AppNavigationWithMultiplePages_spec.ts index d8135c2950..a6affd045a 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/AppNavigation/AppNavigationWithMultiplePages_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/AppNavigation/AppNavigationWithMultiplePages_spec.ts @@ -17,12 +17,8 @@ describe("Page orientation and navigation related usecases ", function () { agHelper.GetNClick( appSettings.locators._navigationSettings._orientationOptions._side, ); - agHelper.GetNClickByContains( - appSettings.locators._navigationMenuItem, - "Page1", - ); - agHelper.Sleep(3000); //wait a bit before proceeding, for CI! - agHelper.AssertNetworkStatus("@getWorkspace"); + agHelper.AssertElementExist(appSettings.locators._sideNavbar); + agHelper.GetNClick(locators._canvas); }); it("2. Validate change with height width for fill widget - Input widget", function () { diff --git a/app/client/cypress/e2e/Regression/ClientSide/DynamicHeight/TextWidget_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/DynamicHeight/TextWidget_Spec.ts index 2c00db3dd1..592f9f2581 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/DynamicHeight/TextWidget_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/DynamicHeight/TextWidget_Spec.ts @@ -11,18 +11,16 @@ describe("Dynamic Height Width validation for text widget", function () { //changing the Text and verifying _.propPane.AssertPropertiesDropDownCurrentValue("Height", "Auto Height"); - _.agHelper.GetWidgetHeight( - _.locators._widgetInDeployed(_.draggableWidgets.TEXT), - ); - cy.get("@widgetHeight").then(($initalHeight) => { + _.agHelper.GetHeight(_.locators._widgetInDeployed(_.draggableWidgets.TEXT)); + cy.get("@eleHeight").then(($initalHeight) => { _.propPane.UpdatePropertyFieldValue("Text", textMsg); _.propPane.MoveToTab("Style"); _.propPane.SelectPropertiesDropDown("Font size", "L"); _.agHelper.AssertNetworkStatus("@updateLayout"); //for textMsg update - _.agHelper.GetWidgetHeight( + _.agHelper.GetHeight( _.locators._widgetInDeployed(_.draggableWidgets.TEXT), ); - cy.get("@widgetHeight").then(($addedtextHeight) => { + cy.get("@eleHeight").then(($addedtextHeight) => { expect($addedtextHeight).to.not.equal($initalHeight); _.deployMode.DeployApp(_.locators._textWidgetInDeployed); _.agHelper @@ -37,10 +35,10 @@ describe("Dynamic Height Width validation for text widget", function () { "1.25rem", //for Font size 'L' ); - _.agHelper.GetWidgetHeight( + _.agHelper.GetHeight( _.locators._widgetInDeployed(_.draggableWidgets.TEXT), ); - cy.get("@widgetHeight").then(($deployedAutoHeight) => { + cy.get("@eleHeight").then(($deployedAutoHeight) => { expect($deployedAutoHeight).not.eq($initalHeight); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Linting/ErrorReporting_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Linting/ErrorReporting_spec.ts index 31767ca34a..b7a55c8d5e 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Linting/ErrorReporting_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Linting/ErrorReporting_spec.ts @@ -235,7 +235,7 @@ describe("Lint error reporting", () => { //Test in Table for no error when using {{currentRow}} entityExplorer.SelectEntityByName("Table1", "Widgets"); - agHelper.GetNClick(table._columnSettings("step")); + agHelper.GetNClick(table._columnSettings("step", "Edit")); agHelper.AssertElementAbsence(locators._lintErrorElement); propPane.UpdatePropertyFieldValue("Computed value", "{{currentRow}}"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoDimension_1_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoDimension_1_spec.ts index 89a6490e8a..79a9dc80d9 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoDimension_1_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoDimension_1_spec.ts @@ -1,87 +1,70 @@ -import * as _ from "../../../../support/Objects/ObjectsCore"; +import { + agHelper, + locators, + entityExplorer, + autoLayout, + draggableWidgets, +} from "../../../../support/Objects/ObjectsCore"; describe("Validating use cases for Auto Dimension", () => { before(() => { - _.autoLayout.ConvertToAutoLayoutAndVerify(false); + autoLayout.ConvertToAutoLayoutAndVerify(false); }); beforeEach(() => { // Cleanup the canvas before each test - _.agHelper.SelectAllWidgets(); - _.agHelper.PressDelete(); - _.agHelper.SetCanvasViewportWidth(808); + agHelper.SelectAllWidgets(); + agHelper.PressDelete(); + agHelper.SetCanvasViewportWidth(808); }); ["DESKTOP", "MOBILE"].forEach((viewport) => { it(`1. [${viewport}] Verify if Auto dimension works for widgets in the MainCanvas`, () => { if (viewport === "MOBILE") { - _.agHelper.SetCanvasViewportWidth(375); + agHelper.SetCanvasViewportWidth(375); } - _.autoLayout.DropButtonAndTestForAutoDimension(100, 100); - _.autoLayout.DropTextAndTestForAutoDimension(100, 200); + autoLayout.DropButtonAndTestForAutoDimension(100, 100); + autoLayout.DropTextAndTestForAutoDimension(100, 200); }); it(`2. [${viewport}] Verify if Auto dimension works for widgets in a Container`, () => { if (viewport === "MOBILE") { - _.agHelper.SetCanvasViewportWidth(375); + agHelper.SetCanvasViewportWidth(375); } - _.entityExplorer.DragDropWidgetNVerify( - _.draggableWidgets.CONTAINER, + entityExplorer.DragDropWidgetNVerify(draggableWidgets.CONTAINER, 100, 30); + autoLayout.DropButtonAndTestForAutoDimension( 100, 30, + draggableWidgets.CONTAINER, + ); + // y = main canvas padding (8) + button widget height (40) + autoLayout.DropTextAndTestForAutoDimension( + 100, + 48, + draggableWidgets.CONTAINER, ); - - _.agHelper - .GetWidgetByName("Container1") - .invoke("attr", "id") - .then((id) => { - const dropTargetClass = `.drop-target-${id?.split("_")[1]}`; - // dropButtonAndTest(100, 25, dropTargetClass); - _.autoLayout.DropButtonAndTestForAutoDimension( - 100, - 30, - dropTargetClass, - ); - // y = main canvas padding (8) + button widget height (40) - _.autoLayout.DropTextAndTestForAutoDimension( - 100, - 48, - dropTargetClass, - ); - }); }); it(`3. [${viewport}] Verify if Auto dimension works for widgets in a List`, () => { if (viewport === "MOBILE") { - _.agHelper.SetCanvasViewportWidth(375); + agHelper.SetCanvasViewportWidth(375); } - _.entityExplorer.DragDropWidgetNVerify( - _.draggableWidgets.LIST_V2, - 100, - 30, - ); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.LIST_V2, 100, 30); // Delete existing widgets within list - _.agHelper.SelectAllWidgets(_.locators._widgetByName("Container1")); - _.agHelper.PressDelete(); - - _.agHelper - .GetWidgetByName("Container1") - .invoke("attr", "id") - .then((id) => { - const dropTargetClass = `.drop-target-${id?.split("_")[1]}`; - _.autoLayout.DropButtonAndTestForAutoDimension( - 100, - 25, - dropTargetClass, - ); - // y = main canvas padding (8) + button widget height (40) - _.autoLayout.DropTextAndTestForAutoDimension( - 100, - 48, - dropTargetClass, - ); - }); + agHelper.SelectAllWidgets(locators._widgetByName("Container1")); + agHelper.PressDelete(); + autoLayout.DropButtonAndTestForAutoDimension( + 100, + 25, + draggableWidgets.CONTAINER, + ); + // y = main canvas padding (8) + button widget height (40) + autoLayout.DropTextAndTestForAutoDimension( + 100, + 48, + draggableWidgets.CONTAINER, + ); }); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoDimension_2_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoDimension_2_spec.ts index 6c92977518..aa361afc81 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoDimension_2_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoDimension_2_spec.ts @@ -1,52 +1,52 @@ -import * as _ from "../../../../support/Objects/ObjectsCore"; +import { + agHelper, + entityExplorer, + propPane, + autoLayout, + draggableWidgets, +} from "../../../../support/Objects/ObjectsCore"; describe("Validating use cases for Auto Dimension", () => { before(() => { - _.autoLayout.ConvertToAutoLayoutAndVerify(false); + autoLayout.ConvertToAutoLayoutAndVerify(false); }); beforeEach(() => { // Cleanup the canvas before each test - _.agHelper.SelectAllWidgets(); - _.agHelper.PressDelete(); - _.agHelper.SetCanvasViewportWidth(808); + agHelper.SelectAllWidgets(); + agHelper.PressDelete(); + agHelper.SetCanvasViewportWidth(808); }); ["DESKTOP", "MOBILE"].forEach((viewport) => { it(`1. [${viewport}] Check if widget's auto height updation updates container's height`, () => { if (viewport === "MOBILE") { - _.agHelper.SetCanvasViewportWidth(375); + agHelper.SetCanvasViewportWidth(375); } - _.entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.CONTAINER); - _.agHelper - .GetWidgetByName("Container1") - .invoke("attr", "id") - .then((id) => { - const dropTargetClass = `.drop-target-${id?.split("_")[1]}`; - _.entityExplorer.DragDropWidgetNVerify( - "textwidget", - 50, - 20, - dropTargetClass, - ); - }); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.CONTAINER); + entityExplorer.DragDropWidgetNVerify( + "textwidget", + 50, + 20, + draggableWidgets.CONTAINER, + ); // Add multi-line text & verify if the container's height increases - _.agHelper.GetWidgetHeight(_.autoLayout._containerWidgetSelector); - cy.get("@widgetHeight").then(($initialHeight) => { - _.propPane.UpdatePropertyFieldValue( + agHelper.GetHeight(autoLayout._containerWidgetSelector); + cy.get("@eleHeight").then(($initialHeight) => { + propPane.UpdatePropertyFieldValue( "Text", "hello\nWorld\nThis\nis\na\nMulti-line\nTexthello\nWorld\nThis\nis\na\nMulti-line\nText", ); - _.agHelper.GetWidgetHeight(_.autoLayout._containerWidgetSelector); - cy.get("@widgetHeight").then(($longTextheight: any) => { + agHelper.GetHeight(autoLayout._containerWidgetSelector); + cy.get("@eleHeight").then(($longTextheight: any) => { expect($longTextheight).to.be.greaterThan(Number($initialHeight)); // Remove some lines & verify if the container's height decreases - _.propPane.UpdatePropertyFieldValue("Text", "hello"); - _.agHelper.GetWidgetHeight(_.autoLayout._containerWidgetSelector); - cy.get("@widgetHeight").then((height: any) => { + propPane.UpdatePropertyFieldValue("Text", "hello"); + agHelper.GetHeight(autoLayout._containerWidgetSelector); + cy.get("@eleHeight").then((height: any) => { expect(height).to.be.lessThan(Number($longTextheight)); }); }); @@ -54,86 +54,78 @@ describe("Validating use cases for Auto Dimension", () => { }); it("2. Check if widget's bounding box fits on widget shrink", () => { - _.entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.TEXT, 100, 30); - _.propPane.UpdatePropertyFieldValue( + entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 100, 30); + propPane.UpdatePropertyFieldValue( "Text", "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", ); // Check if bounding box fits perfectly to the Text Widget - _.autoLayout.EnsureBoundingBoxFitsComponent( - _.autoLayout._textWidgetSelector, - _.autoLayout._textComponentSelector, + autoLayout.EnsureBoundingBoxFitsComponent( + autoLayout._textWidgetSelector, + autoLayout._textComponentSelector, ); // Drop another widget next to text widget so that it shrinks - _.entityExplorer.DragDropWidgetNVerify( - _.draggableWidgets.CONTAINER, - 10, - 30, - ); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.CONTAINER, 10, 30); // Check if bounding box fits perfectly to the Text Widget - _.autoLayout.EnsureBoundingBoxFitsComponent( - _.autoLayout._textWidgetSelector, - _.autoLayout._textComponentSelector, + autoLayout.EnsureBoundingBoxFitsComponent( + autoLayout._textWidgetSelector, + autoLayout._textComponentSelector, ); }); it("3. Check if widgets bounding box fits on canvas resizing", () => { - _.entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.TEXT, 100, 30); - _.propPane.UpdatePropertyFieldValue( + entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 100, 30); + propPane.UpdatePropertyFieldValue( "Text", "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", ); - _.entityExplorer.DragDropWidgetNVerify( - _.draggableWidgets.BUTTON, - 100, - 200, - ); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 100, 200); // reduce canvas size - _.agHelper.SetCanvasViewportWidth(500); + agHelper.SetCanvasViewportWidth(500); // Check if bounding box fits perfectly to the Text Widget - _.autoLayout.EnsureBoundingBoxFitsComponent( - _.autoLayout._textWidgetSelector, - _.autoLayout._textComponentSelector, + autoLayout.EnsureBoundingBoxFitsComponent( + autoLayout._textWidgetSelector, + autoLayout._textComponentSelector, ); // Check if bounding box fits perfectly to the Button Widget - _.autoLayout.EnsureBoundingBoxFitsComponent( - _.autoLayout._buttonWidgetSelector, - _.autoLayout._buttonComponentSelector, + autoLayout.EnsureBoundingBoxFitsComponent( + autoLayout._buttonWidgetSelector, + autoLayout._buttonComponentSelector, ); // increase canvas size - _.agHelper.SetCanvasViewportWidth(700); + agHelper.SetCanvasViewportWidth(700); // Check if bounding box fits perfectly to the Text Widget - _.autoLayout.EnsureBoundingBoxFitsComponent( - _.autoLayout._textWidgetSelector, - _.autoLayout._textComponentSelector, + autoLayout.EnsureBoundingBoxFitsComponent( + autoLayout._textWidgetSelector, + autoLayout._textComponentSelector, ); // Check if bounding box fits perfectly to the Button Widget - _.autoLayout.EnsureBoundingBoxFitsComponent( - _.autoLayout._buttonWidgetSelector, - _.autoLayout._buttonComponentSelector, + autoLayout.EnsureBoundingBoxFitsComponent( + autoLayout._buttonWidgetSelector, + autoLayout._buttonComponentSelector, ); // reduce canvas size less than mobile breakpoint - _.agHelper.SetCanvasViewportWidth(300); + agHelper.SetCanvasViewportWidth(300); // Check if bounding box fits perfectly to the Text Widget - _.autoLayout.EnsureBoundingBoxFitsComponent( - _.autoLayout._textWidgetSelector, - _.autoLayout._textComponentSelector, + autoLayout.EnsureBoundingBoxFitsComponent( + autoLayout._textWidgetSelector, + autoLayout._textComponentSelector, ); // Check if bounding box fits perfectly to the Button Widget - _.autoLayout.EnsureBoundingBoxFitsComponent( - _.autoLayout._buttonWidgetSelector, - _.autoLayout._buttonComponentSelector, + autoLayout.EnsureBoundingBoxFitsComponent( + autoLayout._buttonWidgetSelector, + autoLayout._buttonComponentSelector, ); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Analytics_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Analytics_spec.js index 05b42bdb06..77a1286a93 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Analytics_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Analytics_spec.js @@ -1,12 +1,12 @@ let appId; -import { agHelper } from "../../../../support/Objects/ObjectsCore"; +import { agHelper, homePage } from "../../../../support/Objects/ObjectsCore"; describe( "excludeForAirgap", "Checks for analytics for enableTelemtry", function () { before(() => { - agHelper.VisitNAssert("/applications", "getReleaseItems"); + homePage.NavigateToHome(); cy.get(".admin-settings-menu-option").click(); cy.get("[data-testid='APPSMITH_DISABLE_TELEMETRY']").should("be.checked"); //Bug 21191 cy.get("[data-testid='APPSMITH_DISABLE_TELEMETRY']").uncheck({ diff --git a/app/client/cypress/e2e/Regression/ClientSide/PropertyPane/PropertyPane_Search_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/PropertyPane/PropertyPane_Search_spec.ts index ca54e3565b..43661a2e2b 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/PropertyPane/PropertyPane_Search_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/PropertyPane/PropertyPane_Search_spec.ts @@ -69,8 +69,7 @@ describe("Property Pane Search", function () { propPane.Search("text formaTTing"); propPane.AssertIfPropertyOrSectionExists("textformatting", "STYLE"); - // Clear the search input for the next test - propPane.Search(""); + agHelper.ClearTextField(propPane._propertyPaneSearchInput); }); it("4. Search for Properties inside a panel", function () { @@ -140,7 +139,7 @@ describe("Property Pane Search", function () { propPane.AssertIfPropertyOrSectionExists("events", "CONTENT"); propPane.Search("visible"); - propPane.AssertIfPropertyOrSectionExists("events", "CONTENT", "visible"); + propPane.AssertIfPropertyOrSectionExists("general", "CONTENT", "visible"); propPane.Search("color"); propPane.AssertIfPropertyOrSectionExists("color", "STYLE"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/Listv2_onItemClick_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/Listv2_onItemClick_spec.js index eb40b2610b..102b1a49dd 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/Listv2_onItemClick_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/Listv2_onItemClick_spec.js @@ -93,7 +93,7 @@ describe("List widget v2 onItemClick", () => { draggableWidgets.INPUT_V2, 250, 50, - ".t--draggable-containerwidget", + draggableWidgets.CONTAINER, ); cy.get(`${widgetSelector("Input1")} input`) @@ -107,7 +107,7 @@ describe("List widget v2 onItemClick", () => { draggableWidgets.SELECT, 250, 50, - ".t--draggable-containerwidget", + draggableWidgets.CONTAINER, ); cy.get(`${widgetSelector("Select1")} button`) @@ -121,7 +121,7 @@ describe("List widget v2 onItemClick", () => { draggableWidgets.BUTTON, 250, 50, - ".t--draggable-containerwidget", + draggableWidgets.CONTAINER, ); cy.get(`${widgetSelector("Button1")} button`) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Migration_Spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Migration_Spec.js index c7d3ff823a..9dba049eaa 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Migration_Spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Migration_Spec.js @@ -205,6 +205,7 @@ describe("Migration Validate", function () { // cy.wait(4000); // cy.get("div.tableWrap").should("be.visible"); //wait for page load! + cy.wait("@getWorkspace"); cy.waitUntil(() => cy.get("div.tableWrap").should("be.visible"), { errorMsg: "Page is not loaded evn after 10 secs", diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/StatBox_DragAndDrop_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/StatBox_DragAndDrop_spec.js index 0164c4a3fa..1d0651a7ed 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/StatBox_DragAndDrop_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/StatBox_DragAndDrop_spec.js @@ -1,21 +1,27 @@ -const explorer = require("../../../../../locators/explorerlocators.json"); -import * as _ from "../../../../../support/Objects/ObjectsCore"; +import { + agHelper, + draggableWidgets, + entityExplorer, +} from "../../../../../support/Objects/ObjectsCore"; describe("Statbox Widget Functionality", function () { before(() => { cy.fixture("dynamicHeightStatboxdsl").then((val) => { - _.agHelper.AddDsl(val); + agHelper.AddDsl(val); }); }); it("1. Verify Statbox can be placed inside another widget", () => { - cy.get(explorer.addWidget).click(); // placing statbox widget inside container widget - cy.dragAndDropToWidget("statboxwidget", "containerwidget", { - x: 100, - y: 100, - }); - cy.openPropertyPaneWithIndex("statboxwidget", 1); - cy.openPropertyPaneWithIndex("statboxwidget", 0); + entityExplorer.DragDropWidgetNVerify( + draggableWidgets.STATBOX, + 300, + 100, + draggableWidgets.CONTAINER, + ); + entityExplorer.NavigateToSwitcher("Explorer"); + entityExplorer.AssertEntityPresenceInExplorer("Statbox1"); + entityExplorer.ExpandCollapseEntity("Container1"); + entityExplorer.AssertEntityPresenceInExplorer("Statbox2"); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV1/TableBugs_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV1/TableBugs_Spec.ts index eef0cb5dba..900ba047a0 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV1/TableBugs_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV1/TableBugs_Spec.ts @@ -59,7 +59,7 @@ describe("Verify various Table property bugs", function () { it("2. Bug 13299 - Verify Display Text does not contain garbage value for URL column type when null", function () { _.entityExplorer.SelectEntityByName("Table1", "Widgets"); - _.agHelper.GetNClick(_.table._columnSettings("image")); + _.agHelper.GetNClick(_.table._columnSettings("image", "Edit")); _.propPane.UpdatePropertyFieldValue( "Display text", @@ -100,7 +100,7 @@ describe("Verify various Table property bugs", function () { it("3. Bug 13299 - Verify Display Text does not contain garbage value for URL column type when undefined", function () { _.entityExplorer.SelectEntityByName("Table1", "Widgets"); - _.agHelper.GetNClick(_.table._columnSettings("image")); + _.agHelper.GetNClick(_.table._columnSettings("image", "Edit")); _.propPane.UpdatePropertyFieldValue( "Display text", diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/Inline_editing_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/Inline_editing_spec.js index 2ce39a9f21..430589eae6 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/Inline_editing_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/Inline_editing_spec.js @@ -1,17 +1,23 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); const widgetsPage = require("../../../../../locators/Widgets.json"); -import * as _ from "../../../../../support/Objects/ObjectsCore"; +import { + agHelper, + entityExplorer, + propPane, + table, + draggableWidgets, +} from "../../../../../support/Objects/ObjectsCore"; import { PROPERTY_SELECTOR } from "../../../../../locators/WidgetLocators"; describe("Table widget inline editing functionality", () => { afterEach(() => { - _.agHelper.SaveLocalStorageCache(); + agHelper.SaveLocalStorageCache(); }); beforeEach(() => { - _.agHelper.RestoreLocalStorageCache(); + agHelper.RestoreLocalStorageCache(); cy.fixture("Table/InlineEditingDSL").then((val) => { - _.agHelper.AddDsl(val); + agHelper.AddDsl(val); }); }); @@ -637,7 +643,7 @@ describe("Table widget inline editing functionality", () => { it("22. should check that inline editing works with text wrapping disabled", () => { cy.fixture("Table/InlineEditingDSL").then((val) => { - _.agHelper.AddDsl(val); + agHelper.AddDsl(val); }); cy.openPropertyPane("tablewidgetv2"); cy.makeColumnEditable("step"); @@ -661,33 +667,40 @@ describe("Table widget inline editing functionality", () => { }); it("24. should check that doesn't grow taller when text wrapping is disabled", () => { - cy.openPropertyPane("tablewidgetv2"); - cy.makeColumnEditable("step"); - cy.editTableCell(0, 0); - cy.get( - "[data-colindex='0'][data-rowindex='0'] .t--inlined-cell-editor", - ).should("have.css", "height", "32px"); - cy.enterTableCellValue(0, 0, "this is a very long cell value"); - cy.get( - "[data-colindex='0'][data-rowindex='0'] .t--inlined-cell-editor", - ).should("have.css", "height", "32px"); + entityExplorer.SelectEntityByName("Table1"); + table.EnableEditableOfColumn("step"); + table.EditTableCell(0, 0, "", false); + agHelper.GetHeight(table._editCellEditor); + cy.get("@eleHeight").then(($initiaHeight) => { + expect(Number($initiaHeight)).to.eq(28); + table.EditTableCell( + 1, + 0, + "this is a very long cell value to check the height of the cell is growing accordingly", + false, + ); + agHelper.GetHeight(table._editCellEditor); + cy.get("@eleHeight").then(($newHeight) => { + expect(Number($newHeight)).to.eq(Number($initiaHeight)); + }); + }); }); it("25. should check that grows taller when text wrapping is enabled", () => { - cy.openPropertyPane("tablewidgetv2"); - cy.makeColumnEditable("step"); - cy.editColumn("step"); - cy.get(".t--property-control-cellwrapping .ads-v2-switch").click({ - force: true, + entityExplorer.SelectEntityByName("Table1"); + table.EnableEditableOfColumn("step"); + table.EditColumn("step"); + propPane.TogglePropertyState("Cell Wrapping", "On"); + table.EditTableCell( + 0, + 0, + "this is a very long cell value to check the height of the cell is growing accordingly", + false, + ); + agHelper.GetHeight(table._editCellEditor); + cy.get("@eleHeight").then(($newHeight) => { + expect(Number($newHeight)).to.be.greaterThan(34); }); - cy.editTableCell(0, 0); - cy.get( - "[data-colindex='0'][data-rowindex='0'] .t--inlined-cell-editor", - ).should("have.css", "height", "34px"); - cy.enterTableCellValue(0, 0, "this is a very long cell value"); - cy.get( - "[data-colindex='0'][data-rowindex='0'] .t--inlined-cell-editor", - ).should("not.have.css", "height", "34px"); }); it("26. should check if updatedRowIndex is getting updated for single row update mode", () => { @@ -741,13 +754,13 @@ describe("Table widget inline editing functionality", () => { }); it("27. should check if updatedRowIndex is getting updated for multi row update mode", () => { - _.entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.TEXT, 400, 400); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 400, 400); cy.get(".t--widget-textwidget").should("exist"); cy.updateCodeInput( ".t--property-control-text", `{{Table1.updatedRowIndex}}`, ); - _.entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.BUTTON, 300, 300); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 300, 300); cy.get(".t--widget-buttonwidget").should("exist"); cy.get(PROPERTY_SELECTOR.onClick).find(".t--js-toggle").click(); cy.updateCodeInput(".t--property-control-label", "Reset"); @@ -756,30 +769,25 @@ describe("Table widget inline editing functionality", () => { `{{resetWidget("Table1",true)}}`, ); - cy.openPropertyPane("tablewidgetv2"); - - cy.makeColumnEditable("step"); - cy.get(".ads-v2-segmented-control-value-CUSTOM").click({ force: true }); - cy.wait(1000); + entityExplorer.NavigateToSwitcher("Explorer"); + entityExplorer.SelectEntityByName("Table1"); + table.EnableEditableOfColumn("step"); + agHelper.GetNClick(table._updateMode("Multi")); // case 1: check if updatedRowIndex is 0, when cell at row 0 is updated. - //_.table.EditTableCell(0, 0, "#12"); - cy.editTableCell(0, 0); - cy.enterTableCellValue(0, 0, "#12").type("{enter}"); + table.EditTableCell(0, 0, "#12"); cy.get(commonlocators.textWidgetContainer).should("contain.text", 0); // case 2: check if the updateRowIndex is -1 when widget is reset - //_.table.EditTableCell(0, 1, "#13");//Method to be improve! - cy.editTableCell(0, 1); - cy.enterTableCellValue(0, 1, "#13").type("{enter}"); + table.EditTableCell(1, 0, "#13"); cy.get(commonlocators.textWidgetContainer).should("contain.text", 1); + cy.contains("Reset").click({ force: true }); cy.get(commonlocators.textWidgetContainer).should("contain.text", -1); // case 3: check if the updatedRowIndex changes to -1 when the table data changes. cy.wait(1000); - cy.editTableCell(0, 2); - cy.enterTableCellValue(0, 2, "#14").type("{enter}"); + table.EditTableCell(2, 0, "#14"); cy.get(commonlocators.textWidgetContainer).should("contain.text", 2); cy.openPropertyPane("tablewidgetv2"); cy.get(widgetsPage.tabedataField).type("{backspace}"); diff --git a/app/client/cypress/e2e/Regression/ServerSide/QueryPane/S3_1_spec.js b/app/client/cypress/e2e/Regression/ServerSide/QueryPane/S3_1_spec.js index 0546b50ae2..ddafae0461 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/QueryPane/S3_1_spec.js +++ b/app/client/cypress/e2e/Regression/ServerSide/QueryPane/S3_1_spec.js @@ -457,7 +457,7 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications", cy.ClickGotIt(); //Verifying Searching File from UI - cy.xpath(queryLocators.searchFilefield).type("S3Crud_").wait(7000); //for search to finish + cy.xpath(queryLocators.searchFilefield).type("S3Crud_").wait(10000); //for search to finish cy.get(".t--widget-textwidget span:contains('" + fileName + "')") .should("have.length", 1) diff --git a/app/client/cypress/fixtures/Table/InlineEditingDSL.json b/app/client/cypress/fixtures/Table/InlineEditingDSL.json index e148daec2f..8c2e9a863c 100644 --- a/app/client/cypress/fixtures/Table/InlineEditingDSL.json +++ b/app/client/cypress/fixtures/Table/InlineEditingDSL.json @@ -16,11 +16,11 @@ "version":59, "minHeight":1292, "dynamicTriggerPathList":[ - + ], "parentColumnSpace":1, "dynamicBindingPathList":[ - + ], "leftColumn":0, "children":[ @@ -220,10 +220,11 @@ "action":"" } ], - "columnWidthMap":{ - "task":245, - "step":62, - "status":75 + "bottomRow": 22, + "columnWidthMap": { + "task": 313, + "step": 222, + "status": 140 }, "columnOrder":[ "step", @@ -279,9 +280,8 @@ "leftColumn":0, "rightColumn":64, "topRow":2, - "bottomRow":24, "parentId":"0" } ] } -} \ No newline at end of file +} diff --git a/app/client/cypress/locators/WidgetLocators.ts b/app/client/cypress/locators/WidgetLocators.ts index 0b3de5792d..01cf01b134 100644 --- a/app/client/cypress/locators/WidgetLocators.ts +++ b/app/client/cypress/locators/WidgetLocators.ts @@ -39,6 +39,7 @@ export const WIDGET = { FORM: "formwidget", ICONBUTTON: "iconbuttonwidget", IMAGE: "imagewidget", + STATBOX: "statboxwidget", } as const; // property pane element selector are maintained here diff --git a/app/client/cypress/support/Pages/AggregateHelper.ts b/app/client/cypress/support/Pages/AggregateHelper.ts index b6d2186d75..542e4924dc 100644 --- a/app/client/cypress/support/Pages/AggregateHelper.ts +++ b/app/client/cypress/support/Pages/AggregateHelper.ts @@ -3,6 +3,7 @@ import { v4 as uuidv4 } from "uuid"; import { ObjectsRegistry } from "../Objects/Registry"; import type CodeMirror from "codemirror"; import { ReusableHelper } from "../Objects/ReusableHelper"; +import type { EntityItemsType } from "./AssertHelper"; import { EntityItems } from "./AssertHelper"; type ElementType = string | JQuery; @@ -10,7 +11,7 @@ type ElementType = string | JQuery; interface DeleteParams { action: "Copy to page" | "Move to page" | "Delete" | "Prettify code"; subAction?: string; - entityType?: EntityItems; + entityType?: EntityItemsType; toastToValidate?: string; } interface SubActionParams { @@ -645,11 +646,15 @@ export class AggregateHelper extends ReusableHelper { public HoverElement(selector: string, index = 0, waitTimeInterval = 100) { //this.ScrollTo(this.GetElement(selector)) - return this.GetElement(selector) - .eq(index) - .scrollIntoView() - .realHover() - .wait(waitTimeInterval); + return ( + this.GetElement(selector) + .eq(index) + .scrollIntoView() + .realTouch({ position: "center" }) + .realHover({ pointer: "mouse" }) + //.trigger("mousemove", { eventConstructor: "MouseEvent" }) + .wait(waitTimeInterval) + ); } public GetSiblingNClick( @@ -885,7 +890,10 @@ export class AggregateHelper extends ReusableHelper { } } - public DeleteEntityNAssert(entityType: EntityItems, toAssertAction = true) { + public DeleteEntityNAssert( + entityType: EntityItemsType, + toAssertAction = true, + ) { if (entityType != EntityItems.Widget) this.GetNClick(this.locator._contextMenuItem("Are you sure?")); toAssertAction && this.assertHelper.AssertDelete(entityType); @@ -1316,15 +1324,15 @@ export class AggregateHelper extends ReusableHelper { return this.GetElement(selector).scrollTo(position).wait(2000); } - public GetWidgetWidth(widgetSelector: string) { + public GetWidth(widgetSelector: string) { this.GetElement(widgetSelector).then(($element) => { - cy.wrap(Number($element.width())).as("widgetWidth"); + cy.wrap(Number($element.width())).as("eleWidth"); }); } - public GetWidgetHeight(widgetSelector: string) { + public GetHeight(widgetSelector: string) { this.GetElement(widgetSelector).then(($element) => { - cy.wrap(Number($element.height())).as("widgetHeight"); + cy.wrap(Number($element.height())).as("eleHeight"); }); } @@ -1394,7 +1402,7 @@ export class AggregateHelper extends ReusableHelper { } public VisitNAssert(url: string, apiToValidate = "") { - cy.visit(url); + cy.visit(url, { timeout: 60000 }); if (apiToValidate.includes("getReleaseItems") && Cypress.env("AIRGAPPED")) { this.Sleep(2000); } else apiToValidate && this.AssertNetworkStatus(apiToValidate); diff --git a/app/client/cypress/support/Pages/AppSettings/AppSettings.ts b/app/client/cypress/support/Pages/AppSettings/AppSettings.ts index ffe8dd54fe..fdc8e2a271 100644 --- a/app/client/cypress/support/Pages/AppSettings/AppSettings.ts +++ b/app/client/cypress/support/Pages/AppSettings/AppSettings.ts @@ -23,6 +23,7 @@ export class AppSettings { }, }, _navigationMenuItem: ".t--page-switch-tab", + _sideNavbar: ".t--app-viewer-navigation-sidebar", _getPageSettingsHeader: (pageName: string) => `#t--page-settings-${pageName}`, _updateStatus: ".ads-v2-icon.rotate", diff --git a/app/client/cypress/support/Pages/AssertHelper.ts b/app/client/cypress/support/Pages/AssertHelper.ts index c8de9a6ff9..d8bd70fb95 100644 --- a/app/client/cypress/support/Pages/AssertHelper.ts +++ b/app/client/cypress/support/Pages/AssertHelper.ts @@ -2,14 +2,17 @@ import "cypress-wait-until"; import { ObjectsRegistry } from "../Objects/Registry"; import { ReusableHelper } from "../Objects/ReusableHelper"; -export enum EntityItems { - Page, - Query, - Api, - JSObject, - Widget, - Datasource, -} +export const EntityItems = { + Page: 0, + Query: 1, + Api: 2, + JSObject: 3, + Widget: 4, + Datasource: 5, +} as const; + +export type EntityItemsType = (typeof EntityItems)[keyof typeof EntityItems]; + export class AssertHelper extends ReusableHelper { private locator = ObjectsRegistry.CommonLocators; public _modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl"; @@ -30,7 +33,7 @@ export class AssertHelper extends ReusableHelper { cy.window().should("have.property", "onload"); } - public AssertDelete(entityType: EntityItems) { + public AssertDelete(entityType: EntityItemsType) { let networkCall = ""; switch (entityType) { case EntityItems.Api: diff --git a/app/client/cypress/support/Pages/AutoLayout.ts b/app/client/cypress/support/Pages/AutoLayout.ts index caf73d9b92..e6c5b3f34d 100644 --- a/app/client/cypress/support/Pages/AutoLayout.ts +++ b/app/client/cypress/support/Pages/AutoLayout.ts @@ -182,12 +182,12 @@ export class AutoLayout { ); // Increase the length of button label & verify if the component expands - this.agHelper.GetWidgetWidth(this._buttonWidgetSelector); - cy.get("@widgetWidth").then(($initialWidth) => { + this.agHelper.GetWidth(this._buttonWidgetSelector); + cy.get("@eleWidth").then(($initialWidth) => { this.propPane.UpdatePropertyFieldValue("Label", "Lengthy Button Label"); this.agHelper.Sleep(); //to allow time for widget to resize itself before checking width again! - this.agHelper.GetWidgetWidth(this._buttonWidgetSelector); - cy.get("@widgetWidth").then((width: any) => { + this.agHelper.GetWidth(this._buttonWidgetSelector); + cy.get("@eleWidth").then((width: any) => { //cy.get("@initialWidth").then((initialWidth) => { expect(width).to.be.greaterThan(Number($initialWidth)); //}); @@ -201,12 +201,12 @@ export class AutoLayout { ); // Decrease the length of button label & verify if the component shrinks - this.agHelper.GetWidgetWidth(this._buttonWidgetSelector); - cy.get("@widgetWidth").then(($initialWidth) => { + this.agHelper.GetWidth(this._buttonWidgetSelector); + cy.get("@eleWidth").then(($initialWidth) => { this.propPane.UpdatePropertyFieldValue("Label", "Label"); this.agHelper.Sleep(); //to allow time for widget to resize itself before checking width again! - this.agHelper.GetWidgetWidth(this._buttonWidgetSelector); - cy.get("@widgetWidth").then((width: any) => { + this.agHelper.GetWidth(this._buttonWidgetSelector); + cy.get("@eleWidth").then((width: any) => { expect(width).to.be.lessThan(Number($initialWidth)); }); }); @@ -241,15 +241,15 @@ export class AutoLayout { // Add multi-line text & verify if the component's height increases - this.agHelper.GetWidgetHeight(this._textWidgetSelector); - cy.get("@widgetHeight").then(($initialHeight) => { + this.agHelper.GetHeight(this._textWidgetSelector); + cy.get("@eleHeight").then(($initialHeight) => { this.propPane.UpdatePropertyFieldValue( "Text", "hello\nWorld\nThis\nis\na\nMulti-line\nText", ); this.agHelper.Sleep(); //to allow time for widget to resize itself before checking height again! - this.agHelper.GetWidgetHeight(this._textWidgetSelector); - cy.get("@widgetHeight").then((height: any) => { + this.agHelper.GetHeight(this._textWidgetSelector); + cy.get("@eleHeight").then((height: any) => { expect(height).to.be.greaterThan(Number($initialHeight)); }); }); @@ -262,12 +262,12 @@ export class AutoLayout { // Remove some lines & verify if the component's height decreases - this.agHelper.GetWidgetHeight(this._textWidgetSelector); - cy.get("@widgetHeight").then(($initialHeight) => { + this.agHelper.GetHeight(this._textWidgetSelector); + cy.get("@eleHeight").then(($initialHeight) => { this.propPane.UpdatePropertyFieldValue("Text", "hello\nWorld\nblabla"); this.agHelper.Sleep(); //to allow time for widget to resize itself before checking width again! - this.agHelper.GetWidgetHeight(this._textWidgetSelector); - cy.get("@widgetHeight").then((height: any) => { + this.agHelper.GetHeight(this._textWidgetSelector); + cy.get("@eleHeight").then((height: any) => { expect(height).to.be.lessThan(Number($initialHeight)); }); }); diff --git a/app/client/cypress/support/Pages/DeployModeHelper.ts b/app/client/cypress/support/Pages/DeployModeHelper.ts index 7b795410ad..e5550d7e4b 100644 --- a/app/client/cypress/support/Pages/DeployModeHelper.ts +++ b/app/client/cypress/support/Pages/DeployModeHelper.ts @@ -89,7 +89,7 @@ export class DeployMode { public NavigateBacktoEditor() { this.assertHelper.AssertDocumentReady(); - cy.get(this.locator._backToEditor).click({ force: true }); + this.agHelper.GetNClick(this.locator._backToEditor, 0, true); this.agHelper.Sleep(2000); localStorage.setItem("inDeployedMode", "false"); this.assertHelper.AssertDocumentReady(); diff --git a/app/client/cypress/support/Pages/EntityExplorer.ts b/app/client/cypress/support/Pages/EntityExplorer.ts index 5b08ce3e8b..fb8d594d2a 100644 --- a/app/client/cypress/support/Pages/EntityExplorer.ts +++ b/app/client/cypress/support/Pages/EntityExplorer.ts @@ -150,8 +150,8 @@ export class EntityExplorer { } public AssertEntityPresenceInExplorer(entityNameinLeftSidebar: string) { - cy.xpath(this._entityNameInExplorer(entityNameinLeftSidebar)).should( - "have.length", + this.agHelper.AssertElementLength( + this._entityNameInExplorer(entityNameinLeftSidebar), 1, ); } @@ -318,12 +318,24 @@ export class EntityExplorer { .first() .trigger("dragstart", { force: true }) .trigger("mousemove", x, y, { force: true }); - cy.get(dropTargetId ? dropTargetId : this.locator._dropHere) + cy.get( + dropTargetId + ? this.locator._widgetInCanvas(dropTargetId) + + " " + + this.locator._dropHere + : this.locator._dropHere, + ) .first() .trigger("mousemove", x, y, { eventConstructor: "MouseEvent" }) .trigger("mousemove", x, y, { eventConstructor: "MouseEvent" }); this.agHelper.Sleep(200); - cy.get(dropTargetId ? dropTargetId : this.locator._dropHere) + cy.get( + dropTargetId + ? this.locator._widgetInCanvas(dropTargetId) + + " " + + this.locator._dropHere + : this.locator._dropHere, + ) .first() .trigger("mouseup", x, y, { eventConstructor: "MouseEvent" }); this.agHelper.AssertAutoSave(); //settling time for widget on canvas! @@ -331,11 +343,15 @@ export class EntityExplorer { cy.get(".t--modal-widget").should("exist"); } else { if (dropTargetId) { - cy.get( - `${dropTargetId} ${this.locator._widgetInCanvas(widgetType)}`, - ).should("exist"); + this.agHelper.AssertElementExist( + `${this.locator._widgetInCanvas( + dropTargetId, + )} ${this.locator._widgetInCanvas(widgetType)}`, + ); } else { - cy.get(this.locator._widgetInCanvas(widgetType)).should("exist"); + this.agHelper.AssertElementExist( + this.locator._widgetInCanvas(widgetType), + ); } } this.agHelper.Sleep(200); //waiting a bit for widget properties to open diff --git a/app/client/cypress/support/Pages/PropertyPane.ts b/app/client/cypress/support/Pages/PropertyPane.ts index d9b74156b5..2b999f39e4 100644 --- a/app/client/cypress/support/Pages/PropertyPane.ts +++ b/app/client/cypress/support/Pages/PropertyPane.ts @@ -429,12 +429,9 @@ export class PropertyPane { } public Search(query: string) { - cy.get(this._propertyPaneSearchInput) - .first() - .then((el: any) => { - cy.get(el).clear(); - if (query) cy.get(el).type(query, { force: true }); - }); + this.agHelper.ClearTextField(this._propertyPaneSearchInput); + this.agHelper.TypeText(this._propertyPaneSearchInput, query); + this.agHelper.Sleep(); } public ToggleSection(section: string) { diff --git a/app/client/cypress/support/Pages/Table.ts b/app/client/cypress/support/Pages/Table.ts index c6005a14d1..703f208419 100644 --- a/app/client/cypress/support/Pages/Table.ts +++ b/app/client/cypress/support/Pages/Table.ts @@ -62,7 +62,8 @@ export class Table { this._tableWidgetVersion(version) + ` .tbody .td[data-rowindex=${rowNum}][data-colindex=${colNum}]`; _editCellIconDiv = ".t--editable-cell-icon"; - _editCellEditorInput = ".t--inlined-cell-editor input"; + _editCellEditor = ".t--inlined-cell-editor"; + _editCellEditorInput = this._editCellEditor + " input"; _tableRowColumnDataVersion = (version: "v1" | "v2") => `${version == "v1" ? " div div" : " .cell-wrapper"}`; _tableRowColumnData = ( @@ -111,12 +112,30 @@ export class Table { _filterOperatorDropdown = ".t--table-filter-operators-dropdown"; private _downloadBtn = ".t--table-download-btn"; private _downloadOption = ".t--table-download-data-option"; - _columnSettings = (columnName: string) => - "//input[@placeholder='Column title'][@value='" + - columnName + - "']/parent::div/parent::div/parent::div/parent::div/following-sibling::div/button[contains(@class, 't--edit-column-btn')]"; - _columnSettingsV2 = (columnName: string) => - `.t--property-pane-view .tablewidgetv2-primarycolumn-list div[data-rbd-draggable-id=${columnName}] .t--edit-column-btn`; + _columnSettings = ( + columnName: string, + type: "Edit" | "Visibility" | "Editable", + ) => { + const classMap = { + Edit: "t--edit-column-btn", + Visibility: "t--show-column-btn", + Editable: "t--card-checkbox", + }; + const classToCheck = classMap[type]; + return `//input[@placeholder='Column title'][@value='${columnName}']/parent::div/parent::div/parent::div/parent::div/following-sibling::div/*[contains(@class, '${classToCheck}')]`; + }; + _columnSettingsV2 = ( + columnName: string, + type: "Edit" | "Visibility" | "Editable", + ) => { + const classMap = { + Edit: ".t--edit-column-btn", + Visibility: ".t--show-column-btn", + Editable: ".t--card-checkbox", + }; + const classToCheck = classMap[type]; + return `.t--property-pane-view .tablewidgetv2-primarycolumn-list div[data-rbd-draggable-id=${columnName}] ${classToCheck}`; + }; _showPageItemsCount = "div.show-page-items"; _filtersCount = this._filterBtn + " span.action-title"; _headerCell = (column: string) => @@ -129,6 +148,8 @@ export class Table { _newRow = ".new-row"; _connectDataHeader = ".t--cypress-table-overlay-header"; _connectDataButton = ".t--cypress-table-overlay-connectdata"; + _updateMode = (mode: "Single" | "Multi") => + "//span[text()='" + mode + " Row']/ancestor::div"; public WaitUntilTableLoad( rowIndex = 0, @@ -525,13 +546,36 @@ export class Table { public EditColumn(columnName: string, tableVersion: "v1" | "v2") { const colSettings = tableVersion == "v1" - ? this._columnSettings(columnName) - : this._columnSettingsV2(columnName); + ? this._columnSettings(columnName, "Edit") + : this._columnSettingsV2(columnName, "Edit"); this.agHelper.GetNClick(colSettings); } - //Method to be improved! - public EditTableCell(rowIndex: number, colIndex: number, newValue: string) { + public EnableVisibilityOfColumn( + columnName: string, + tableVersion: "v1" | "v2", + ) { + const colSettings = + tableVersion == "v1" + ? this._columnSettings(columnName, "Visibility") + : this._columnSettingsV2(columnName, "Visibility"); + this.agHelper.GetNClick(colSettings); + } + + public EnableEditableOfColumn(columnName: string, tableVersion: "v1" | "v2") { + const colSettings = + tableVersion == "v1" + ? this._columnSettings(columnName, "Editable") + : this._columnSettingsV2(columnName, "Editable"); + this.agHelper.GetNClick(colSettings); + } + + public EditTableCell( + rowIndex: number, + colIndex: number, + newValue = "", + toSaveNewValue = true, + ) { this.agHelper.HoverElement(this._tableRow(rowIndex, colIndex, "v2")); this.agHelper.GetNClick( this._tableRow(rowIndex, colIndex, "v2") + " " + this._editCellIconDiv, @@ -541,13 +585,16 @@ export class Table { " " + this._editCellEditorInput, ); - this.agHelper.UpdateInputValue( - this._tableRow(rowIndex, colIndex, "v2") + - " " + - this._editCellEditorInput, - newValue, - ); - this.agHelper.PressEnter(); + if (newValue) { + this.agHelper.UpdateInputValue( + this._tableRow(rowIndex, colIndex, "v2") + + " " + + this._editCellEditorInput, + newValue, + ); + } + toSaveNewValue && + this.agHelper.TypeText(this._editCellEditorInput, "{enter}", 0, true); } public DeleteColumn(colId: string) { diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index dba3c112f5..06ff9d755b 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -271,12 +271,15 @@ Cypress.Commands.add("Signup", (uname, pword) => { cy.get(signupPage.password).type(pword); cy.get(signupPage.submitBtn).click(); cy.wait(1000); - cy.get(signupPage.roleDropdown).click(); - cy.get(signupPage.dropdownOption).click(); - cy.get(signupPage.useCaseDropdown).click(); - cy.get(signupPage.dropdownOption).click(); - cy.get(signupPage.roleUsecaseSubmit).click({ force: true }); - + cy.get("body").then(($body) => { + if ($body.find(signupPage.roleDropdown).length > 0) { + cy.get(signupPage.roleDropdown).click(); + cy.get(signupPage.dropdownOption).click(); + cy.get(signupPage.useCaseDropdown).click(); + cy.get(signupPage.dropdownOption).click(); + cy.get(signupPage.roleUsecaseSubmit).click({ force: true }); + } + }); cy.wait("@getMe"); cy.wait(3000); initLocalstorage(); diff --git a/app/client/cypress/support/e2e.js b/app/client/cypress/support/e2e.js index 7916da8b9f..0d0547710d 100644 --- a/app/client/cypress/support/e2e.js +++ b/app/client/cypress/support/e2e.js @@ -169,11 +169,14 @@ after(function () { if (RapidMode.config.enabled) { return; } - //-- Deleting the application by Api---// - cy.DeleteAppByApi(); - //-- LogOut Application---// - cy.LogOut(); - + if (Cypress.env("CYPRESS_CI") === "1") { + //-- Deleting the application by Api---// + cy.DeleteAppByApi(); + //-- LogOut Application---// + cy.LogOut(); + } else { + cy.log("Running locally, hence skipping app delete!"); + } // Commenting until Upgrade Appsmith cases are fixed // const tedUrl = "http://localhost:5001/v1/parent/cmd"; // cy.log("Start the appsmith container");