test: Cypress - Fix flaky tests (#21292)
## Description **Fixed below flaky tests** - DeleteWorkspace_spec.js - Listv2_BasicChildWidgetInteraction_spec.js - JSOnLoad_cyclic_dependency_errors_spec.js ## Type of change - Flaky test fix ## How Has This Been Tested? - Cypress test runs ## Checklist: ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
This commit is contained in:
parent
d96f2a14d3
commit
8c6ac8afa6
|
|
@ -52,12 +52,8 @@ function checkSelectedRadioValue(selector, value) {
|
|||
describe("List widget v2 - Basic Child Widget Interaction", () => {
|
||||
before(() => {
|
||||
cy.addDsl(emptyListDSL);
|
||||
agHelper.RestoreLocalStorageCache();
|
||||
cy.get(publishLocators.containerWidget).should("have.length", 3);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
agHelper.SaveLocalStorageCache();
|
||||
cy.wait(3000); // for dsl to settle
|
||||
});
|
||||
|
||||
it("1. Child widgets", () => {
|
||||
|
|
@ -187,6 +183,16 @@ describe("List widget v2 - Basic Child Widget Interaction", () => {
|
|||
cy.get(publishLocators.switchwidget)
|
||||
.find("input")
|
||||
.should("be.checked");
|
||||
cy.wait(1000);
|
||||
cy.waitUntil(() =>
|
||||
cy
|
||||
.get(
|
||||
`${widgetSelector("List1")} ${containerWidgetSelector} ${
|
||||
publishLocators.switchwidget
|
||||
}`,
|
||||
)
|
||||
.should("have.length", 3),
|
||||
);
|
||||
// Uncheck
|
||||
cy.get(publishLocators.switchwidget)
|
||||
.find("label")
|
||||
|
|
@ -225,7 +231,16 @@ describe("List widget v2 - Basic Child Widget Interaction", () => {
|
|||
|
||||
// Check radio with value=1 is selected
|
||||
checkSelectedRadioValue(publishLocators.radioWidget, "Y");
|
||||
|
||||
cy.wait(1000);
|
||||
cy.waitUntil(() =>
|
||||
cy
|
||||
.get(
|
||||
`${widgetSelector("List1")} ${containerWidgetSelector} ${
|
||||
publishLocators.radioWidget
|
||||
}`,
|
||||
)
|
||||
.should("have.length", 3),
|
||||
);
|
||||
// Check option 2 and then check it's value:
|
||||
cy.get(`${publishLocators.radioWidget} input`).check("N", { force: true });
|
||||
checkSelectedRadioValue(publishLocators.radioWidget, "N");
|
||||
|
|
|
|||
|
|
@ -7,14 +7,11 @@ describe("Delete workspace test spec", function() {
|
|||
|
||||
it("1. Should delete the workspace", function() {
|
||||
cy.visit("/applications");
|
||||
cy.generateUUID().then((uid) => {
|
||||
newWorkspaceName = uid;
|
||||
_.agHelper.GenerateUUID();
|
||||
cy.get("@guid").then((uid) => {
|
||||
newWorkspaceName = "Deleteworkspace" + uid;
|
||||
_.homePage.CreateNewWorkspace(newWorkspaceName);
|
||||
cy.wait(500);
|
||||
cy.contains(".cs-text", "Delete Workspace")
|
||||
.scrollIntoView()
|
||||
.click();
|
||||
cy.contains("Are you sure").click();
|
||||
_.homePage.DeleteWorkspace(newWorkspaceName)
|
||||
cy.wait("@deleteWorkspaceApiCall").then((httpResponse) => {
|
||||
expect(httpResponse.status).to.equal(200);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
import { ObjectsRegistry } from "../../../../support/Objects/Registry";
|
||||
|
||||
const dsl = require("../../../../fixtures/inputdsl.json");
|
||||
const datasource = require("../../../../locators/DatasourcesEditor.json");
|
||||
const widgetsPage = require("../../../../locators/Widgets.json");
|
||||
const queryLocators = require("../../../../locators/QueryEditor.json");
|
||||
const jsEditor = ObjectsRegistry.JSEditor;
|
||||
const ee = ObjectsRegistry.EntityExplorer;
|
||||
const agHelper = ObjectsRegistry.AggregateHelper;
|
||||
let queryName;
|
||||
|
||||
let queryName = "Query1";
|
||||
import * as _ from "../../../../support/Objects/ObjectsCore";
|
||||
|
||||
/*
|
||||
Cyclic Dependency Error if occurs, Message would be shown in following 6 cases:
|
||||
|
|
@ -27,51 +23,13 @@ describe("Cyclic Dependency Informational Error Messages", function() {
|
|||
cy.wait(3000); //dsl to settle!
|
||||
});
|
||||
|
||||
it("1. Create Users Sample DB & Sample DB Query", () => {
|
||||
//Step1
|
||||
cy.wait(2000);
|
||||
cy.NavigateToDatasourceEditor();
|
||||
|
||||
//Step2
|
||||
cy.get(datasource.mockUserDatabase).click();
|
||||
|
||||
//Step3 & 4
|
||||
cy.contains(`${datasource.datasourceCard}`, "Users")
|
||||
.last()
|
||||
.find(`${datasource.createQuery}`)
|
||||
.click({ force: true });
|
||||
|
||||
//Step5.1: Click the editing field
|
||||
cy.get(".t--action-name-edit-field").click({ force: true });
|
||||
|
||||
cy.generateUUID().then((uid) => {
|
||||
queryName = "query" + uid;
|
||||
//Step5.2: Click the editing field
|
||||
cy.get(queryLocators.queryNameField).type(queryName);
|
||||
|
||||
// switching off Use Prepared Statement toggle
|
||||
cy.get(queryLocators.switch)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
|
||||
//Step 6.1: Click on Write query area
|
||||
cy.get(queryLocators.templateMenu).click();
|
||||
cy.get(queryLocators.query).click({ force: true });
|
||||
|
||||
// Step6.2: writing query to get the schema
|
||||
cy.get(".CodeMirror textarea")
|
||||
.first()
|
||||
.focus()
|
||||
.type("SELECT gender FROM users ORDER BY id LIMIT 10;", {
|
||||
force: true,
|
||||
parseSpecialCharSequences: false,
|
||||
it("1. Create Users Sample DB Query & Simulate cyclic depedency", () => {
|
||||
//Step1 : Create Mock Users DB
|
||||
_.dataSources.CreateMockDB("Users").then((dbName) => {
|
||||
_.dataSources.CreateQueryFromActiveTab(dbName, false);
|
||||
_.agHelper.GetNClick(_.dataSources._templateMenuOption("Select"));
|
||||
_.dataSources.ToggleUsePreparedStatement(false);
|
||||
});
|
||||
cy.WaitAutoSave();
|
||||
});
|
||||
});
|
||||
|
||||
// Step 1: simulate cyclic depedency
|
||||
it("2. Create Input Widget & Bind Input Widget Default text to Query Created", () => {
|
||||
cy.get(widgetsPage.widgetSwitchId).click();
|
||||
cy.openPropertyPane("inputwidgetv2");
|
||||
cy.get(widgetsPage.defaultInput).type("{{" + queryName + ".data[0].gender");
|
||||
|
|
@ -84,7 +42,7 @@ describe("Cyclic Dependency Informational Error Messages", function() {
|
|||
});
|
||||
|
||||
//Case 1: On page load actions
|
||||
it("3. Reload Page and it should not provide errors in response", () => {
|
||||
it("2. Reload Page and it should not provide errors in response & update input widget's placeholder property and check errors array to be empty", () => {
|
||||
// cy.get(widgetsPage.NavHomePage).click({ force: true });
|
||||
cy.reload();
|
||||
cy.openPropertyPane("inputwidgetv2");
|
||||
|
|
@ -93,9 +51,7 @@ describe("Cyclic Dependency Informational Error Messages", function() {
|
|||
"response.body.data.layouts[0].layoutOnLoadActionErrors.length",
|
||||
0,
|
||||
);
|
||||
});
|
||||
|
||||
it("4. update input widget's placeholder property and check errors array to be empty", () => {
|
||||
// Case 2: When updating DSL attribute
|
||||
cy.get(widgetsPage.placeholder).type("cyclic placeholder");
|
||||
cy.wait("@updateLayout").should(
|
||||
|
|
@ -105,9 +61,9 @@ describe("Cyclic Dependency Informational Error Messages", function() {
|
|||
);
|
||||
});
|
||||
|
||||
it("5. Add JSObject and update its name, content and check for no errors", () => {
|
||||
it("3. Add JSObject and update its name, content and check for no errors", () => {
|
||||
// Case 3: When updating JS Object name
|
||||
jsEditor.CreateJSObject(
|
||||
_.jsEditor.CreateJSObject(
|
||||
`export default {
|
||||
fun: async () => {
|
||||
showAlert("New Js Object");
|
||||
|
|
@ -120,7 +76,7 @@ describe("Cyclic Dependency Informational Error Messages", function() {
|
|||
shouldCreateNewJSObj: true,
|
||||
},
|
||||
);
|
||||
jsEditor.RenameJSObjFromPane("newName");
|
||||
_.jsEditor.RenameJSObjFromPane("newName");
|
||||
|
||||
cy.wait("@renameJsAction").should(
|
||||
"have.nested.property",
|
||||
|
|
@ -134,7 +90,7 @@ describe("Cyclic Dependency Informational Error Messages", function() {
|
|||
return "yes";
|
||||
}
|
||||
}`;
|
||||
jsEditor.EditJSObj(syncJSCode, false);
|
||||
_.jsEditor.EditJSObj(syncJSCode, false);
|
||||
|
||||
cy.wait("@jsCollections").should(
|
||||
"have.nested.property",
|
||||
|
|
@ -144,21 +100,19 @@ describe("Cyclic Dependency Informational Error Messages", function() {
|
|||
});
|
||||
|
||||
// Case 5: When updating DSL name
|
||||
it("6. Update Widget Name and check for no errors", () => {
|
||||
it("4. Update Widget Name and check for no errors & Update Query and check for errors", () => {
|
||||
let entityName = "gender";
|
||||
let newEntityName = "newInput";
|
||||
ee.SelectEntityByName(entityName, "Widgets");
|
||||
agHelper.RenameWidget(entityName, newEntityName);
|
||||
_.entityExplorer.SelectEntityByName(entityName, "Widgets");
|
||||
_.agHelper.RenameWidget(entityName, newEntityName);
|
||||
cy.wait("@updateWidgetName").should(
|
||||
"have.nested.property",
|
||||
"response.body.data.layoutOnLoadActionErrors.length",
|
||||
0,
|
||||
);
|
||||
});
|
||||
|
||||
// Case 6: When updating Datasource query
|
||||
it("7. Update Query and check for errors", () => {
|
||||
ee.SelectEntityByName(queryName, "Queries/JS");
|
||||
_.entityExplorer.SelectEntityByName(queryName, "Queries/JS");
|
||||
// update query and check no cyclic dependency issue should occur
|
||||
cy.get(queryLocators.query).click({ force: true });
|
||||
cy.get(".CodeMirror textarea")
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@ export class HomePage {
|
|||
"//span[text()='" + action + "']/ancestor::a";
|
||||
private _homeTab = ".t--apps-tab";
|
||||
private _templatesTab = ".t--templates-tab";
|
||||
private _workSpaceByName = (wsName: string) =>
|
||||
"//div[contains(@class, 't--applications-container')]//span[text()='" +
|
||||
wsName +
|
||||
"']";
|
||||
|
||||
public SwitchToAppsTab() {
|
||||
this.agHelper.GetNClick(this._homeTab);
|
||||
|
|
@ -112,23 +116,19 @@ export class HomePage {
|
|||
});
|
||||
}
|
||||
|
||||
public RenameWorkspace(workspaceName: string, newWorkspaceName: string) {
|
||||
cy.get(this._appContainer)
|
||||
.contains(workspaceName)
|
||||
public RenameWorkspace(oldName: string, newWorkspaceName: string) {
|
||||
cy.xpath(this._workSpaceByName(oldName))
|
||||
.last()
|
||||
.closest(this._workspaceCompleteSection)
|
||||
.find(this._workspaceName)
|
||||
.scrollIntoView()
|
||||
.find(this._optionsIcon)
|
||||
.click({ force: true });
|
||||
cy.get(this._renameWorkspaceInput)
|
||||
.should("be.visible")
|
||||
.type(newWorkspaceName.concat("{enter}"));
|
||||
this.agHelper.Sleep(2000);
|
||||
cy.wait("@updateWorkspace").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
cy.contains(newWorkspaceName);
|
||||
this, this.agHelper.ValidateNetworkStatus("@updateWorkspace");
|
||||
this.agHelper.AssertContains(newWorkspaceName);
|
||||
}
|
||||
|
||||
//Maps to CheckShareIcon in command.js
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user