test: Cypress | Flaky fixes (#24593)

## Description
- This PR fixes below flaky tests:
  - AppNavigation/NavigationSettings_spec.js
  - Autocomplete/JS_AC_spec.ts - 6th case
  - Analytics_spec.js - increased restart time
- Apps/ReconnectDatasource_spec.js - Increasing timeout for better pass
rate
  - TableV2/Inline_editing_spec.js - trial fix
  - OneClickBinding/mongoDB_spec.ts
  - OneClickBinding/postgres_spec.ts
  - ScrollIntoView() fixes
  - /OtherUIFeatures/ViewMode_spec.js - flaky fix
  - TableV2/TableV2_PropertyPane_spec.js
  - OtherUIFeatures/UpdateApplication_spec.js
  - ListV2/Childwigets/List_FilePicker_spec.js

#### 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:
- [X] Added `Test Plan Approved` label after changes were reviewed
This commit is contained in:
Aishwarya-U-R 2023-06-20 14:28:06 +05:30 committed by GitHub
parent 160aa162ea
commit 6651475313
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 249 additions and 202 deletions

View File

@ -287,7 +287,7 @@ jobs:
if [[ ${{ inputs.pr }} -ne 0 ]]; then
echo "COMMIT_INFO_MESSAGE=${{ env.COMMIT_INFO_MESSAGE }}" >> $GITHUB_ENV
else
echo "COMMIT_INFO_MESSAGE=$(echo \"${{ env.EVENT_COMMITS }}\" | awk -F '\\\\n' '{print $1}')" >> $GITHUB_ENV
echo "COMMIT_INFO_MESSAGE=$(echo \"${{ env.EVENT_COMMITS }}\" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')" >> $GITHUB_ENV
fi
- name: Run the cypress test

View File

@ -3,7 +3,7 @@ import { defineConfig } from "cypress";
export default defineConfig({
watchForFileChanges: false,
defaultCommandTimeout: 30000,
requestTimeout: 21000,
requestTimeout: 60000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
videoUploadOnPasses: false,
@ -19,6 +19,7 @@ export default defineConfig({
chromeWebSecurity: false,
viewportHeight: 1200,
viewportWidth: 1600,
scrollBehavior: "center",
retries: {
runMode: 1,
openMode: 0,

View File

@ -4,6 +4,7 @@ import {
locators,
entityExplorer,
deployMode,
appSettings,
} from "../../../../support/Objects/ObjectsCore";
describe("Test app's navigation settings", function () {
@ -44,6 +45,7 @@ describe("Test app's navigation settings", function () {
).click({
force: true,
});
agHelper.AssertElementExist(appSettings.locators._sideNavbar);
deployMode.DeployApp();
cy.get(appNavigationLocators.header).should("not.exist");
cy.get(appNavigationLocators.topStacked).should("not.exist");

View File

@ -223,8 +223,10 @@ describe("Autocomplete tests", () => {
agHelper.GetNClick(jsEditor._lineinJsEditor(7));
agHelper.TypeText(
locators._codeMirrorTextArea,
"const callBack = (user) => user.l",
"const callBack = (user) => user",
);
agHelper.Sleep(500);
agHelper.TypeText(locators._codeMirrorTextArea, ".l");
agHelper.GetNAssertElementText(locators._hints, "label");
agHelper.TypeText(locators._codeMirrorTextArea, "abel;");
agHelper.TypeText(locators._codeMirrorTextArea, "data.");
@ -342,7 +344,7 @@ describe("Autocomplete tests", () => {
entityExplorer.SelectEntityByName("JSObject1", "Queries/JS");
agHelper.GetNClick(jsEditor._lineinJsEditor(5));
agHelper.TypeText(locators._codeMirrorTextArea, "JSObject2");
agHelper.Sleep();
agHelper.Sleep(500);
agHelper.TypeText(locators._codeMirrorTextArea, ".");
agHelper.GetNAssertElementText(

View File

@ -1,22 +1,29 @@
import oneClickBindingLocator from "../../../../../locators/OneClickBindingLocator";
import * as _ from "../../../../../support/Objects/ObjectsCore";
import {
agHelper,
entityExplorer,
dataSources,
table,
draggableWidgets,
assertHelper,
} from "../../../../../support/Objects/ObjectsCore";
import { OneClickBinding } from "../spec_utility";
const oneClickBinding = new OneClickBinding();
describe.skip("one click binding mongodb datasource", function () {
describe("one click binding mongodb datasource", function () {
before(() => {
_.entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.TABLE, 400);
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE, 450, 200);
});
it("1. test connect datasource", () => {
//#region bind to mongoDB datasource
_.entityExplorer.NavigateToSwitcher("Explorer");
entityExplorer.NavigateToSwitcher("Explorer");
_.dataSources.CreateDataSource("Mongo");
dataSources.CreateDataSource("Mongo");
cy.get("@dsName").then((dsName) => {
_.entityExplorer.SelectEntityByName("Table1", "Widgets");
entityExplorer.SelectEntityByName("Table1", "Widgets");
oneClickBinding.ChooseAndAssertForm(
`New from ${dsName}`,
@ -26,20 +33,20 @@ describe.skip("one click binding mongodb datasource", function () {
);
});
_.agHelper.GetNClick(oneClickBindingLocator.connectData);
agHelper.GetNClick(oneClickBindingLocator.connectData);
_.assertHelper.AssertNetworkStatus("@postExecute");
assertHelper.AssertNetworkStatus("@postExecute");
_.agHelper.Sleep(2000);
agHelper.Sleep(2000);
//#endregion
//#region validate search through table is working
const rowWithAValidText = "Mike Flanagan";
//enter a search text
_.agHelper.TypeText(_.table._searchInput, rowWithAValidText);
_.agHelper.Sleep();
agHelper.TypeText(table._searchInput, rowWithAValidText);
agHelper.Sleep();
// check if the table rows are present for the given search entry
_.agHelper.GetNAssertContains(
agHelper.GetNAssertContains(
oneClickBindingLocator.validTableRowData,
rowWithAValidText,
);
@ -47,19 +54,16 @@ describe.skip("one click binding mongodb datasource", function () {
//#region table update operation is working
const someColumnIndex = 1;
(cy as any).editTableCell(someColumnIndex, 0);
//update the first value of the row
const someUUID = Cypress._.random(0, 1e6);
const enteredSomeValue = "123" + someUUID;
(cy as any).enterTableCellValue(someColumnIndex, 0, enteredSomeValue);
_.agHelper.Sleep();
(cy as any).saveTableCellValue(someColumnIndex, 0);
//update the first value of the row
table.EditTableCell(0, someColumnIndex, enteredSomeValue);
agHelper.Sleep();
//commit that update
(cy as any).saveTableRow(12, 0);
_.agHelper.Sleep();
agHelper.Sleep();
// check if the updated value is present
(cy as any).readTableV2data(0, someColumnIndex).then((cellData: any) => {
@ -69,30 +73,28 @@ describe.skip("one click binding mongodb datasource", function () {
//#region check if the table insert operation works
//clear input
_.table.resetSearch();
// cy.get(".t--widget-tablewidgetv2 .t--search-input input").clear();
table.ResetSearch();
//lets create a new row and check to see the insert operation is working
_.agHelper.GetNClick(_.table._addNewRow);
_.agHelper.AssertElementExist(_.table._newRow);
agHelper.GetNClick(table._addNewRow);
agHelper.AssertElementExist(table._newRow);
const someText = "new row " + Cypress._.random(0, 1e6);
const searchColumnIndex = 3;
(cy as any).enterTableCellValue(searchColumnIndex, 0, someText);
table.EditTableCell(0, searchColumnIndex, someText);
(cy as any).saveTableCellValue(searchColumnIndex, 0);
// save a row with some random text
_.agHelper.GetNClick(_.table._saveNewRow, 0, true);
agHelper.GetNClick(table._saveNewRow, 0, true);
_.agHelper.Sleep(5000);
agHelper.Sleep(2000);
//search the table for a row having the text used to create a new row
_.agHelper.ClearTextField(_.table._searchInput);
_.agHelper.TypeText(_.table._searchInput, someText);
_.agHelper.Sleep();
agHelper.ClearTextField(table._searchInput);
agHelper.TypeText(table._searchInput, someText);
agHelper.Sleep();
//check if that row is present
_.agHelper.GetNAssertContains(
agHelper.GetNAssertContains(
oneClickBindingLocator.validTableRowData,
someText,
);

View File

@ -1,21 +1,28 @@
import oneClickBindingLocator from "../../../../../locators/OneClickBindingLocator";
import * as _ from "../../../../../support/Objects/ObjectsCore";
import { OneClickBinding } from "../spec_utility";
import {
agHelper,
entityExplorer,
dataSources,
table,
draggableWidgets,
assertHelper,
} from "../../../../../support/Objects/ObjectsCore";
const oneClickBinding = new OneClickBinding();
describe.skip("Table widget one click binding feature", () => {
describe("Table widget one click binding feature", () => {
it("should check that queries are created and bound to table widget properly", () => {
_.entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.TABLE, 400);
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE, 450, 200);
_.entityExplorer.NavigateToSwitcher("Explorer");
entityExplorer.NavigateToSwitcher("Explorer");
_.dataSources.CreateDataSource("Postgres");
dataSources.CreateDataSource("Postgres");
cy.get("@dsName").then((dsName) => {
_.entityExplorer.NavigateToSwitcher("Widgets");
entityExplorer.NavigateToSwitcher("Widgets");
_.entityExplorer.SelectEntityByName("Table1", "Widgets");
entityExplorer.SelectEntityByName("Table1", "Widgets");
oneClickBinding.ChooseAndAssertForm(
`New from ${dsName}`,
@ -25,84 +32,85 @@ describe.skip("Table widget one click binding feature", () => {
);
});
_.agHelper.GetNClick(oneClickBindingLocator.connectData);
agHelper.GetNClick(oneClickBindingLocator.connectData);
_.assertHelper.AssertNetworkStatus("@postExecute");
assertHelper.AssertNetworkStatus("@postExecute");
cy.wait(2000);
agHelper.Sleep(2000);
["id", "gender", "dob", "name", "email", "phoneNo"].forEach((column) => {
_.agHelper.AssertElementExist(_.table._headerCell(column));
agHelper.AssertElementExist(table._headerCell(column));
});
_.agHelper.AssertElementExist(_.table._showPageItemsCount);
agHelper.AssertElementExist(table._showPageItemsCount);
table.EnableEditableOfColumn("id", "v2");
(cy as any).makeColumnEditable("id");
agHelper.GetNClick(table._addNewRow, 0, true);
_.agHelper.GetNClick(_.table._addNewRow, 0, true);
//const randomNumber = Cypress._.random(10, 100, false);
//cy.log("randomeNumber: " + randomNumber);
(cy as any).enterTableCellValue(0, 0, "3");
// table.EditTableCell(0, 0, randomNumber.toString(), false);//Bug 24623 - since 2 digit id is not typed properly
table.EditTableCell(0, 0, 2, false);
table.UpdateTableCell(0, 1, "cypress@appsmith");
table.UpdateTableCell(0, 2, " 2016-06-22 19:10:25-07");
table.UpdateTableCell(0, 3, " 2016-06-22 19:10:25-07");
agHelper.GetNClick(oneClickBindingLocator.dateInput, 0, true);
(cy as any).enterTableCellValue(1, 0, "cypress@appsmith");
agHelper.GetNClick(oneClickBindingLocator.dayViewFromDate, 0, true);
(cy as any).enterTableCellValue(2, 0, " 2016-06-22 19:10:25-07");
agHelper.Sleep(2000);
(cy as any).enterTableCellValue(3, 0, " 2016-06-22 19:10:25-07");
agHelper.GetNClick(table._saveNewRow, 0, true);
_.agHelper.GetNClick(oneClickBindingLocator.dateInput, 0, true);
assertHelper.AssertNetworkStatus("@postExecute");
_.agHelper.GetNClick(oneClickBindingLocator.dayViewFromDate, 0, true);
agHelper.TypeText(table._searchInput, "cypress@appsmith");
(cy as any).wait(2000);
assertHelper.AssertNetworkStatus("@postExecute");
_.agHelper.GetNClick(_.table._saveNewRow, 0, true);
agHelper.AssertElementExist(table._bodyCell("cypress@appsmith"));
_.assertHelper.AssertNetworkStatus("@postExecute");
agHelper.Sleep();
_.agHelper.TypeText(_.table._searchInput, "cypress@appsmith");
//(cy as any).editTableCell(1, 0);
_.assertHelper.AssertNetworkStatus("@postExecute");
agHelper.Sleep(500);
_.agHelper.AssertElementExist(_.table._bodyCell("cypress@appsmith"));
table.EditTableCell(0, 1, "automation@appsmith");
(cy as any).wait(1000);
//(cy as any).enterTableCellValue(1, 0, "automation@appsmith{enter}");
(cy as any).editTableCell(1, 0);
(cy as any).wait(500);
(cy as any).enterTableCellValue(1, 0, "automation@appsmith{enter}");
(cy as any).wait(1000);
agHelper.Sleep();
(cy as any).AssertTableRowSavable(12, 0);
(cy as any).saveTableRow(12, 0);
_.assertHelper.AssertNetworkStatus("@postExecute");
assertHelper.AssertNetworkStatus("@postExecute");
_.assertHelper.AssertNetworkStatus("@postExecute");
assertHelper.AssertNetworkStatus("@postExecute");
(cy as any).wait(500);
agHelper.Sleep(500);
_.agHelper.ClearTextField(_.table._searchInput);
agHelper.ClearTextField(table._searchInput);
_.agHelper.TypeText(_.table._searchInput, "automation@appsmith");
agHelper.TypeText(table._searchInput, "automation@appsmith");
_.assertHelper.AssertNetworkStatus("@postExecute");
assertHelper.AssertNetworkStatus("@postExecute");
(cy as any).wait(2000);
agHelper.Sleep(2000);
_.agHelper.AssertElementExist(_.table._bodyCell("automation@appsmith"));
agHelper.AssertElementExist(table._bodyCell("automation@appsmith"));
_.agHelper.ClearTextField(_.table._searchInput);
agHelper.ClearTextField(table._searchInput);
_.agHelper.TypeText(_.table._searchInput, "cypress@appsmith");
agHelper.TypeText(table._searchInput, "cypress@appsmith");
_.assertHelper.AssertNetworkStatus("@postExecute");
assertHelper.AssertNetworkStatus("@postExecute");
(cy as any).wait(2000);
agHelper.Sleep(2000);
_.agHelper.AssertElementAbsence(_.table._bodyCell("cypress@appsmith"));
agHelper.AssertElementAbsence(table._bodyCell("cypress@appsmith"));
});
});

View File

@ -14,7 +14,7 @@ describe(
}); //disabling sharing of anonymous data
cy.get(".t--admin-settings-save-button").click();
cy.wait(2000);
cy.get(".t--admin-settings-restart-notice", { timeout: 120000 }).should(
cy.get(".t--admin-settings-restart-notice", { timeout: 180000 }).should(
"not.exist",
);
cy.wait("@getGeneral").its("response.statusCode").should("eq", 200);

View File

@ -89,7 +89,7 @@ describe("Update Application", () => {
cy.get(homePage.applicationCard)
.first()
.find(homePage.applicationCardName)
.trigger("mouseover");
.trigger("mouseover", { force: true });
cy.get(".bp3-popover-target.bp3-popover-open").should("not.exist");
});
});

View File

@ -1,5 +1,5 @@
const appNavigationLocators = require("../../../../locators/AppNavigation.json");
import * as _ from "../../../../support/Objects/ObjectsCore";
import { agHelper, deployMode } from "../../../../support/Objects/ObjectsCore";
const BASE_URL = Cypress.config().baseUrl;
@ -14,14 +14,14 @@ Cypress.Commands.add("getSharedUrl", () => {
describe("Preview mode functionality", function () {
before(() => {
cy.fixture("previewMode").then((val) => {
_.agHelper.AddDsl(val);
agHelper.AddDsl(val);
});
_.deployMode.DeployApp();
deployMode.DeployApp();
cy.url().then((url) => cy.setSharedUrl(url));
});
beforeEach(() => {
cy.getSharedUrl().then((url) => cy.visit(url));
cy.getSharedUrl().then((url) => cy.visit(url, { timeout: 60000 }));
});
it("1. on click of apps on header, it should take to application home page", function () {

View File

@ -1,4 +1,8 @@
import * as _ from "../../../../../../support/Objects/ObjectsCore";
import {
agHelper,
entityExplorer,
} from "../../../../../../support/Objects/ObjectsCore";
const widgetsPage = require("../../../../../../locators/Widgets.json");
const commonlocators = require("../../../../../../locators/commonlocators.json");
@ -7,10 +11,10 @@ const widgetSelector = (name) => `[data-widgetname-cy="${name}"]`;
describe(" File Picker Widget", function () {
before(() => {
cy.fixture("Listv2/simpleLargeListv2").then((val) => {
_.agHelper.AddDsl(val);
agHelper.AddDsl(val);
});
});
it("a. should test allowed values", function () {
it("1. should test allowed values", function () {
cy.dragAndDropToWidget("filepickerwidgetv2", "listwidgetv2", {
x: 150,
y: 50,
@ -48,7 +52,8 @@ describe(" File Picker Widget", function () {
".t--property-control-allowedfiletypes .t--codemirror-has-error",
).should("not.exist");
});
it("b. Select Widgets isValid and onFilesSelected", function () {
it("2. Select Widgets isValid and onFilesSelected", function () {
// Test for isValid === True
cy.dragAndDropToWidget("textwidget", "listwidgetv2", {
x: 550,
@ -122,9 +127,8 @@ describe(" File Picker Widget", function () {
cy.get(".t--widget-textwidget").should("contain", "true_true_testFile.mov");
});
it("c. File Widget Max No of Files", function () {
cy.openPropertyPane("filepickerwidgetv2");
it("3. File Widget Max No of Files", function () {
entityExplorer.SelectEntityByName("FilePicker1", "Container1");
cy.get(widgetsPage.filepickerwidgetv2).click();
cy.get(commonlocators.AddMoreFiles).should("not.exist");
cy.get(".uppy-Dashboard-close").click({ force: true });

View File

@ -772,7 +772,7 @@ describe("Table widget inline editing functionality", () => {
entityExplorer.NavigateToSwitcher("Explorer");
entityExplorer.SelectEntityByName("Table1");
table.EnableEditableOfColumn("step");
agHelper.GetNClick(table._updateMode("Multi"));
agHelper.GetNClick(table._updateMode("Multi"), 0, false, 1000);
// case 1: check if updatedRowIndex is 0, when cell at row 0 is updated.
table.EditTableCell(0, 0, "#12");

View File

@ -24,10 +24,8 @@ describe("Table Widget V2 property pane feature validation", function () {
it("1. Verify default array data", function () {
// Open property pane
cy.openPropertyPane("tablewidgetv2");
// Open Widget side bar
cy.get(widgetsPage.addWidget).click();
// Drag and drop table widget
cy.dragAndDropToCanvas("tablewidgetv2", { x: 300, y: 200 });
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE, 300, 200);
// close Widget side bar
entityExplorer.NavigateToSwitcher("Explorer");
cy.wait(2000);
@ -40,9 +38,8 @@ describe("Table Widget V2 property pane feature validation", function () {
});
it("2. Verify empty columnName in data", () => {
cy.get(widgetsPage.addWidget).click();
// Drag and drop table widget
cy.dragAndDropToCanvas("tablewidgetv2", { x: 300, y: 200 });
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE, 300, 200);
table.AddSampleTableData();
// close Widget side bar
entityExplorer.NavigateToSwitcher("Explorer");
@ -400,15 +397,17 @@ describe("Table Widget V2 property pane feature validation", function () {
cy.get(".t--evaluatedPopup-error").should("not.exist");
// Update cell with row : 1, column : orderAmount
cy.editTableCell(4, 1);
cy.enterTableCellValue(4, 1, -1);
table.EditTableCell(1, 4, -1, false);
cy.get(".bp3-popover-content").contains("Invalid input");
cy.enterTableCellValue(4, 1, 0);
table.UpdateTableCell(1, 4, 0);
cy.get(".bp3-popover-content").contains("Invalid input");
table.UpdateTableCell(1, 4, 3);
cy.get(".bp3-popover-content").should("not.exist");
// Check if currentRow works
cy.editColumn("orderAmount");
propPane.NavigateBackToPropertyPane();
table.EditColumn("orderAmount");
propPane.UpdatePropertyFieldValue("Min", "{{currentRow.id}}");
propPane.UpdatePropertyFieldValue(
"Error message",
@ -417,14 +416,13 @@ describe("Table Widget V2 property pane feature validation", function () {
cy.get(".t--evaluatedPopup-error").should("not.exist");
// Update cell with row : 0, column : orderAmount. The min is set to 7 (i.e value of cell in id column)
cy.editTableCell(4, 1);
cy.enterTableCellValue(4, 1, 8);
table.EditTableCell(1, 4, 8, false);
cy.get(".bp3-popover-content").should("not.exist");
cy.enterTableCellValue(4, 1, 6);
table.UpdateTableCell(1, 4, 6);
cy.get(".bp3-popover-content").contains("Row at index 1 is not valid");
cy.enterTableCellValue(4, 1, 8);
table.UpdateTableCell(1, 4, 8);
cy.get(".bp3-popover-content").should("not.exist");
propPane.UpdatePropertyFieldValue(
@ -432,8 +430,7 @@ describe("Table Widget V2 property pane feature validation", function () {
"Row with id {{currentRow.id}} is not valid",
);
cy.editTableCell(4, 1);
cy.enterTableCellValue(4, 1, 5);
table.EditTableCell(1, 4, 5, false);
cy.get(".bp3-popover-content").contains("Row with id 7 is not valid");
propPane.UpdatePropertyFieldValue("Min", "");
@ -444,31 +441,26 @@ describe("Table Widget V2 property pane feature validation", function () {
propPane.UpdatePropertyFieldValue("Regex", "{{currentIndex}}2");
cy.get(".t--evaluatedPopup-error").should("not.exist");
cy.editTableCell(4, 1);
cy.enterTableCellValue(4, 1, 3);
table.EditTableCell(1, 4, 3, false);
cy.get(".bp3-popover-content").contains("Invalid input");
cy.enterTableCellValue(4, 1, "12");
table.UpdateTableCell(1, 4, 12);
cy.get(".bp3-popover-content").should("not.exist");
// Check for currentRow property on Regex field
propPane.UpdatePropertyFieldValue("Regex", "{{currentRow.id}}");
cy.editTableCell(4, 1);
cy.enterTableCellValue(4, 1, 7);
table.EditTableCell(1, 4, 7, false);
cy.get(".bp3-popover-content").should("not.exist");
cy.enterTableCellValue(4, 1, 8);
table.UpdateTableCell(1, 4, 8);
cy.get(".bp3-popover-content").contains("Invalid input");
cy.enterTableCellValue(4, 1, 7);
table.UpdateTableCell(1, 4, 7);
cy.get(".bp3-popover-content").should("not.exist");
propPane.UpdatePropertyFieldValue("Regex", "");
cy.get(".t--property-control-required").find(".t--js-toggle").click();
propPane.UpdatePropertyFieldValue("Required", "{{currentIndex == 1}}");
cy.editTableCell(4, 1);
cy.enterTableCellValue(4, 1, "");
propPane.EnterJSContext("Required", "{{currentIndex == 1}}");
table.EditTableCell(1, 4, "", false);
cy.get(".bp3-popover-content").contains("This field is required");
cy.enterTableCellValue(4, 1, "1{enter}");
table.UpdateTableCell(1, 4, 1, true);
cy.get(".bp3-popover-content").should("not.exist");
cy.wait(1500);
@ -476,12 +468,11 @@ describe("Table Widget V2 property pane feature validation", function () {
cy.wait(1500);
// Value isn't required in Row Index 2
cy.editTableCell(4, 2);
cy.enterTableCellValue(4, 2, "");
table.EditTableCell(2, 4, "", false);
cy.get(".bp3-popover-content").should("not.exist");
cy.enterTableCellValue(4, 2, "11");
table.UpdateTableCell(2, 4, "11");
cy.get(".bp3-popover-content").should("not.exist");
cy.enterTableCellValue(4, 2, "{enter}");
table.UpdateTableCell(2, 4, "", true);
cy.get(".bp3-popover-content").should("not.exist");
cy.wait(1500);
@ -490,15 +481,14 @@ describe("Table Widget V2 property pane feature validation", function () {
// Check for Required property using currentRow, row with index 1 has id 7
propPane.UpdatePropertyFieldValue("Required", "{{currentRow.id == 7}}");
cy.editTableCell(4, 1);
cy.enterTableCellValue(4, 1, "");
table.EditTableCell(1, 4, "", false);
cy.get(".bp3-popover-content").contains("This field is required");
cy.enterTableCellValue(4, 1, 1);
table.UpdateTableCell(1, 4, 1);
cy.get(".bp3-popover-content").should("not.exist");
cy.enterTableCellValue(4, 1, "");
table.UpdateTableCell(1, 4, "");
cy.get(".bp3-popover-content").contains("This field is required");
cy.enterTableCellValue(4, 1, "1{enter}");
table.UpdateTableCell(1, 4, "1", true);
cy.get(".bp3-popover-content").should("not.exist");
cy.wait(1500);
@ -506,13 +496,11 @@ describe("Table Widget V2 property pane feature validation", function () {
cy.wait(1500);
// Value isn't required in Row Index 2
cy.editTableCell(4, 2);
cy.enterTableCellValue(4, 2, "");
table.EditTableCell(2, 4, "", false);
cy.get(".bp3-popover-content").should("not.exist");
cy.enterTableCellValue(4, 2, 10);
table.UpdateTableCell(2, 4, 10);
cy.get(".bp3-popover-content").should("not.exist");
cy.enterTableCellValue(4, 2, "{enter}");
table.UpdateTableCell(2, 4, "", true);
cy.get(".bp3-popover-content").should("not.exist");
cy.wait(1500);

View File

@ -34,7 +34,7 @@ describe("Table Widget property pane feature validation", function () {
_.table.SearchTable("Michael Lawson");
cy.get(commonlocators.bodyTextStyle).should("have.text", "false false");
_.table.resetSearch();
_.table.ResetSearch();
// Pagination properties should get reset when user filters for any criteria.
cy.get(".t--table-widget-next-page").click();

View File

@ -226,8 +226,12 @@ export class AggregateHelper extends ReusableHelper {
//cy.log(selector, "selector");
locator =
selector.startsWith("//") || selector.startsWith("(//")
? cy.xpath(selector, { timeout: timeout })
: cy.get(selector, { timeout: timeout });
? cy.xpath(selector, {
timeout: timeout,
})
: cy.get(selector, {
timeout: timeout,
});
} else locator = cy.wrap(selector);
return locator;
}
@ -280,10 +284,9 @@ export class AggregateHelper extends ReusableHelper {
shouldSleep = true,
force = true,
) {
cy.xpath(this.locator._spanButton(btnVisibleText))
.eq(index)
.scrollIntoView()
.click({ force: force });
this.ScrollIntoView(this.locator._spanButton(btnVisibleText), index).click({
force: force,
});
shouldSleep && this.Sleep();
}
@ -395,15 +398,9 @@ export class AggregateHelper extends ReusableHelper {
public SelectDropDown(dropdownOption: string, endpoint = "selectwidget") {
const mode = window.localStorage.getItem("inDeployedMode");
if (mode == "false") {
cy.xpath(this.locator._selectWidgetDropdown(endpoint))
.first()
.scrollIntoView()
.click();
this.GetNClick(this.locator._selectWidgetDropdown(endpoint));
} else {
cy.xpath(this.locator._selectWidgetDropdownInDeployed(endpoint))
.first()
.scrollIntoView()
.click();
this.GetNClick(this.locator._selectWidgetDropdownInDeployed(endpoint));
}
if (endpoint == "selectwidget")
cy.get(this.locator._selectOptionValue(dropdownOption)).click({
@ -438,7 +435,8 @@ export class AggregateHelper extends ReusableHelper {
? this.locator._divWithClass(insideParent) + modeSelector
: modeSelector;
cy.log(finalSelector);
cy.xpath(finalSelector).eq(index).scrollIntoView().click();
this.GetNClick(finalSelector, index);
cy.get(this.locator._dropDownValue(dropdownOption)).click({ force: true });
this.Sleep(); //for selected value to reflect!
}
@ -454,9 +452,10 @@ export class AggregateHelper extends ReusableHelper {
check = true,
endpoint = "multiselectwidgetv2",
) {
cy.get(this.locator._widgetInDeployed(endpoint) + " div.rc-select-selector")
.eq(index)
.scrollIntoView()
this.ScrollIntoView(
this.locator._widgetInDeployed(endpoint) + " div.rc-select-selector",
index,
)
.then(($element: any) => {
// here, we try to click on downArrow in dropdown of multiSelect.
// the position is calculated from top left of the element
@ -541,9 +540,7 @@ export class AggregateHelper extends ReusableHelper {
index = 0,
parseSpecialCharacters = false,
) {
cy.xpath(this.locator._actionTextArea(actionName))
.eq(index)
.scrollIntoView()
this.ScrollIntoView(this.locator._actionTextArea(actionName), index)
.parents(".CodeMirror")
.first()
.then((ins: any) => {
@ -561,9 +558,7 @@ export class AggregateHelper extends ReusableHelper {
cy.focused().then(($cm: any) => {
if ($cm.contents != "") {
cy.log("The field is not empty");
cy.xpath(this.locator._actionTextArea(actionName))
.eq(index)
.scrollIntoView()
this.ScrollIntoView(this.locator._actionTextArea(actionName), index)
.click({ force: true })
.focused()
.clear({
@ -571,10 +566,9 @@ export class AggregateHelper extends ReusableHelper {
});
}
this.Sleep();
cy.xpath(this.locator._actionTextArea(actionName))
.eq(index)
.scrollIntoView()
.then((el: any) => {
this.ScrollIntoView(this.locator._actionTextArea(actionName), index).then(
(el: any) => {
if (paste) {
//input.invoke("val", value);
this.Paste(el, value);
@ -583,7 +577,8 @@ export class AggregateHelper extends ReusableHelper {
parseSpecialCharSequences: parseSpecialCharacters,
});
}
});
},
);
this.AssertAutoSave();
});
}
@ -600,9 +595,7 @@ export class AggregateHelper extends ReusableHelper {
waitTimeInterval = 500,
ctrlKey = false,
) {
return this.GetElement(selector)
.eq(index)
.scrollIntoView()
return this.ScrollIntoView(selector, index)
.click({ force: force, ctrlKey: ctrlKey })
.wait(waitTimeInterval);
}
@ -613,20 +606,15 @@ export class AggregateHelper extends ReusableHelper {
force = false,
waitTimeInterval = 500,
) {
return this.GetElement(selector)
.eq(index)
.scrollIntoView()
return this.ScrollIntoView(selector, index)
.realHover()
.click({ force: force })
.wait(waitTimeInterval);
}
public HoverElement(selector: string, index = 0, waitTimeInterval = 100) {
//this.ScrollTo(this.GetElement(selector))
return (
this.GetElement(selector)
.eq(index)
.scrollIntoView()
this.ScrollIntoView(selector, index)
.realTouch({ position: "center" })
.realHover({ pointer: "mouse" })
//.trigger("mousemove", { eventConstructor: "MouseEvent" })
@ -645,7 +633,17 @@ export class AggregateHelper extends ReusableHelper {
.siblings(siblingSelector)
.first()
.eq(index)
.scrollIntoView()
.then(($element) => {
if (
Cypress.$("body").find($element).length &&
$element[0].offsetParent !== null
) {
return $element;
} else {
$element[0].scrollIntoView();
return $element;
}
})
.click({ force: force })
.wait(waitTimeInterval);
}
@ -1006,7 +1004,7 @@ export class AggregateHelper extends ReusableHelper {
// });
}
public UpdateFieldLongInput(selector: string, value: string) {
public UpdateFieldInput(selector: string, value: string) {
this.GetElement(selector)
.find("input")
.invoke("attr", "value", value)
@ -1034,9 +1032,13 @@ export class AggregateHelper extends ReusableHelper {
public UpdateInputValue(selector: string, value: string) {
this.GetElement(selector)
.closest("input")
.scrollIntoView({ easing: "linear" })
.clear()
//.type(this.selectAll)
.type(value, { delay: 0 });
.then(($input: any) => {
if (value !== "") {
cy.wrap($input).type(value, { delay: 3 });
}
});
}
public BlurCodeInput(selector: string) {
@ -1237,6 +1239,22 @@ export class AggregateHelper extends ReusableHelper {
return this.GetElement(selector, timeout).eq(index).should("exist");
}
public ScrollIntoView(selector: ElementType, index = 0, timeout = 20000) {
return this.GetElement(selector, timeout)
.eq(index)
.then(($element) => {
if (
Cypress.$("body").find($element).length &&
$element[0].offsetParent !== null
) {
return $element;
} else {
$element[0].scrollIntoView();
return $element;
}
});
}
public AssertElementLength(
selector: ElementType,
length: number,

View File

@ -558,7 +558,7 @@ export class DataSources {
// "ServiceAccCreds.private_key is " +
// JSON.stringify(ServiceAccCreds.private_key),
// );
this.agHelper.UpdateFieldLongInput(
this.agHelper.UpdateFieldInput(
this.locator._inputFieldByName("Service account credentials"),
JSON.stringify(Cypress.env("FIRESTORE_PRIVATE_KEY")),
);
@ -735,9 +735,12 @@ export class DataSources {
this.AssertDSActive(datasourceName)
.scrollIntoView()
.should("be.visible")
.closest(this._datasourceCard)
.within(() => {
this.agHelper.GetNClick(btnLocator, 0, true);
.then(($element) => {
cy.wrap($element)
.closest(this._datasourceCard)
.within(() => {
this.agHelper.GetNClick(btnLocator, 0, true);
});
});
this.agHelper.Sleep(3000); //for the CreateQuery/GeneratePage page to load
createQuery &&

View File

@ -403,7 +403,7 @@ export class Table {
cy.get(this._searchText).eq(index).type(searchTxt);
}
public resetSearch() {
public ResetSearch() {
this.agHelper.GetNClick(this._searchBoxCross);
}
@ -411,7 +411,7 @@ export class Table {
cellDataAfterSearchRemoved: string,
tableVersion: "v1" | "v2" = "v1",
) {
this.resetSearch();
this.ResetSearch();
this.ReadTableRowColumnData(0, 0, tableVersion).then(
(aftSearchRemoved: any) => {
expect(aftSearchRemoved).to.eq(cellDataAfterSearchRemoved);
@ -562,7 +562,10 @@ export class Table {
this.agHelper.GetNClick(colSettings);
}
public EnableEditableOfColumn(columnName: string, tableVersion: "v1" | "v2") {
public EnableEditableOfColumn(
columnName: string,
tableVersion: "v1" | "v2" = "v2",
) {
const colSettings =
tableVersion == "v1"
? this._columnSettings(columnName, "Editable")
@ -573,26 +576,41 @@ export class Table {
public EditTableCell(
rowIndex: number,
colIndex: number,
newValue = "",
newValue: "" | number | string,
toSaveNewValue = true,
) {
this.agHelper.HoverElement(this._tableRow(rowIndex, colIndex, "v2"));
this.agHelper.GetNClick(
this._tableRow(rowIndex, colIndex, "v2") + " " + this._editCellIconDiv,
); //not working consistenly
0,
true,
);
this.agHelper.AssertElementVisible(
this._tableRow(rowIndex, colIndex, "v2") +
" " +
this._editCellEditorInput,
);
if (newValue) {
this.agHelper.UpdateInputValue(
this._tableRow(rowIndex, colIndex, "v2") +
" " +
this._editCellEditorInput,
newValue,
);
}
this.UpdateTableCell(
rowIndex,
colIndex,
newValue.toString(),
toSaveNewValue,
);
this.agHelper.Sleep();
}
public UpdateTableCell(
rowIndex: number,
colIndex: number,
newValue: "" | number | string,
toSaveNewValue = false,
) {
this.agHelper.UpdateInputValue(
this._tableRow(rowIndex, colIndex, "v2") +
" " +
this._editCellEditorInput,
newValue.toString(),
);
toSaveNewValue &&
this.agHelper.TypeText(this._editCellEditorInput, "{enter}", 0, true);
}

View File

@ -2,13 +2,13 @@ import { defineConfig } from "cypress";
export default defineConfig({
defaultCommandTimeout: 30000,
requestTimeout: 21000,
requestTimeout: 60000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
videoUploadOnPasses: false,
videoCompression: false,
numTestsKeptInMemory: 5,
experimentalMemoryManagement : true,
experimentalMemoryManagement: true,
reporterOptions: {
reportDir: "results",
overwrite: false,
@ -18,6 +18,7 @@ export default defineConfig({
chromeWebSecurity: false,
viewportHeight: 1280,
viewportWidth: 1600,
scrollBehavior: "center",
retries: {
runMode: 1,
openMode: 0,