test: Flaky test fix-3 (#19748)
## Description - Added checkForPageSaveError in assertAutoSave and assertPageSave methods - Fixed below flaky tests - JSFunctionExecution_spec.ts - Scrolling_Spec.ts - Fork_Template_spec.js - Fork_Template_To_App_spec.js - GuidedTour_spec.js - JSEditorComment_spec.js - MemberRoles_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:
parent
9e79b76403
commit
685b11ea5d
|
|
@ -16,16 +16,22 @@ describe("Entity explorer context menu should hide on scrolling", function() {
|
|||
agHelper.GetNClick(dataSources._mockDB("Users"));
|
||||
cy.wait("@getMockDb").then(($createdMock) => {
|
||||
mockDBNameUsers = $createdMock.response?.body.data.name;
|
||||
cy.wrap(mockDBNameUsers).as('usersDB')
|
||||
dataSources.CreateQuery(mockDBNameUsers);
|
||||
});
|
||||
})
|
||||
dataSources.NavigateToDSCreateNew();
|
||||
agHelper.GetNClick(dataSources._mockDB("Movies"));
|
||||
cy.wait("@getMockDb").then(($createdMock) => {
|
||||
mockDBNameMovies = $createdMock.response?.body.data.name;
|
||||
cy.wrap(mockDBNameMovies).as('moviesDB')
|
||||
dataSources.CreateQuery(mockDBNameMovies);
|
||||
});
|
||||
ee.ExpandCollapseEntity("Users");
|
||||
ee.ExpandCollapseEntity("Movies");
|
||||
cy.get('@usersDB').then((dbName)=> {
|
||||
ee.ExpandCollapseEntity(dbName);
|
||||
})
|
||||
cy.get('@moviesDB').then((dbName)=> {
|
||||
ee.ExpandCollapseEntity(dbName);
|
||||
})
|
||||
ee.ExpandCollapseEntity("public.users");
|
||||
agHelper.GetNClick(locator._createNew);
|
||||
agHelper.AssertElementVisible(ee._createNewPopup);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,22 @@ describe("Fork a template to the current app", () => {
|
|||
if ($ele.find(template.templateViewForkButton).length > 0) {
|
||||
cy.get(template.templateViewForkButton).click();
|
||||
}
|
||||
} else {
|
||||
cy.wrap($ele)
|
||||
.invoke("text")
|
||||
.then((text) => {
|
||||
if (text.includes("Unexpected state.")) {
|
||||
cy.reload();
|
||||
cy.get(template.startFromTemplateCard).click();
|
||||
cy.wait(5000);
|
||||
cy.get(template.templateDialogBox).should("be.visible");
|
||||
cy.xpath(
|
||||
"//div[text()='Customer Support Dashboard']/following-sibling::div//button[contains(@class, 'fork-button')]//span[contains(@class, 't--left-icon')]",
|
||||
)
|
||||
.scrollIntoView()
|
||||
.click();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
cy.get(widgetLocators.toastAction).should(
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry";
|
|||
const { AggregateHelper, HomePage } = ObjectsRegistry;
|
||||
|
||||
describe("Fork a template to an workspace", () => {
|
||||
it("Fork a template to an workspace", () => {
|
||||
it("1. Fork a template to an workspace", () => {
|
||||
cy.NavigateToHome();
|
||||
cy.get(templateLocators.templatesTab).click();
|
||||
cy.wait(1000);
|
||||
|
|
@ -21,7 +21,7 @@ describe("Fork a template to an workspace", () => {
|
|||
cy.get(templateLocators.dialogForkButton).click();
|
||||
cy.get(commonlocators.canvas).should("be.visible");
|
||||
});
|
||||
it("Update query param on opening fork modal in template detailed view", () => {
|
||||
it("2. Update query param on opening fork modal in template detailed view", () => {
|
||||
cy.NavigateToHome();
|
||||
cy.get(templateLocators.templatesTab).click();
|
||||
cy.get(templateLocators.templateCard)
|
||||
|
|
@ -32,7 +32,7 @@ describe("Fork a template to an workspace", () => {
|
|||
expect(location.search).to.eq("?showForkTemplateModal=true");
|
||||
});
|
||||
});
|
||||
it("Hide template fork button if user does not have a valid workspace to fork", () => {
|
||||
it("3. Hide template fork button if user does not have a valid workspace to fork", () => {
|
||||
HomePage.NavigateToHome();
|
||||
// Mock user with App Viewer permission
|
||||
cy.intercept("/api/v1/applications/new", {
|
||||
|
|
@ -40,6 +40,10 @@ describe("Fork a template to an workspace", () => {
|
|||
});
|
||||
AggregateHelper.RefreshPage();
|
||||
HomePage.SwitchToTemplatesTab();
|
||||
AggregateHelper.Sleep(2000);
|
||||
AggregateHelper.CheckForErrorToast(
|
||||
"Internal server error while processing request",
|
||||
);
|
||||
AggregateHelper.AssertElementExist(templateLocators.templateCard);
|
||||
AggregateHelper.AssertElementAbsence(templateLocators.templateForkButton);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,14 +32,14 @@ describe("JSEditor Comment - Visual tests", () => {
|
|||
|
||||
// Comment out lines 2,3,4
|
||||
for (let i = 2; i < 5; i++) {
|
||||
agHelper.GetNClick(jsEditor._lineinJsEditor(i));
|
||||
agHelper.GetNClick(jsEditor._lineinJsEditor(i), 0, true);
|
||||
|
||||
agHelper.Sleep(100);
|
||||
|
||||
cy.get(jsEditor._lineinJsEditor(i)).type(
|
||||
agHelper.isMac ? "{meta} /" : "{ctrl} /",
|
||||
{ timeout: 1000 },
|
||||
);
|
||||
agHelper.Sleep(500);
|
||||
}
|
||||
|
||||
// Allow time to comment out lines
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ describe("Create new workspace and invite user & validate all roles", () => {
|
|||
it("2. Login as Administrator and search for users using search bar", () => {
|
||||
homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
|
||||
homePage.FilterApplication(appid, workspaceId);
|
||||
cy.xpath("//span[text()='Share']/parent::button").click();
|
||||
cy.xpath("//span[text()='Share']/parent::button").first().click();
|
||||
cy.xpath(homePage._visibleTextSpan("MANAGE USERS")).click({
|
||||
force: true,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@
|
|||
"entitySearchResult": ".t--entity-name:contains('",
|
||||
"saveStatusContainer": ".t--save-status-container",
|
||||
"saveStatusIsSaving": "t--save-status-is-saving",
|
||||
"statusSaving":".t--save-status-is-saving",
|
||||
"saveStatusError": ".t--save-status-error",
|
||||
"selectWidgetVirtualList": ".menu-virtual-list div",
|
||||
"tableNextPage": ".t--table-widget-next-page",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ export class CommonLocators {
|
|||
"') span.bp3-editable-text-content";
|
||||
_widgetNameTxt = ".editable-text-container input.bp3-editable-text-input";
|
||||
_saveStatusContainer = ".t--save-status-container";
|
||||
_statusSaving = ".t--save-status-is-saving";
|
||||
_saveStatusError = ".t--save-status-error";
|
||||
_codeMirrorTextArea = ".CodeMirror textarea";
|
||||
_codeMirrorCode = ".CodeMirror-code";
|
||||
_codeEditorTargetTextArea = ".CodeEditorTarget textarea";
|
||||
|
|
|
|||
|
|
@ -136,7 +136,19 @@ export class AggregateHelper {
|
|||
this.Sleep();
|
||||
}
|
||||
|
||||
public CheckForPageSaveError() {
|
||||
// Wait for "saving" status to disappear
|
||||
this.GetElement(this.locator._statusSaving).should("not.exist");
|
||||
// Check for page save error
|
||||
cy.get("body").then(($ele) => {
|
||||
if ($ele.find(this.locator._saveStatusError).length) {
|
||||
this.RefreshPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public AssertAutoSave() {
|
||||
this.CheckForPageSaveError();
|
||||
// wait for save query to trigger & n/w call to finish occuring
|
||||
cy.get(this.locator._saveStatusContainer, { timeout: 30000 }).should(
|
||||
"not.exist",
|
||||
|
|
@ -929,6 +941,16 @@ export class AggregateHelper {
|
|||
.should("be.visible");
|
||||
}
|
||||
|
||||
public CheckForErrorToast(error: string) {
|
||||
cy.get("body").then(($ele) => {
|
||||
if ($ele.find(this.locator._toastMsg).length) {
|
||||
if ($ele.find(this.locator._specificToast(error)).length) {
|
||||
throw new Error("Error Toast from Application:" + error);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public AssertElementExist(selector: ElementType, index = 0) {
|
||||
return this.GetElement(selector)
|
||||
.eq(index)
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ export class JSEditor {
|
|||
if (toRun) {
|
||||
//clicking 1 times & waits for 2 second for result to be populated!
|
||||
Cypress._.times(1, () => {
|
||||
this.agHelper.GetNClick(this._runButton);
|
||||
this.agHelper.GetNClick(this._runButton, 0, true);
|
||||
this.agHelper.Sleep(2000);
|
||||
});
|
||||
cy.get(this.locator._empty).should("not.exist");
|
||||
|
|
|
|||
|
|
@ -1154,6 +1154,9 @@ Cypress.Commands.add("ValidatePaginationInputDataV2", () => {
|
|||
});
|
||||
|
||||
Cypress.Commands.add("CheckForPageSaveError", () => {
|
||||
// Wait for "saving" status to disappear
|
||||
cy.get(commonlocators.statusSaving).should("not.exist");
|
||||
// Check for page save error
|
||||
cy.get("body").then(($ele) => {
|
||||
if ($ele.find(commonlocators.saveStatusError).length) {
|
||||
cy.reload();
|
||||
|
|
@ -1162,6 +1165,7 @@ Cypress.Commands.add("CheckForPageSaveError", () => {
|
|||
});
|
||||
|
||||
Cypress.Commands.add("assertPageSave", () => {
|
||||
cy.CheckForPageSaveError();
|
||||
cy.get(commonlocators.saveStatusContainer).should("not.exist", {
|
||||
timeout: 40000,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable cypress/no-unnecessary-waiting */
|
||||
/* eslint-disable cypress/no-assigning-return-values */
|
||||
|
||||
import { ObjectsRegistry } from "../support/Objects/Registry";
|
||||
require("cy-verify-downloads").addCustomCommand();
|
||||
require("cypress-file-upload");
|
||||
const jsEditorLocators = require("../locators/JSEditor.json");
|
||||
|
|
@ -14,6 +14,7 @@ const explorer = require("../locators/explorerlocators.json");
|
|||
const datasource = require("../locators/DatasourcesEditor.json");
|
||||
const formControls = require("../locators/FormControl.json");
|
||||
const queryLocators = require("../locators/QueryEditor.json");
|
||||
const { AggregateHelper } = ObjectsRegistry;
|
||||
|
||||
export const initLocalstorage = () => {
|
||||
cy.window().then((window) => {
|
||||
|
|
@ -77,6 +78,9 @@ Cypress.Commands.add("fillAuthenticatedAPIForm", () => {
|
|||
|
||||
Cypress.Commands.add("runQuery", (expectedRes = true) => {
|
||||
cy.onlyQueryRun();
|
||||
AggregateHelper.CheckForErrorToast(
|
||||
"Failed to initialize pool",
|
||||
);
|
||||
cy.wait("@postExecute").should(
|
||||
"have.nested.property",
|
||||
"response.body.data.isExecutionSuccess",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user