test: Cypress - Flaky Fix (#27189)

## Description

**Fixed below flaky tests**
- DSCrudAndBindings_Spec.ts
- EntityPropertiesLint_spec.ts
- Fork_Template_Existing_app_spec.js
- PlatformFn_spec.ts
- ClientSide/BugTests/Bug25894_spec.ts
 
## 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:
Vijetha-Kaja 2023-09-12 22:49:30 +05:30 committed by GitHub
parent d50edbca7d
commit 3868224993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 24 deletions

View File

@ -1,10 +1,13 @@
import * as _ from "../../../../support/Objects/ObjectsCore";
const { entityExplorer, propPane } = _;
import {
entityExplorer,
propPane,
draggableWidgets,
agHelper,
} from "../../../../support/Objects/ObjectsCore";
describe("Bug 25894 - Moustache brackets should be highlighted", () => {
it("1. should show {{ }} in bold", () => {
entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.BUTTON, 200, 200);
entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON);
entityExplorer.SelectEntityByName("Button1", "Widgets");
@ -17,8 +20,11 @@ describe("Bug 25894 - Moustache brackets should be highlighted", () => {
Query1.run();
}).catch(() => {});const a = { a: "key"} }}`,
);
cy.get("span").contains("{{").should("have.class", "cm-binding-brackets");
cy.get("span").contains("}}").should("have.class", "cm-binding-brackets");
agHelper
.GetNAssertContains("span", "{{")
.should("have.class", "cm-binding-brackets");
agHelper
.GetNAssertContains("span", "}}")
.should("have.class", "cm-binding-brackets");
});
});

View File

@ -235,6 +235,8 @@ describe("Import and validate older app (app created in older versions of Appsmi
agHelper.ClickButton("Confirm");
agHelper.WaitUntilToastDisappear("Delete customer successful!");
agHelper.ClickButton("Close");
agHelper.AssertElementAbsence(locators._modal);
agHelper.Sleep(2000);
});
it("4. Edit JSObject & Check Updated Data ", () => {

View File

@ -33,11 +33,10 @@ describe("Linting of entity properties", () => {
cy.wait(200);
cy.focused().blur();
propPane.UpdatePropertyFieldValue("Label", `{{Api1.${invalidProperty}}}`);
cy.get(locators._lintErrorElement)
.should("have.length", 2)
.first()
.trigger("mouseover");
agHelper.AssertElementLength(locators._lintErrorElement, 2);
agHelper.HoverElement(locators._lintErrorElement);
agHelper.AssertContains(`"${invalidProperty}" doesn't exist in Api1`);
agHelper.GetNClick(locators._canvas);
});
it("2. Shows correct lint error when wrong JSObject property is binded", () => {
@ -70,10 +69,8 @@ describe("Linting of entity properties", () => {
`{{JSObject1.${invalidProperty}}}`,
);
// Assert lint errors
cy.get(locators._lintErrorElement)
.should("have.length", 2)
.first()
.trigger("mouseover");
agHelper.AssertElementLength(locators._lintErrorElement, 2);
agHelper.HoverElement(locators._lintErrorElement);
agHelper.AssertContains(`"${invalidProperty}" doesn't exist in JSObject1`);
// Edit JS Object and add "unknown" function
@ -94,10 +91,8 @@ describe("Linting of entity properties", () => {
});
// select button, and assert that lint error is present
entityExplorer.SelectEntityByName("Button1", "Widgets");
cy.get(locators._lintErrorElement)
.should("have.length", 2)
.first()
.trigger("mouseover");
agHelper.AssertElementLength(locators._lintErrorElement, 2);
agHelper.HoverElement(locators._lintErrorElement);
agHelper.AssertContains(`'JSObject1' is not defined`);
// create js object
jsEditor.CreateJSObject(

View File

@ -52,9 +52,14 @@ describe(
it("2. Add selected page of template from page section", () => {
entityExplorer.AddNewPage("Add page from template");
agHelper.AssertElementVisibility(template.templateDialogBox);
agHelper.Sleep(4000);
cy.xpath("//h1[text()='Meeting Scheduler']").click();
agHelper.WaitUntilEleDisappear("//*[text()='Loading template details']");
agHelper.AssertElementVisibility(
templates.locators._templateCard,
true,
0,
30000,
);
agHelper.GetNClick(template.meetingSchedulerDashboard);
//agHelper.WaitUntilEleDisappear("//*[text()='Loading template details']");
cy.wait("@getTemplatePages").should(
"have.nested.property",
"response.body.responseMeta.status",
@ -80,6 +85,12 @@ describe(
//agHelper.RefreshPage();
entityExplorer.AddNewPage("Add page from template");
agHelper.AssertElementVisibility(
templates.locators._templateCard,
true,
0,
30000,
);
agHelper.GetNClick(templates.locators._templateCard);
agHelper.Sleep(2000);
agHelper.AssertElementVisibility(template.templateViewForkButton);

View File

@ -8,5 +8,6 @@
"templateDialogBox": "[data-testid=t--templates-dialog-component]",
"selectCheckbox": ".ads-v2-checkbox",
"closeButton": "//button[@aria-label='Close']//span",
"marketingDashboard": "//h1[text()='Marketing Dashboard']"
"marketingDashboard": "//h1[text()='Marketing Dashboard']",
"meetingSchedulerDashboard": "//h1[text()='Meeting Scheduler']"
}

View File

@ -230,7 +230,7 @@ export class JSEditor {
public RunJSObj() {
this.agHelper.GetNClick(this._runButton);
this.agHelper.Sleep(); //for function to run
this.agHelper.AssertElementAbsence(this.locator._btnSpinner, 10000);
this.agHelper.AssertElementAbsence(this.locator._btnSpinner, 15000);
this.agHelper.AssertElementAbsence(this.locator._empty, 5000);
}