test: Cypress | CI Stabilize (#27818)

## Description
- This PR adds tests for validating the set properties for widget across
all objects
- Covers only some scenarios from [Test
#2409](https://github.com/appsmithorg/TestSmith/issues/2409)
- Adds the failure cypress dashboard link directly in case of CI run
failures
- Flaky fix - Sanity/Datasources/SMTPDatasource_spec.js
- Cypress.on - exception & fail handling updated
- InvokeDispatchOnStore() created for logout/login Internal server
errors - trial fix for RBACFunctionalTests/OthersTabPermission_spec.js
- EditAppFromAppHover() improved to take app name also - trial fix
PropertyPane_Connections_Error_spec.js
- Flaky fix - TableV2_Property_ToggleJs_With_Binding_spec.js
- Flaky fix - Radio2_spec.ts
- Flaky fix - API_TestExecuteWithDynamicBindingInUrl_spec.ts
- Flaky fix - Button_with_API_spec.js
- AssertTableInVirtuosoList() improved to handle the DS name not present
in EE scenario also
- Flaky fix - Button_with_API_spec.js
- Flaky fix - Table_Style_ToggleJS_spec.js
- Flaky fix - Tablev2_Style_ToggleJS_spec


#### Type of change
- Script update (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 Cypress tests were reviewed
This commit is contained in:
Aishwarya-U-R 2023-10-17 20:26:24 +05:30 committed by GitHub
parent d037ada51d
commit 885c951066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 170 additions and 132 deletions

View File

@ -194,7 +194,7 @@ jobs:
- name: install pg
if: needs.ci-test-limited.result != 'success'
run : npm install pg
run: npm install pg
- name: Fetch the failed specs
if: needs.ci-test-limited.result != 'success'
@ -222,12 +222,12 @@ jobs:
}).connect();
const result = await client.query(
`SELECT DISTINCT name FROM public."specs"
WHERE "matrixId" IN
(SELECT id FROM public."matrix"
`SELECT DISTINCT name FROM public."specs"
WHERE "matrixId" IN
(SELECT id FROM public."matrix"
WHERE "attemptId" = (
SELECT id FROM public."attempt" WHERE "workflowId" = $1 and "attempt" = $2
)
)
) AND status = 'fail'`,
[RUN_ID, ATTEMPT_NUMBER],
);
@ -276,7 +276,7 @@ jobs:
issue-number: ${{fromJson(needs.file-check.outputs.pr)}}
body: |
Workflow run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
Cypress dashboard: <a href="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}" target="_blank"> Click here!</a>
Cypress dashboard: <a href="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}&selectiontype=test&testsstatus=failed&specsstatus=fail" target="_blank"> Click here!</a>
The following are new failures, please fix them before merging the PR: ${{env.new_failed_spec_env}}
To know the list of identified flaky tests - <a href="https://app.appsmith.com/applications/613868bedd7786286ddd4a6a/pages/63ec710e8e503f763651791a" target="_blank">Refer here</a>
@ -311,7 +311,7 @@ jobs:
- name: install pg
if: needs.ci-test-limited-existing-docker-image.result != 'success'
run : npm install pg
run: npm install pg
- name: Fetch the failed specs
if: needs.ci-test-limited-existing-docker-image.result != 'success'
@ -339,12 +339,12 @@ jobs:
}).connect();
const result = await client.query(
`SELECT DISTINCT name FROM public."specs"
WHERE "matrixId" IN
(SELECT id FROM public."matrix"
`SELECT DISTINCT name FROM public."specs"
WHERE "matrixId" IN
(SELECT id FROM public."matrix"
WHERE "attemptId" = (
SELECT id FROM public."attempt" WHERE "workflowId" = $1 and "attempt" = $2
)
)
) AND status = 'fail'`,
[RUN_ID, ATTEMPT_NUMBER],
);
@ -393,7 +393,7 @@ jobs:
issue-number: ${{fromJson(needs.file-check.outputs.pr)}}
body: |
Workflow run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
Cypress dashboard: <a href="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}" target="_blank"> Click here!</a>
Cypress dashboard: <a href="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}&selectiontype=test&testsstatus=failed&specsstatus=fail" target="_blank"> Click here!</a>
The following are new failures, please fix them before merging the PR: ${{env.new_failed_spec_env}}
To know the list of identified flaky tests - <a href="https://app.appsmith.com/applications/613868bedd7786286ddd4a6a/pages/63ec710e8e503f763651791a" target="_blank">Refer here</a>

View File

@ -103,7 +103,7 @@ jobs:
- name: install pg
if: needs.ci-test.result != 'success'
run : npm install pg
run: npm install pg
- name: Fetch the failed specs
if: needs.ci-test.result != 'success'
@ -131,12 +131,12 @@ jobs:
}).connect();
const result = await client.query(
`SELECT DISTINCT name FROM public."specs"
WHERE "matrixId" IN
(SELECT id FROM public."matrix"
`SELECT DISTINCT name FROM public."specs"
WHERE "matrixId" IN
(SELECT id FROM public."matrix"
WHERE "attemptId" = (
SELECT id FROM public."attempt" WHERE "workflowId" = $1 and "attempt" = $2
)
)
) AND status = 'fail'`,
[RUN_ID, ATTEMPT_NUMBER],
);
@ -171,7 +171,7 @@ jobs:
shell: bash
run: |
curl --request POST --url https://yatin-s-workspace-jk8ru5.us-east-1.xata.sh/db/CypressKnownFailures:main/tables/CypressKnownFailuires/query --header 'Authorization: Bearer ${{ secrets.XATA_TOKEN }}' --header 'Content-Type: application/json'|jq -r |grep Spec|cut -d ':' -f 2 2> /dev/null|sed 's/"//g'|sed 's/,//g' > ~/knownfailures
# Verify CI test failures against known failures
- name: Verify CI test failures against known failures
if: needs.ci-test.result != 'success'
@ -191,7 +191,7 @@ jobs:
body: |
Workflow run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
Commit: `${{ github.event.client_payload.slash_command.args.named.sha }}`.
Cypress dashboard: <a href="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}" target="_blank"> Click here!</a>
Cypress dashboard: <a href="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}&selectiontype=test&testsstatus=failed&specsstatus=fail" target="_blank"> Click here!</a>
The following are new failures, please fix them before merging the PR: ${{env.new_failed_spec_env}}
To know the list of identified flaky tests - <a href="https://app.appsmith.com/applications/613868bedd7786286ddd4a6a/pages/63ec710e8e503f763651791a" target="_blank">Refer here</a>

View File

@ -176,7 +176,7 @@ jobs:
body: |
Workflow run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
Commit: `${{ github.event.client_payload.slash_command.args.named.sha }}`.
Cypress dashboard: <a href="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}" target="_blank"> Click here!</a>
Cypress dashboard: <a href="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}&selectiontype=test&testsstatus=failed&specsstatus=fail" target="_blank"> Click here!</a>
The following are new failures, please fix them before merging the PR: ${{env.new_failed_spec_env}}
To know the list of identified flaky tests - <a href="https://app.appsmith.com/applications/613868bedd7786286ddd4a6a/pages/63ec710e8e503f763651791a" target="_blank">Refer here</a>

View File

@ -36,7 +36,10 @@ describe("AForce - Community Issues page validations", function () {
const { isPartialImport } = interception.response.body.data;
if (isPartialImport) {
// should reconnect modal
dataSources.ReconnectSingleDSNAssert("AForceDB", "PostgreSQL");
dataSources.ReconnectSingleDSNAssert(
String.raw`AForceDB`,
"PostgreSQL",
);
homePage.AssertNCloseImport();
} else {
homePage.AssertImportToast();

View File

@ -41,11 +41,7 @@ describe("Bind a button and Api usecase", function () {
it("2. Button-Name updation & API datasource binding with button name validation", function () {
_.entityExplorer.SelectEntityByName("Button1");
//changing the Button Name
cy.widgetText(
testdata.buttonName,
widgetsPage.buttonWidget,
widgetsPage.widgetNameSpan,
);
_.propPane.RenameWidget("Button1", testdata.buttonName);
//API datasource binding with button name validation
_.entityExplorer.SelectEntityByName("Api1", "Queries/JS");

View File

@ -104,7 +104,6 @@ describe("Table Widget V2 property pane feature validation", function () {
cy.moveToStyleTab();
cy.wait(1000);
propPane.EnterJSContext("Cell Background", testdata.bindingTextColor);
cy.wait("@updateLayout");
cy.readTableV2dataValidateCSS(
"0",
"0",

View File

@ -15,7 +15,6 @@ describe("Table Widget V2 property pane feature validation", function () {
cy.moveToStyleTab();
_.agHelper.Sleep();
_.propPane.EnterJSContext("Text align", testdata.bindingAlign);
cy.wait("@updateLayout");
cy.readTableV2dataValidateCSS("0", "0", "justify-content", "flex-start");
cy.readTableV2dataValidateCSS("1", "0", "justify-content", "flex-end");
});
@ -36,7 +35,6 @@ describe("Table Widget V2 property pane feature validation", function () {
"Vertical alignment",
testdata.bindingVerticalAlig,
);
cy.wait("@updateLayout");
cy.readTableV2dataValidateCSS("0", "0", "align-items", "flex-start");
cy.readTableV2dataValidateCSS("1", "0", "align-items", "flex-end");
});
@ -45,7 +43,6 @@ describe("Table Widget V2 property pane feature validation", function () {
//cy.movetoStyleTab();
_.agHelper.Sleep();
_.propPane.EnterJSContext("Text size", testdata.bindingNewSize);
cy.wait("@updateLayout");
cy.readTableV2dataValidateCSS("0", "0", "font-size", "14px");
cy.readTableV2dataValidateCSS("1", "0", "font-size", "24px");
});
@ -53,7 +50,6 @@ describe("Table Widget V2 property pane feature validation", function () {
it("5. Table widget V2 toggle test for style Alignment", function () {
_.agHelper.Sleep();
_.propPane.EnterJSContext("Emphasis", testdata.bindingStyle);
cy.wait("@updateLayout");
cy.readTableV2dataValidateCSS("0", "0", "font-style", "normal");
cy.readTableV2dataValidateCSS("1", "0", "font-style", "italic");
});
@ -62,7 +58,6 @@ describe("Table Widget V2 property pane feature validation", function () {
cy.moveToStyleTab();
_.agHelper.Sleep();
_.propPane.EnterJSContext("Text color", testdata.bindingTextColor);
cy.wait("@updateLayout");
cy.readTableV2dataValidateCSS("0", "0", "color", "rgb(0, 128, 0)");
cy.readTableV2dataValidateCSS("1", "0", "color", "rgb(255, 0, 0)");
});
@ -71,7 +66,6 @@ describe("Table Widget V2 property pane feature validation", function () {
cy.moveToStyleTab();
_.agHelper.Sleep();
_.propPane.EnterJSContext("Cell Background", testdata.bindingTextColor);
cy.wait("@updateLayout");
cy.readTableV2dataValidateCSS(
"0",
"0",

View File

@ -15,7 +15,6 @@ describe("Table Widget property pane feature validation", function () {
//cy.movetoStyleTab();
_.agHelper.Sleep();
_.propPane.EnterJSContext("Text align", testdata.bindingAlign);
cy.wait("@updateLayout");
cy.readTabledataValidateCSS("0", "0", "justify-content", "flex-start");
cy.readTabledataValidateCSS("1", "0", "justify-content", "flex-end");
});
@ -36,7 +35,6 @@ describe("Table Widget property pane feature validation", function () {
"Vertical alignment",
testdata.bindingVerticalAlig,
);
cy.wait("@updateLayout");
cy.readTabledataValidateCSS("0", "0", "align-items", "flex-start");
cy.readTabledataValidateCSS("1", "0", "align-items", "flex-end");
});
@ -46,7 +44,6 @@ describe("Table Widget property pane feature validation", function () {
_.agHelper.Sleep();
_.propPane.EnterJSContext("Text size", testdata.bindingSize);
cy.wait(2000);
cy.wait("@updateLayout");
cy.readTabledataValidateCSS("0", "0", "font-size", "14px");
cy.readTabledataValidateCSS("1", "0", "font-size", "24px");
});
@ -55,7 +52,6 @@ describe("Table Widget property pane feature validation", function () {
//cy.movetoStyleTab();
_.agHelper.Sleep();
_.propPane.EnterJSContext("Font Style", testdata.bindingStyle);
cy.wait("@updateLayout");
cy.readTabledataValidateCSS("0", "0", "font-style", "normal");
cy.readTabledataValidateCSS("1", "0", "font-style", "italic");
});
@ -64,7 +60,6 @@ describe("Table Widget property pane feature validation", function () {
//cy.movetoStyleTab();
_.agHelper.Sleep();
_.propPane.EnterJSContext("Text color", testdata.bindingTextColor);
cy.wait("@updateLayout");
cy.readTabledataValidateCSS("0", "0", "color", "rgb(0, 128, 0)");
cy.readTabledataValidateCSS("1", "0", "color", "rgb(255, 0, 0)");
});
@ -73,7 +68,6 @@ describe("Table Widget property pane feature validation", function () {
//cy.movetoStyleTab();
_.agHelper.Sleep();
_.propPane.EnterJSContext("Cell Background", testdata.bindingTextColor);
cy.wait("@updateLayout");
cy.readTabledataValidateCSS(
"0",
"0",

View File

@ -348,6 +348,9 @@ describe("Radio Widget test cases", function () {
entityExplorer.SelectEntityByName("Text1", "Widgets");
propPane.UpdatePropertyFieldValue("Text", "false");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TEXT));
agHelper.WaitUntilEleAppear(
locators._widgetInDeployed(draggableWidgets.RADIO_GROUP),
);
agHelper.AssertElementEnabledDisabled(
locators._widgetInDeployed(draggableWidgets.RADIO_GROUP),
0,
@ -357,7 +360,7 @@ describe("Radio Widget test cases", function () {
.GetWidgetCSSHeight(
locators._widgetInDeployed(draggableWidgets.RADIO_GROUP),
)
.then((currentHeight) => {
.then((currentHeight: any) => {
const updatedHeight = parseInt(currentHeight?.split("px")[0]);
expect(updatedHeight).to.be.greaterThan(270);
});

View File

@ -37,6 +37,12 @@ describe("Test API execution with dynamic binding in URL - Bug #24218", () => {
"{{appsmith.store.api_url}}",
"Api_with_dynamic_binding",
);
agHelper.VerifyEvaluatedValue(
dataManager.dsValues[dataManager.defaultEnviorment].mockApiUrl.replace(
"?records=10",
"",
), //removing query param here due to open bug with DI team
);
apiPage.RunAPI();
apiPage.ResponseStatusCheck("200 OK");
agHelper.ActionContextMenuWithInPane({

View File

@ -72,35 +72,36 @@ describe("Binary Datatype tests", function () {
table.WaitForTableEmpty(); //asserting table is empty before inserting!
});
it.skip("3. Inserting record - binarytype", () => {
imageNameToUpload = "Datatypes/Bridge.jpg";
// entityExplorer.SelectEntityByName("Page1");
// deployMode.DeployApp();
// table.WaitForTableEmpty(); //asserting table is empty before inserting!
agHelper.ClickButton("Run InsertQuery");
agHelper.AssertElementVisibility(locators._modal);
//Timing out a lot in CI, hence skipped, Insert verified also in next case
// it.skip("3. Inserting record - binarytype", () => {
// imageNameToUpload = "Datatypes/Bridge.jpg";
// // entityExplorer.SelectEntityByName("Page1");
// // deployMode.DeployApp();
// // table.WaitForTableEmpty(); //asserting table is empty before inserting!
// agHelper.ClickButton("Run InsertQuery");
// agHelper.AssertElementVisibility(locators._modal);
agHelper.ClickButton("Select New Image");
agHelper.UploadFile(imageNameToUpload);
// agHelper.ClickButton("Select New Image");
// agHelper.UploadFile(imageNameToUpload);
agHelper.ClickButton("Insert");
agHelper.AssertElementAbsence(locators._toastMsg); //Assert that Insert did not fail
agHelper.AssertElementVisibility(locators._buttonByText("Run InsertQuery"));
agHelper.AssertElementAbsence(locators._btnSpinner, 10000); //for the update row to appear at last
table.WaitUntilTableLoad();
agHelper.Sleep(3000); //some more time for all rows with images to be populated
table.ReadTableRowColumnData(0, 0).then(($cellData) => {
expect($cellData).to.eq("1"); //asserting serial column is inserting fine in sequence
});
table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => {
expect($cellData).to.eq("Bridge.jpg");
});
table.AssertTableRowImageColumnIsLoaded(0, 2).then(($oldimage) => {
table.AssertTableRowImageColumnIsLoaded(0, 3).then(($newimage) => {
expect($oldimage).to.eq($newimage);
});
});
});
// agHelper.ClickButton("Insert");
// agHelper.AssertElementAbsence(locators._toastMsg); //Assert that Insert did not fail
// agHelper.AssertElementVisibility(locators._buttonByText("Run InsertQuery"));
// agHelper.AssertElementAbsence(locators._btnSpinner, 10000); //for the update row to appear at last
// table.WaitUntilTableLoad();
// agHelper.Sleep(3000); //some more time for all rows with images to be populated
// table.ReadTableRowColumnData(0, 0).then(($cellData) => {
// expect($cellData).to.eq("1"); //asserting serial column is inserting fine in sequence
// });
// table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => {
// expect($cellData).to.eq("Bridge.jpg");
// });
// table.AssertTableRowImageColumnIsLoaded(0, 2).then(($oldimage) => {
// table.AssertTableRowImageColumnIsLoaded(0, 3).then(($newimage) => {
// expect($oldimage).to.eq($newimage);
// });
// });
// });
it("4. Inserting another record - binarytype", () => {
imageNameToUpload = "Datatypes/Georgia.jpeg";

View File

@ -115,7 +115,11 @@ describe("SMTP datasource test cases using ted", function () {
},
}).then((res) => {
expect(res.status).equal(200);
expect(JSON.stringify(res.body)).to.contain("qwerty@appsmith.com");
const responseBody = JSON.stringify(res.body);
cy.log(responseBody);
const containsTestAppsmith = /test@appsmith\.com/.test(responseBody);
const containsQwertyAppsmith = /qwerty@appsmith\.com/.test(responseBody);
expect(containsTestAppsmith || containsQwertyAppsmith).to.be.true;
});
});
});

View File

@ -40,11 +40,15 @@ export class AggregateHelper extends ReusableHelper {
public _modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl";
private assertHelper = ObjectsRegistry.AssertHelper;
public isMac = Cypress.platform === "darwin";
public get isMac() {
return Cypress.platform === "darwin";
}
private selectLine = `${
this.isMac ? "{cmd}{shift}{leftArrow}" : "{shift}{home}"
}`;
private removeLine = "{backspace}";
public get removeLine() {
return "{backspace}";
}
private selectAll = `${this.isMac ? "{cmd}{a}" : "{ctrl}{a}"}`;
private lazyCodeEditorFallback = ".t--lazyCodeEditor-fallback";
private lazyCodeEditorRendered = ".t--lazyCodeEditor-editor";

View File

@ -296,6 +296,8 @@ export class DataSources {
_dsPageTableTriggermenuTarget = (tableName: string) =>
`${this._dsPageTabContainerTableName(tableName)} .t--template-menu-trigger`;
_gSheetQueryPlaceholder = ".CodeMirror-placeholder";
_dsNameInExplorer = (dsName: string) =>
`div.t--entity-name:contains('${dsName}')`;
public AssertDSEditViewMode(mode: "Edit" | "View") {
if (mode == "Edit") this.agHelper.AssertElementAbsence(this._editButton);
@ -1929,63 +1931,77 @@ export class DataSources {
) {
const ds_entity_name = dsName.replace(/\s/g, "_");
this.entityExplorer.ExpandCollapseEntity("Datasources");
this.entityExplorer.ExpandCollapseEntity(dsName);
cy.intercept("GET", "/api/v1/datasources/*/structure?ignoreCache=*").as(
`getDatasourceStructureUpdated_${ds_entity_name}`,
);
this.entityExplorer.ActionContextMenuByEntityName({
entityNameinLeftSidebar: dsName,
action: "Refresh",
});
this.assertHelper
.WaitForNetworkCall(`@getDatasourceStructureUpdated_${ds_entity_name}`)
.then(async (interception) => {
const tables: any[] = interception?.response?.body.data?.tables || [];
const indexOfTable = tables.findIndex(
(table) => table.name === targetTableName,
cy.get(this.locator._body).then(($body: any) => {
if ($body.find(this._dsNameInExplorer(dsName)).length > 0) {
this.entityExplorer.ExpandCollapseEntity(dsName);
cy.intercept("GET", "/api/v1/datasources/*/structure?ignoreCache=*").as(
`getDatasourceStructureUpdated_${ds_entity_name}`,
);
if (presence) {
this.agHelper.Sleep();
this.agHelper
.GetNClick(this._dsVirtuosoElement(dsName))
.then((parentElement) => {
const heightOfParentElement = parentElement.outerHeight() || 0;
this.entityExplorer.ActionContextMenuByEntityName({
entityNameinLeftSidebar: dsName,
action: "Refresh",
});
// Every element (tables in this scenario) in the virtual list has equal heights. Assumption: Every table element accordion is collapsed by default.
const containerElement = parentElement.find(this._dsVirtuosoList);
const elementHeight = parseInt(
containerElement.children().first().attr("data-known-size") ||
"",
10,
);
// Total height of the parent container holding the tables in the dom normally without virtualization rendering
const totalScroll = tables.length * elementHeight;
cy.log(JSON.stringify({ heightOfParentElement, totalScroll }));
if (heightOfParentElement < totalScroll) {
// Index of the table present in the array of tables which will determine the presence of element inside the parent container
let offset = indexOfTable * elementHeight;
const scrollPercent = Math.max(
(offset / (totalScroll || 1)) * 100,
0,
);
if (scrollPercent > 0) {
this.agHelper.ScrollToXY(
this._dsVirtuosoElement(dsName),
0,
`${scrollPercent}%`,
this.assertHelper
.WaitForNetworkCall(
`@getDatasourceStructureUpdated_${ds_entity_name}`,
)
.then(async (interception) => {
const tables: any[] =
interception?.response?.body.data?.tables || [];
const indexOfTable = tables.findIndex(
(table) => table.name === targetTableName,
);
if (presence) {
this.agHelper.Sleep();
this.agHelper
.GetNClick(this._dsVirtuosoElement(dsName))
.then((parentElement) => {
const heightOfParentElement =
parentElement.outerHeight() || 0;
// Every element (tables in this scenario) in the virtual list has equal heights. Assumption: Every table element accordion is collapsed by default.
const containerElement = parentElement.find(
this._dsVirtuosoList,
);
}
}
const elementHeight = parseInt(
containerElement
.children()
.first()
.attr("data-known-size") || "",
10,
);
// Total height of the parent container holding the tables in the dom normally without virtualization rendering
const totalScroll = tables.length * elementHeight;
cy.log(
JSON.stringify({ heightOfParentElement, totalScroll }),
);
if (heightOfParentElement < totalScroll) {
// Index of the table present in the array of tables which will determine the presence of element inside the parent container
let offset = indexOfTable * elementHeight;
const scrollPercent = Math.max(
(offset / (totalScroll || 1)) * 100,
0,
);
if (scrollPercent > 0) {
this.agHelper.ScrollToXY(
this._dsVirtuosoElement(dsName),
0,
`${scrollPercent}%`,
);
}
}
this.agHelper.AssertElementVisibility(
this._dsVirtuosoElementTable(targetTableName),
);
});
} else {
expect(indexOfTable).to.equal(-1);
}
});
this.agHelper.AssertElementVisibility(
this._dsVirtuosoElementTable(targetTableName),
);
});
} else {
expect(indexOfTable).to.equal(-1);
}
});
}
});
}
public selectTabOnDatasourcePage(tab: "View data" | "Configurations") {

View File

@ -328,13 +328,25 @@ export class HomePage {
});
}
public InvokeDispatchOnStore() {
cy.window().then((win: any) => {
if (win && win.store) {
cy.window()
.its("store")
.invoke("dispatch", { type: "LOGOUT_USER_INIT" });
} else {
// Handle the case where "store" is not present, or simply ignore and continue.
}
});
}
public LogintoApp(
uname: string,
pswd: string,
role: "App Viewer" | "Developer" | "Administrator" = "Administrator",
) {
this.agHelper.Sleep(); //waiting for window to load
cy.window().its("store").invoke("dispatch", { type: "LOGOUT_USER_INIT" });
this.InvokeDispatchOnStore();
cy.wait("@postLogout");
this.agHelper.VisitNAssert("/user/login", "signUpLogin");
this.agHelper.AssertElementVisibility(this._username);
@ -419,8 +431,13 @@ export class HomePage {
this.assertHelper.AssertNetworkStatus("getPagesForViewApp");
}
public EditAppFromAppHover() {
cy.get(this._applicationCard).first().trigger("mouseover");
public EditAppFromAppHover(appName = "") {
if (appName)
this.agHelper
.GetElement(this._appCard(appName))
.first()
.trigger("mouseover");
else this.agHelper.GetElement(this._applicationCard).trigger("mouseover");
this.agHelper.GetNClick(this._appHoverIcon("edit"));
this.agHelper.AssertElementAbsence(this.locator._loading);
this.assertHelper.AssertNetworkStatus("getWorkspace");

View File

@ -41,6 +41,7 @@ const apiPage = ObjectsRegistry.ApiPage;
const deployMode = ObjectsRegistry.DeployMode;
const entityExplorer = ObjectsRegistry.EntityExplorer;
const assertHelper = ObjectsRegistry.AssertHelper;
const homePageTS = ObjectsRegistry.HomePage;
let pageidcopy = " ";
const chainStart = Symbol();
@ -262,7 +263,7 @@ Cypress.Commands.add("GetUrlQueryParams", () => {
Cypress.Commands.add("LogOutUser", () => {
cy.wait(1000); //waiting for window to load
cy.window().its("store").invoke("dispatch", { type: "LOGOUT_USER_INIT" });
homePageTS.InvokeDispatchOnStore();
assertHelper.AssertNetworkStatus("@postLogout", 200);
});
@ -297,7 +298,7 @@ Cypress.Commands.add("LogintoAppTestUser", (uname, pword) => {
});
Cypress.Commands.add("Signup", (uname, pword) => {
cy.window().its("store").invoke("dispatch", { type: "LOGOUT_USER_INIT" });
homePageTS.InvokeDispatchOnStore();
cy.wait("@postLogout");
cy.visit("/user/signup", { timeout: 60000 });

View File

@ -44,13 +44,13 @@ import {
installLogsCollector();
Cypress.on("uncaught:exception", () => {
// returning false here prevents Cypress from
// failing the test
return false;
Cypress.on("uncaught:exception", (error) => {
//cy.log(error.message);
return false; // returning false here prevents Cypress from failing the test
});
Cypress.on("fail", (error) => {
cy.log(error.message);
throw error; // throw error to have test still fail
});