test: Cypress | Flaky fix | Replace static waits - GitSyncedApps_spec.js (#29514)

## Description
- This PR removes hard wait & flaky fix from spec:
ClientSide/Git/GitSync/GitSyncedApps_spec.js

#### Type of change
- Script update (non-breaking change which fixes an issue)

## Testing
#### How Has This Been Tested?
- [X] Cypress CI runs

## Checklist:
#### QA activity:
- [X] Added `Test Plan Approved` label after Cypress tests were reviewed

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Tests**
	- Adjusted test logic for currency input handling in regression tests.
	- Renamed test specifications for clarity.
	- Enhanced table widget API binding and pagination tests.
	- Skipped certain test suites for older app imports and admin settings.

- **Chores**
- Updated the git fetch command in the build workflow for better
repository syncing.

- **Documentation**
	- No user-facing documentation changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Aishwarya-U-R 2023-12-12 10:57:08 +05:30 committed by GitHub
parent 165856e885
commit a3baa9969d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,11 @@ import {
homePage,
gitSync,
dataSources,
table,
draggableWidgets,
locators,
apiPage,
propPane,
} from "../../../../../support/Objects/ObjectsCore";
import PageList from "../../../../../support/Pages/PageList";
@ -35,13 +40,6 @@ let datasourceName;
let repoName;
describe("Git sync apps", function () {
before(() => {
// homePage.NavigateToHome();
// cy.createWorkspace();
// cy.wait("@createWorkspace").then((interception) => {
// const newWorkspaceName = interception.response.body.data.name;
// cy.CreateAppForWorkspace(newWorkspaceName, "gitSyncApp");
});
it("1. Generate postgreSQL crud page , connect to git, clone the page, rename page with special character in it", () => {
homePage.NavigateToHome();
homePage.CreateNewApplication();
@ -102,8 +100,9 @@ describe("Git sync apps", function () {
cy.get("@gitRepoName").then((repName) => {
repoName = repName;
});
cy.wait(3000);
table.ReadTableRowColumnData(0, 1).then((cellData) => {
expect(cellData).to.be.equal("New Config");
});
// rename page to crud_page
entityExplorer.RenameEntityFromExplorer("Page1", pageName);
EditorNavigation.SelectEntityByName(pageName, EntityType.Page);
@ -118,33 +117,22 @@ describe("Git sync apps", function () {
"response.body.responseMeta.status",
201,
);
table.ReadTableRowColumnData(0, 1).then((cellData) => {
expect(cellData).to.be.equal("New Config");
});
});
it("2. Create api queries from api pane and cURL import , bind it to widget and clone page from page settings", () => {
cy.fixture("datasources").then((datasourceFormData) => {
cy.Createpage(newPage);
cy.get(`.t--entity-item:contains(${newPage})`).click();
cy.wait(1000);
cy.wait("@getPage");
// create a get api call
cy.CreateAPI("get_data");
// creating get request using echo
cy.get(apiwidget.resourceUrl)
.first()
.click({ force: true })
.type(datasourceFormData["echoApiUrl"], {
parseSpecialCharSequences: false,
});
//.type("{esc}}");
cy.wait(5000);
cy.get(apiwidget.headerKey).type("info");
cy.xpath("//span[text()='Key']").click();
// entering the data in header
cy.get(apiwidget.headerValue).type("This is a test", {
parseSpecialCharSequences: false,
});
cy.wait(2000);
cy.SaveAndRunAPI();
cy.ResponseStatusCheck("200");
apiPage.CreateAndFillApi(datasourceFormData["echoApiUrl"], "get_data");
apiPage.EnterHeader("info", "This is a test");
apiPage.RunAPI();
apiPage.ResponseStatusCheck("200 OK");
// curl import
dataSources.NavigateToDSCreateNew();
cy.get(ApiEditor.curlImage).click({ force: true });
@ -158,7 +146,7 @@ describe("Git sync apps", function () {
);
cy.importCurl();
cy.RunAPI();
cy.ResponseStatusCheck("200");
apiPage.ResponseStatusCheck("200 OK");
cy.get("@curlImport").then((response) => {
cy.expect(response.response.body.responseMeta.success).to.eq(true);
cy.get(apiwidget.ApiName)
@ -178,15 +166,13 @@ describe("Git sync apps", function () {
.click({ force: true })
.type("{{Api1.data.body.name}}", { parseSpecialCharSequences: false });
cy.dragAndDropToCanvas("inputwidgetv2", { x: 300, y: 500 });
cy.get(".t--widget-inputwidgetv2").should("exist");
cy.EnableAllCodeEditors();
cy.get(`.t--property-control-defaultvalue ${dynamicInputLocators.input}`)
.last()
.click({ force: true })
.type("{{get_data.data.headers.Info}}", {
parseSpecialCharSequences: false,
});
cy.wait(2000);
propPane.UpdatePropertyFieldValue(
"Default value",
"{{get_data.data.headers.Info}}",
);
agHelper.WaitUntilToastDisappear(
"will be executed automatically on page load",
);
// clone the page from page settings
cy.get(`.t--entity-item:contains(${newPage})`).within(() => {
cy.get(".t--context-menu").click({ force: true });
@ -204,7 +190,6 @@ describe("Git sync apps", function () {
it("3. Commit and push changes, validate data binding on all pages in edit and deploy mode on master", () => {
// verfiy data binding on all pages in edit mode
cy.wait(2000);
cy.get(".t--draggable-inputwidgetv2").should("be.visible");
cy.get(".t--draggable-inputwidgetv2")
.first()
@ -240,7 +225,6 @@ describe("Git sync apps", function () {
});
// commit and push the changes
gitSync.CommitAndPush(true);
cy.wait(2000);
// verify data binding on all pages in deploy mode
cy.latestDeployPreview();
cy.get(".t--page-switch-tab")
@ -276,6 +260,10 @@ describe("Git sync apps", function () {
.last()
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
agHelper.AssertElementLength(
locators._widgetInDeployed(draggableWidgets.INPUT_V2),
2,
);
deployMode.NavigateBacktoEditor();
});
@ -285,10 +273,10 @@ describe("Git sync apps", function () {
cy.get("@gitbranchName").then((branName) => {
tempBranch = branName;
});
cy.wait(1000);
// create jsObject and rename it
EditorNavigation.SelectEntityByName(`${newPage} Copy`, EntityType.Page);
jsEditor.CreateJSObject('return "Success";');
cy.wait(2000);
// create postgres select query
dataSources.CreateQueryForDS(
datasourceName,
@ -299,9 +287,7 @@ describe("Git sync apps", function () {
// create a new page
cy.CheckAndUnfoldEntityItem("Pages");
cy.Createpage("Child_Page");
cy.wait(1000);
EditorNavigation.SelectEntityByName(`${newPage} Copy`, EntityType.Page);
cy.wait(2000); // adding wait for query to load
EditorNavigation.SelectEntityByName("get_users", EntityType.Query);
agHelper.ActionContextMenuWithInPane({
action: "Move to page",
@ -309,9 +295,7 @@ describe("Git sync apps", function () {
toastToValidate: "moved to page",
});
cy.runQuery();
cy.wait(2000);
EditorNavigation.SelectEntityByName(`${newPage} Copy`, EntityType.Page);
cy.wait(2000);
EditorNavigation.SelectEntityByName("JSObject1", EntityType.JSObject);
entityExplorer.ActionContextMenuByEntityName({
entityNameinLeftSidebar: "JSObject1",
@ -319,7 +303,6 @@ describe("Git sync apps", function () {
subAction: "Child_Page",
toastToValidate: "moved to page",
});
cy.wait(2000);
PageLeftPane.switchSegment(PagePaneSegment.Widgets);
cy.get(explorer.addWidget).click({ force: true });
// bind input widgets to the jsObject and query response
@ -339,7 +322,6 @@ describe("Git sync apps", function () {
.type("{{get_users.data[0].name}}", {
parseSpecialCharSequences: false,
});
cy.wait(2000);
});
it("5. Commit and push changes, validate data binding on all pages in edit and deploy mode on tempBranch", () => {
@ -347,12 +329,9 @@ describe("Git sync apps", function () {
cy.get(homePageLocators.publishButton).click();
cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit");
cy.get(gitSyncLocators.commitButton).click();
cy.wait(8000);
cy.get(gitSyncLocators.closeGitSyncModal).click();
// verfiy data binding on all pages in deploy mode
cy.wait(4000);
cy.latestDeployPreview();
cy.wait(2000);
cy.get(".bp3-input").should("be.visible");
cy.get(".bp3-input")
.first()
@ -375,7 +354,6 @@ describe("Git sync apps", function () {
expect(cellData).to.be.equal("New Config");
});
cy.get(".t--page-switch-tab").contains(`${newPage}`).click({ force: true });
cy.wait(2000);
cy.get(".bp3-input")
.first()
.invoke("val")
@ -387,7 +365,6 @@ describe("Git sync apps", function () {
cy.get(".t--page-switch-tab")
.contains(`${newPage} Copy`)
.click({ force: true });
cy.wait(2000);
cy.get(".bp3-input")
.first()
.invoke("val")
@ -397,7 +374,6 @@ describe("Git sync apps", function () {
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
cy.get(commonlocators.backToEditor).click();
cy.wait(2000);
// verfiy data binding on all pages in edit mode
/* cy.get(".t--draggable-inputwidgetv2").first().find(".bp3-input").should("have.value", "morpheus");
cy.get(".t--draggable-inputwidgetv2")
@ -442,7 +418,6 @@ describe("Git sync apps", function () {
it("6. Switch to master and verify no uncommitted changes should be shown on master", () => {
cy.switchGitBranch("master");
cy.wait(2000);
// verify commit input box is disabled
cy.get(homePageLocators.publishButton).click();
cy.get(gitSyncLocators.commitCommentInput)
@ -453,8 +428,6 @@ describe("Git sync apps", function () {
it("7. Switch to tempBranch , Clone the Child_Page, change it's visiblity to hidden and deploy, merge to master", () => {
cy.switchGitBranch(tempBranch);
cy.wait(2000);
// clone the Child_Page
EditorNavigation.SelectEntityByName("Child_Page", EntityType.Page);
PageList.ClonePage("Child_Page");
@ -470,12 +443,9 @@ describe("Git sync apps", function () {
cy.get(homePageLocators.publishButton).click();
cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit");
cy.get(gitSyncLocators.commitButton).click();
cy.wait(8000);
cy.get(gitSyncLocators.closeGitSyncModal).click();
cy.wait(2000);
cy.merge(mainBranch);
cy.get(gitSyncLocators.closeGitSyncModal).click();
cy.wait(2000);
cy.latestDeployPreview();
// verify page is hidden on deploy mode
agHelper.AssertContains("Child_Page Copy", "not.exist");
@ -484,7 +454,6 @@ describe("Git sync apps", function () {
it("8. Verify Page visiblity on master in edit and deploy mode", () => {
cy.switchGitBranch(mainBranch);
cy.wait(2000);
cy.latestDeployPreview();
agHelper.AssertContains("Child_Page Copy", "not.exist");
deployMode.NavigateBacktoEditor();
@ -498,9 +467,7 @@ describe("Git sync apps", function () {
cy.get(homePageLocators.publishButton).click();
cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit");
cy.get(gitSyncLocators.commitButton).click();
cy.wait(8000);
cy.get(gitSyncLocators.closeGitSyncModal).click();
cy.wait(2000);
cy.merge(mainBranch);
cy.get(gitSyncLocators.closeGitSyncModal).click();
// verify Child_Page is not on master
@ -520,7 +487,6 @@ describe("Git sync apps", function () {
cy.get(".t--import-json-card").next().click();
// import application from git
cy.importAppFromGit(repoName);
cy.wait(2000);
// verify page order remains same as in orignal app
cy.CheckAndUnfoldEntityItem("Pages");
cy.get(".t--entity-item").eq(1).contains("crudpage_1");