test: Cypress - flaky fix (#21585)
## Description - This PR fixes the below flaky tests: - pagesize_spec.js - List4_spec.js - UpdateWorkspaceTests_spec.js - CodeScanner_spec.js - Entity_Explorer_Query_Datasource_spec.js - DiscardChanges_spec.js ## Type of change - Script fix ## How Has This Been Tested? - Cypress run - local ## Checklist: ### QA activity: - [X] Added Test Plan Approved label after reveiwing all Cypress test
This commit is contained in:
parent
b2828dfe93
commit
cdce7ce51a
|
|
@ -8,6 +8,8 @@ const pages = require("../../../../locators/Pages.json");
|
||||||
import { ObjectsRegistry } from "../../../../support/Objects/Registry";
|
import { ObjectsRegistry } from "../../../../support/Objects/Registry";
|
||||||
let ee = ObjectsRegistry.EntityExplorer;
|
let ee = ObjectsRegistry.EntityExplorer;
|
||||||
|
|
||||||
|
let agHelper = ObjectsRegistry.AggregateHelper;
|
||||||
|
|
||||||
const pageid = "MyPage";
|
const pageid = "MyPage";
|
||||||
let datasourceName;
|
let datasourceName;
|
||||||
|
|
||||||
|
|
@ -96,10 +98,11 @@ describe("Entity explorer tests related to query and datasource", function () {
|
||||||
expect($lis.eq(3)).to.contain("{{Query1.run()}}");
|
expect($lis.eq(3)).to.contain("{{Query1.run()}}");
|
||||||
expect($lis.eq(4)).to.contain("{{Query1.clear()}}");
|
expect($lis.eq(4)).to.contain("{{Query1.clear()}}");
|
||||||
});
|
});
|
||||||
|
cy.get(".t--entity-property-close").click(); //closing Bindings overlay
|
||||||
ee.ActionContextMenuByEntityName("Query1", "Edit Name");
|
ee.ActionContextMenuByEntityName("Query1", "Edit Name");
|
||||||
cy.EditApiNameFromExplorer("MyQuery");
|
cy.EditApiNameFromExplorer("MyQuery");
|
||||||
ee.ActionContextMenuByEntityName("MyQuery", "Move to page", pageid);
|
ee.ActionContextMenuByEntityName("MyQuery", "Move to page", pageid);
|
||||||
cy.get(".t--entity-name").contains("MyQuery").click();
|
ee.SelectEntityByName("MyQuery");
|
||||||
cy.wait(2000);
|
cy.wait(2000);
|
||||||
cy.runQuery();
|
cy.runQuery();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,41 +16,16 @@ describe("Git discard changes:", function () {
|
||||||
|
|
||||||
it("1. Create an app with Query1 and JSObject1, connect it to git", () => {
|
it("1. Create an app with Query1 and JSObject1, connect it to git", () => {
|
||||||
// Create new postgres datasource
|
// Create new postgres datasource
|
||||||
cy.NavigateToDatasourceEditor();
|
|
||||||
cy.get(datasource.PostgreSQL).click();
|
|
||||||
cy.fillPostgresDatasourceForm();
|
|
||||||
|
|
||||||
cy.testSaveDatasource();
|
_.dataSources.CreateDataSource("Postgres");
|
||||||
|
cy.get("@dsName").then(($dsName) => {
|
||||||
// go back to active ds list
|
datasourceName = $dsName;
|
||||||
_.dataSources.NavigateToActiveTab();
|
_.dataSources.CreateQueryAfterDSSaved(
|
||||||
|
"SELECT * FROM users ORDER BY id LIMIT 10;",
|
||||||
cy.get("@saveDatasource").then((httpResponse) => {
|
query1,
|
||||||
datasourceName = httpResponse.response.body.data.name;
|
);
|
||||||
|
_.dataSources.RunQuery();
|
||||||
cy.get(datasource.datasourceCard)
|
|
||||||
.contains(datasourceName)
|
|
||||||
.scrollIntoView()
|
|
||||||
.should("be.visible")
|
|
||||||
.closest(datasource.datasourceCard)
|
|
||||||
.within(() => {
|
|
||||||
cy.get(datasource.createQuery).click();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
// Create new postgres query
|
|
||||||
cy.get(queryLocators.queryNameField).type(`${query1}`);
|
|
||||||
cy.get(queryLocators.switch).last().click({ force: true });
|
|
||||||
cy.get(queryLocators.templateMenu).click();
|
|
||||||
cy.get(queryLocators.query).click({ force: true });
|
|
||||||
cy.get(".CodeMirror textarea")
|
|
||||||
.first()
|
|
||||||
.focus()
|
|
||||||
.type("SELECT * FROM users ORDER BY id LIMIT 10;", {
|
|
||||||
force: true,
|
|
||||||
parseSpecialCharSequences: false,
|
|
||||||
});
|
|
||||||
cy.WaitAutoSave();
|
|
||||||
cy.runQuery();
|
|
||||||
|
|
||||||
cy.CheckAndUnfoldEntityItem("Pages");
|
cy.CheckAndUnfoldEntityItem("Pages");
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ describe("Code Scanner widget's functionality", () => {
|
||||||
|
|
||||||
it("3.1.1.2 => Scanner should not be scanning and streaming video", () => {
|
it("3.1.1.2 => Scanner should not be scanning and streaming video", () => {
|
||||||
// Video should NOT be streaming
|
// Video should NOT be streaming
|
||||||
|
cy.wait(2000); //for deployed page to laod completey
|
||||||
cy.get(codeScannerVideoOnPublishPage).should("not.exist");
|
cy.get(codeScannerVideoOnPublishPage).should("not.exist");
|
||||||
|
|
||||||
// Back to editor
|
// Back to editor
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,10 @@ describe("Table widget v2", function () {
|
||||||
cy.openPropertyPane("tablewidgetv2");
|
cy.openPropertyPane("tablewidgetv2");
|
||||||
|
|
||||||
cy.moveToStyleTab();
|
cy.moveToStyleTab();
|
||||||
|
cy.wait(1000); //for style tab to settle
|
||||||
|
cy.get(".t--button-group-SHORT").should("be.visible");
|
||||||
cy.get(".t--button-group-SHORT").click();
|
cy.get(".t--button-group-SHORT").click();
|
||||||
|
cy.wait(1000); //for table to-align to Short click
|
||||||
cy.get(".t--widget-textwidget .bp3-ui-text").should("contain", "7");
|
cy.get(".t--widget-textwidget .bp3-ui-text").should("contain", "7");
|
||||||
|
|
||||||
cy.get(".t--button-group-DEFAULT").click({ force: true });
|
cy.get(".t--button-group-DEFAULT").click({ force: true });
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import homePage from "../../../../locators/HomePage";
|
import homePage from "../../../../locators/HomePage";
|
||||||
|
import * as _ from "../../../../support/Objects/ObjectsCore";
|
||||||
|
|
||||||
describe("Update Workspace", function () {
|
describe("Update Workspace", function () {
|
||||||
let workspaceId;
|
let workspaceId;
|
||||||
|
|
@ -38,12 +39,12 @@ describe("Update Workspace", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("2. Open the workspace general settings and update workspace email. The update should reflect in the workspace.", function () {
|
it("2. Open the workspace general settings and update workspace email. The update should reflect in the workspace.", function () {
|
||||||
cy.createWorkspace();
|
_.agHelper.GenerateUUID();
|
||||||
cy.wait("@createWorkspace").then((interception) => {
|
cy.get("@guid").then((uid) => {
|
||||||
newWorkspaceName = interception.response.body.data.name;
|
newWorkspaceName = "SettingsUpdate" + uid;
|
||||||
cy.renameWorkspace(newWorkspaceName, workspaceId);
|
_.homePage.CreateNewWorkspace(newWorkspaceName);
|
||||||
cy.get(homePage.workspaceSettingOption).click({ force: true });
|
|
||||||
});
|
});
|
||||||
|
cy.get(homePage.workspaceSettingOption).click({ force: true });
|
||||||
cy.get(homePage.workspaceEmailInput).clear();
|
cy.get(homePage.workspaceEmailInput).clear();
|
||||||
cy.get(homePage.workspaceEmailInput).type(Cypress.env("TESTUSERNAME2"));
|
cy.get(homePage.workspaceEmailInput).type(Cypress.env("TESTUSERNAME2"));
|
||||||
cy.wait("@updateWorkspace").should(
|
cy.wait("@updateWorkspace").should(
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ describe("Validate Airtable Ds", () => {
|
||||||
jsonSpecies.records.forEach((record: { fields: any }) => {
|
jsonSpecies.records.forEach((record: { fields: any }) => {
|
||||||
specieslist.push(record.fields.Species_ID);
|
specieslist.push(record.fields.Species_ID);
|
||||||
});
|
});
|
||||||
expect(specieslist.length).eq(53); //making sure all fields are returned
|
expect(specieslist.length).to.be.at.least(53); //making sure all fields are returned
|
||||||
});
|
});
|
||||||
|
|
||||||
//Filter Species_ID & Species fields only
|
//Filter Species_ID & Species fields only
|
||||||
|
|
@ -51,7 +51,7 @@ describe("Validate Airtable Ds", () => {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
_.dataSources.RunQuery();
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
const hasOnlyAllowedKeys = jsonSpecies.records.every((record: any) => {
|
const hasOnlyAllowedKeys = jsonSpecies.records.every((record: any) => {
|
||||||
|
|
@ -77,7 +77,7 @@ describe("Validate Airtable Ds", () => {
|
||||||
directInput: false,
|
directInput: false,
|
||||||
inputFieldName: "Page Size",
|
inputFieldName: "Page Size",
|
||||||
});
|
});
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
_.dataSources.RunQuery();
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
expect(jsonSpecies.records.length).to.eq(11); //making sure only 11 record fields are returned
|
expect(jsonSpecies.records.length).to.eq(11); //making sure only 11 record fields are returned
|
||||||
|
|
@ -89,8 +89,7 @@ describe("Validate Airtable Ds", () => {
|
||||||
directInput: false,
|
directInput: false,
|
||||||
inputFieldName: "Page Size",
|
inputFieldName: "Page Size",
|
||||||
});
|
});
|
||||||
|
_.dataSources.RunQuery();
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
expect(jsonSpecies.records.length).to.eq(6); //making sure only 6 record fields are returned, honouring the PageSize
|
expect(jsonSpecies.records.length).to.eq(6); //making sure only 6 record fields are returned, honouring the PageSize
|
||||||
|
|
@ -102,8 +101,8 @@ describe("Validate Airtable Ds", () => {
|
||||||
directInput: false,
|
directInput: false,
|
||||||
inputFieldName: "Offset",
|
inputFieldName: "Offset",
|
||||||
});
|
});
|
||||||
|
_.dataSources.RunQuery();
|
||||||
|
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
expect(jsonSpecies.records.length).to.eq(5); //making sure only remaining records are returned
|
expect(jsonSpecies.records.length).to.eq(5); //making sure only remaining records are returned
|
||||||
|
|
@ -122,8 +121,8 @@ describe("Validate Airtable Ds", () => {
|
||||||
directInput: false,
|
directInput: false,
|
||||||
inputFieldName: "Filter by Formula",
|
inputFieldName: "Filter by Formula",
|
||||||
});
|
});
|
||||||
|
_.dataSources.RunQuery();
|
||||||
|
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
const allRecordsWithRodentTaxa = jsonSpecies.records.filter(
|
const allRecordsWithRodentTaxa = jsonSpecies.records.filter(
|
||||||
|
|
@ -156,7 +155,8 @@ describe("Validate Airtable Ds", () => {
|
||||||
inputFieldName: "Sort",
|
inputFieldName: "Sort",
|
||||||
}); //Sort by default ascending, descneding is thrown error, checking with Felix
|
}); //Sort by default ascending, descneding is thrown error, checking with Felix
|
||||||
|
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
_.dataSources.RunQuery();
|
||||||
|
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
const sorted = jsonSpecies.records.every(
|
const sorted = jsonSpecies.records.every(
|
||||||
|
|
@ -190,7 +190,8 @@ describe("Validate Airtable Ds", () => {
|
||||||
},
|
},
|
||||||
); //Sort by descending
|
); //Sort by descending
|
||||||
|
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
_.dataSources.RunQuery();
|
||||||
|
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
const sorted = jsonSpecies.records.every(
|
const sorted = jsonSpecies.records.every(
|
||||||
|
|
@ -228,7 +229,8 @@ describe("Validate Airtable Ds", () => {
|
||||||
inputFieldName: "View",
|
inputFieldName: "View",
|
||||||
});
|
});
|
||||||
|
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
_.dataSources.RunQuery();
|
||||||
|
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
const isJSONValid = jsonSpecies.records.every(
|
const isJSONValid = jsonSpecies.records.every(
|
||||||
|
|
@ -264,7 +266,8 @@ describe("Validate Airtable Ds", () => {
|
||||||
});
|
});
|
||||||
_.agHelper.Sleep(500); // for the Records field to settle
|
_.agHelper.Sleep(500); // for the Records field to settle
|
||||||
|
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
_.dataSources.RunQuery();
|
||||||
|
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
//cy.log("jsonSpecies is"+ jsonSpecies)
|
//cy.log("jsonSpecies is"+ jsonSpecies)
|
||||||
|
|
@ -283,7 +286,8 @@ describe("Validate Airtable Ds", () => {
|
||||||
inputFieldName: "Record ID ",
|
inputFieldName: "Record ID ",
|
||||||
});
|
});
|
||||||
|
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
_.dataSources.RunQuery();
|
||||||
|
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
const hasOnlyInsertedRecord = () => {
|
const hasOnlyInsertedRecord = () => {
|
||||||
|
|
@ -318,7 +322,8 @@ describe("Validate Airtable Ds", () => {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
_.dataSources.RunQuery();
|
||||||
|
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
const hasOnlyUpdatedRecord = () => {
|
const hasOnlyUpdatedRecord = () => {
|
||||||
|
|
@ -340,7 +345,8 @@ describe("Validate Airtable Ds", () => {
|
||||||
"Delete A Record",
|
"Delete A Record",
|
||||||
);
|
);
|
||||||
|
|
||||||
_.dataSources.RunQuery({ waitTimeInterval: 2000 });
|
_.dataSources.RunQuery();
|
||||||
|
|
||||||
cy.get("@postExecute").then((resObj: any) => {
|
cy.get("@postExecute").then((resObj: any) => {
|
||||||
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
jsonSpecies = JSON.parse(resObj.response.body.data.body);
|
||||||
expect(jsonSpecies.deleted).to.be.true;
|
expect(jsonSpecies.deleted).to.be.true;
|
||||||
|
|
|
||||||
|
|
@ -654,6 +654,10 @@ export class DataSources {
|
||||||
}: Partial<RunQueryParams> = {}) {
|
}: Partial<RunQueryParams> = {}) {
|
||||||
this.agHelper.GetNClick(this._runQueryBtn, 0, true, waitTimeInterval);
|
this.agHelper.GetNClick(this._runQueryBtn, 0, true, waitTimeInterval);
|
||||||
if (toValidateResponse) {
|
if (toValidateResponse) {
|
||||||
|
this.agHelper.AssertElementAbsence(
|
||||||
|
this.locator._cancelActionExecution,
|
||||||
|
10000,
|
||||||
|
); //For the run to give response
|
||||||
this.agHelper.Sleep();
|
this.agHelper.Sleep();
|
||||||
this.agHelper.ValidateNetworkExecutionSuccess(
|
this.agHelper.ValidateNetworkExecutionSuccess(
|
||||||
"@postExecute",
|
"@postExecute",
|
||||||
|
|
|
||||||
|
|
@ -1199,9 +1199,12 @@ Cypress.Commands.add("copyWidget", (widget, widgetLocator) => {
|
||||||
.last()
|
.last()
|
||||||
.invoke("text")
|
.invoke("text")
|
||||||
.then((x) => {
|
.then((x) => {
|
||||||
cy.log(x);
|
//cy.log(x);
|
||||||
let originalWidget = x.replaceAll("x", "");
|
let originalWidget = x
|
||||||
originalWidget = originalWidget.replaceAll(/\u200B/g, "");
|
.replaceAll("x", "")
|
||||||
|
.replaceAll(/\u200B/g, "")
|
||||||
|
.replaceAll("\n", "")
|
||||||
|
.replaceAll("/Type / to access quick commands", "");
|
||||||
cy.log(originalWidget);
|
cy.log(originalWidget);
|
||||||
cy.get(widgetsPage.copyWidget).click({ force: true });
|
cy.get(widgetsPage.copyWidget).click({ force: true });
|
||||||
cy.wait(3000);
|
cy.wait(3000);
|
||||||
|
|
@ -1217,11 +1220,14 @@ Cypress.Commands.add("copyWidget", (widget, widgetLocator) => {
|
||||||
.last()
|
.last()
|
||||||
.invoke("text")
|
.invoke("text")
|
||||||
.then((y) => {
|
.then((y) => {
|
||||||
cy.log(y);
|
//cy.log(y);
|
||||||
let copiedWidget = y.replaceAll("x", "");
|
let copiedWidget = y
|
||||||
copiedWidget = copiedWidget.replaceAll(/\u200B/g, "");
|
.replaceAll("x", "")
|
||||||
|
.replaceAll(/\u200B/g, "")
|
||||||
|
.replaceAll("\n", "")
|
||||||
|
.replaceAll("/Type / to access quick commands", "");
|
||||||
cy.log(copiedWidget);
|
cy.log(copiedWidget);
|
||||||
expect(originalWidget).to.be.equal(copiedWidget);
|
expect(originalWidget).to.equal(copiedWidget);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user