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