diff --git a/app/client/cypress.json b/app/client/cypress.json index 7fcbd877f0..089428372d 100644 --- a/app/client/cypress.json +++ b/app/client/cypress.json @@ -14,9 +14,7 @@ "json": false }, "ignoreTestFiles": [ - "**/Smoke_TestSuite/Application/PgAdmin_spec*.js", - "**/Smoke_TestSuite/ClientSideTests/Onboarding/FirstTimeUserOnboarding_spec*.js", - "**/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_spec.js" + "**/Smoke_TestSuite/Application/PgAdmin_spec*.js" ], "chromeWebSecurity": false, "viewportHeight": 1100, diff --git a/app/client/cypress/fixtures/JsObjecWithGitdsl.json b/app/client/cypress/fixtures/JsObjecWithGitdsl.json new file mode 100644 index 0000000000..ec42027c33 --- /dev/null +++ b/app/client/cypress/fixtures/JsObjecWithGitdsl.json @@ -0,0 +1,60 @@ +{ + "dsl": { + "widgetName": "MainContainer", + "backgroundColor": "none", + "rightColumn": 816, + "snapColumns": 64, + "detachFromLayout": true, + "widgetId": "0", + "topRow": 0, + "bottomRow": 1320, + "containerStyle": "none", + "snapRows": 125, + "parentRowSpace": 1, + "type": "CANVAS_WIDGET", + "canExtend": true, + "version": 56, + "minHeight": 1292, + "parentColumnSpace": 1, + "dynamicBindingPathList": [], + "leftColumn": 0, + "children": [ + { + "isVisible": true, + "label": "", + "widgetName": "Input1", + "version": 2, + "defaultText": "{{JSObject1.myFun1()}}", + "iconAlign": "left", + "autoFocus": false, + "labelStyle": "", + "resetOnSubmit": true, + "isRequired": false, + "isDisabled": false, + "animateLoading": true, + "inputType": "TEXT", + "type": "INPUT_WIDGET_V2", + "hideCard": false, + "displayName": "Input", + "key": "aco5l52fup", + "iconSVG": "/static/media/icon.9f505595.svg", + "widgetId": "m69vw37r1x", + "renderMode": "CANVAS", + "isLoading": false, + "parentColumnSpace": 12.5625, + "parentRowSpace": 10, + "leftColumn": 22, + "rightColumn": 42, + "topRow": 20, + "bottomRow": 24, + "parentId": "0", + "dynamicBindingPathList": [ + { + "key": "defaultText" + } + ], + "dynamicTriggerPathList": [] + } + ] + } + } \ No newline at end of file diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/EchoApiCMS_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Application/EchoApiCMS_spec.js index 04a5922dd2..8fe60516c2 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/Application/EchoApiCMS_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/EchoApiCMS_spec.js @@ -2,12 +2,9 @@ const dsl = require("../../../fixtures/CMSdsl.json"); const apiwidget = require("../../../locators/apiWidgetslocator.json"); import apiEditor from "../../../locators/ApiEditor"; import appPage from "../../../locators/CMSApplocators"; - +const commonlocators = require("../../../locators/commonlocators.json"); describe("Content Management System App", function() { - let orgid; - let newOrganizationName; - let appname; - let datasourceName; + let repoName; before(() => { cy.addDsl(dsl); @@ -127,4 +124,30 @@ describe("Content Management System App", function() { cy.ResponseCheck("Dan.Wyman@hotmail.com"); cy.ResponseCheck("Recusan"); }); + /*it("6. Connect app to git, verify data binding in edit and deploy mode", ()=>{ + cy.get(`.t--entity-name:contains("Page1")`) + .should("be.visible") + .click({ force: true }); + cy.generateUUID().then((uid) => { + repoName = uid; + + cy.createTestGithubRepo(repoName); + cy.connectToGitRepo(repoName); + }); + cy.latestDeployPreview() + cy.wait(2000) + cy.xpath("//span[text()='Curt50@gmail.com']").should("be.visible").click({ force: true }); + cy.xpath(appPage.subjectField).type("Test"); + cy.xpath(appPage.contentField) + .last() + .type("Task completed", { force: true }); + cy.get(appPage.confirmButton) + .closest("div") + .click({ force: true }); + cy.get(appPage.closeButton) + .closest("div") + .click({ force: true }); + cy.get(commonlocators.backToEditor).click(); + cy.wait(1000); + }) */ }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/MongoDBShoppingCart_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Application/MongoDBShoppingCart_spec.js index 3853d2d985..8060d5781c 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/Application/MongoDBShoppingCart_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/MongoDBShoppingCart_spec.js @@ -2,7 +2,9 @@ const dsl = require("../../../fixtures/mongoAppdsl.json"); const datasource = require("../../../locators/DatasourcesEditor.json"); const queryLocators = require("../../../locators/QueryEditor.json"); const appPage = require("../../../locators/PgAdminlocators.json"); +const commonlocators = require("../../../locators/commonlocators.json"); +let repoName; describe("Shopping cart App", function() { let datasourceName; @@ -166,4 +168,19 @@ describe("Shopping cart App", function() { .eq(3) .should("have.text", "3"); }); + /*it("Connect the appplication to git and validate data in deploy mode and edit mode", function() { + cy.generateUUID().then((uid) => { + repoName = uid; + cy.createTestGithubRepo(repoName); + cy.connectToGitRepo(repoName); + }); + cy.latestDeployPreview(); + cy.wait(2000) + cy.get(".selected-row").children().eq(0) + .should("have.text", "A man called ove"); + cy.get(commonlocators.backToEditor).click(); + cy.get(".selected-row").children().eq(0) + .should("have.text", "A man called ove"); + cy.wait(1000); + }) */ }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitImport/GitImport_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitImport/GitImport_spec.js index 56cef39ba3..fbc0a962e5 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitImport/GitImport_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitImport/GitImport_spec.js @@ -1,8 +1,15 @@ import gitSyncLocators from "../../../../locators/gitSyncLocators"; const homePage = require("../../../../locators/HomePage"); +const explorer = require("../../../../locators/explorerlocators.json"); const reconnectDatasourceModal = require("../../../../locators/ReconnectLocators"); +const apiwidget = require("../../../../locators/apiWidgetslocator.json"); +const pages = require("../../../../locators/Pages.json"); +const commonlocators = require("../../../../locators/commonlocators.json"); +const datasourceEditor = require("../../../../locators/DatasourcesEditor.json"); +const jsObject = "JSObject1"; +const newBranch = "feat/temp"; +const mainBranch = "master"; let repoName; -let appName; describe("Git import flow", function() { before(() => { @@ -24,36 +31,30 @@ describe("Git import flow", function() { cy.wait("@importNewApplication").then((interception) => { cy.wait(100); // should check reconnect modal opening - // const { isPartialImport } = interception.response.body.data; - // if (isPartialImport) { - // should reconnect button cy.get(reconnectDatasourceModal.Modal).should("be.visible"); cy.ReconnectDatasource("TEDPostgres"); cy.wait(1000); cy.fillPostgresDatasourceForm(); + cy.get(datasourceEditor.sectionAuthentication).click(); + cy.testSaveDatasource(); + cy.wait(1000); + cy.ReconnectDatasource("TEDMySQL"); + cy.wait(500); + cy.fillMySQLDatasourceForm(); + cy.get(datasourceEditor.sectionAuthentication).click(); + cy.testSaveDatasource(); + cy.wait(1000); + cy.ReconnectDatasource("TEDMongo"); + cy.wait(1000); + cy.fillMongoDatasourceForm(); + cy.get(datasourceEditor.sectionAuthentication).click(); cy.testSaveDatasource(); cy.wait(2000); - // commenting until bug12535 is closed - /* cy.ReconnectDatasource("TEDMySQL"); - cy.wait(2000); - cy.fillMySQLDatasourceForm(); - cy.testSaveDatasource(); - cy.wait(2000); - cy.ReconnectDatasource("TEDMongo"); - cy.wait(2000); - cy.fillMongoDatasourceForm(); - cy.testSaveDatasource(); - cy.wait(2000); - // } else { - cy.get(homePage.toastMessage).should( - "contain", - "Application imported successfully", + /*cy.get(homePage.toastMessage).should( + "contain", + "Application imported successfully", ); */ - cy.get(reconnectDatasourceModal.SkipToAppBtn).click({ force: true }); - cy.wait(2000); - cy.get(".tbody") - .first() - .should("contain.text", "Test user 7"); + cy.wait(1000); cy.generateUUID().then((uid) => { repoName = uid; cy.createTestGithubRepo(repoName); @@ -77,47 +78,147 @@ describe("Git import flow", function() { .next() .click(); cy.importAppFromGit(repoName); - // cy.wait("@importNewApplication").then((interception) => { cy.wait(100); - // should check reconnect modal opening - // const { isPartialImport } = interception.response.body.data; - // if (isPartialImport) { - // should reconnect button cy.get(reconnectDatasourceModal.Modal).should("be.visible"); cy.ReconnectDatasource("TEDPostgres"); - cy.wait(1000); + cy.wait(500); cy.fillPostgresDatasourceForm(); + cy.get(datasourceEditor.sectionAuthentication).click(); cy.testSaveDatasource(); - cy.wait(1000); - /* cy.ReconnectDatasource("TEDMySQL"); - cy.wait(1000); - cy.fillMySQLDatasourceForm(); - cy.testSaveDatasource(); - cy.wait(1000); - cy.ReconnectDatasource("TEDMongo"); - cy.wait(1000); - cy.fillMongoDatasourceForm(); - cy.testSaveDatasource(); - cy.wait(2000); - } else { - cy.get(homePage.toastMessage).should( - "contain", - "Application imported successfully", - ); - } */ - cy.get(reconnectDatasourceModal.SkipToAppBtn).click({ force: true }); + cy.wait(500); + cy.ReconnectDatasource("TEDMySQL"); + cy.wait(500); + cy.fillMySQLDatasourceForm(); + cy.get(datasourceEditor.sectionAuthentication).click(); + cy.testSaveDatasource(); + cy.wait(500); + cy.ReconnectDatasource("TEDMongo"); + cy.wait(500); + cy.fillMongoDatasourceForm(); + cy.get(datasourceEditor.sectionAuthentication).click(); + cy.testSaveDatasource(); + cy.wait(2000); + /* cy.get(homePage.toastMessage).should( + "contain", + "Application imported successfully", + ); */ }); - it("Verfiy imported app should have all the data binding visible", () => { + it("Verfiy imported app should have all the data binding visible in deploy and edit mode", () => { // verify postgres data binded to table + cy.get(".tbody") + .first() + .should("contain.text", "Test user 7"); + //verify MySQL data binded to table + cy.get(".tbody") + .last() + .should("contain.text", "New Config"); + // verify api response binded to input widget + cy.xpath("//input[@value='this is a test']").should("be.visible"); + // verify js object binded to input widget + cy.xpath("//input[@value='Success']").should("be.visible"); + }); + it("Create a new branch, clone page and validate data on that branch in deploy and edit mode", () => { + cy.createGitBranch(newBranch); cy.get(".tbody") .first() .should("contain.text", "Test user 7"); // verify MySQL data binded to table - // cy.get(".tbody").last().should("contain.text", "New Config") + cy.get(".tbody") + .last() + .should("contain.text", "New Config"); // verify api response binded to input widget cy.xpath("//input[@value='this is a test']"); // verify js object binded to input widget cy.xpath("//input[@value='Success']"); + cy.CheckAndUnfoldEntityItem("PAGES"); + // clone the page1 and validate data binding + cy.get(".t--entity-name:contains(Page1)") + .trigger("mouseover") + .click({ force: true }); + cy.xpath(apiwidget.popover) + .first() + .should("be.hidden") + .invoke("show") + .click({ force: true }); + cy.get(pages.clonePage).click({ force: true }); + cy.wait("@clonePage").should( + "have.nested.property", + "response.body.responseMeta.status", + 201, + ); + cy.CheckAndUnfoldEntityItem("QUERIES/JS"); + // verify jsObject is not duplicated + cy.get(`.t--entity-name:contains(${jsObject})`).should("have.length", 1); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + // deploy the app and validate data binding + cy.wait(2000); + cy.get(homePage.publishButton).click(); + cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); + cy.get(gitSyncLocators.commitButton).click(); + cy.wait(8000); + cy.get(gitSyncLocators.closeGitSyncModal).click(); + cy.merge(mainBranch); + cy.get(gitSyncLocators.closeGitSyncModal).click(); + cy.wait(2000); + cy.latestDeployPreview(); + cy.get(".tbody") + .first() + .should("contain.text", "Test user 7"); + // verify api response binded to input widget + cy.xpath("//input[@value='this is a test']"); + // verify js object binded to input widget + cy.xpath("//input[@value='Success']"); + // navigate to Page1 and verify data + cy.get(".t--page-switch-tab") + .contains("Page1") + .click({ force: true }); + cy.get(".tbody") + .first() + .should("contain.text", "Test user 7"); + // verify api response binded to input widget + cy.xpath("//input[@value='this is a test']"); + // verify js object binded to input widget + cy.xpath("//input[@value='Success']"); + cy.get(commonlocators.backToEditor).click(); + cy.wait(2000); + }); + it("Switch to master and verify data in edit and deploy mode", () => { + cy.switchGitBranch("master"); + cy.wait(2000); + // validate data binding in edit and deploy mode + cy.latestDeployPreview(); + cy.get(".tbody") + .first() + .should("contain.text", "Test user 7"); + cy.xpath("//input[@value='this is a test']"); + cy.xpath("//input[@value='Success']"); + // navigate to Page1 and verify data + cy.get(".t--page-switch-tab") + .contains("Page1 Copy") + .click({ force: true }); + cy.get(".tbody") + .first() + .should("contain.text", "Test user 7"); + cy.xpath("//input[@value='this is a test']"); + cy.xpath("//input[@value='Success']"); + cy.get(commonlocators.backToEditor).click(); + cy.wait(2000); + }); + it("Add widget to master, merge then checkout to child branch and verify data", () => { + cy.get(explorer.widgetSwitchId).click(); + cy.wait(2000); // wait for transition + cy.dragAndDropToCanvas("buttonwidget", { x: 300, y: 600 }); + cy.wait(3000); + cy.commitAndPush(); + cy.merge(newBranch); + cy.get(gitSyncLocators.closeGitSyncModal).click(); + cy.wait(2000); + cy.switchGitBranch(newBranch); + cy.wait(4000); + // verify button widget is visible on child branch + cy.get(".t--widget-buttonwidget").should("be.visible"); }); after(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitSync/GitBugs_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitSync/GitBugs_spec.js index f26e864dd3..64475c2566 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitSync/GitBugs_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitSync/GitBugs_spec.js @@ -1,11 +1,19 @@ import gitSyncLocators from "../../../../locators/gitSyncLocators"; +const dsl = require("../../../../fixtures/JsObjecWithGitdsl.json"); +const commonlocators = require("../../../../locators/commonlocators.json"); +const apiwidget = require("../../../../locators/apiWidgetslocator.json"); +const pages = require("../../../../locators/Pages.json"); +import homePage from "../../../../locators/HomePage"; +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +let ee = ObjectsRegistry.EntityExplorer; const pagename = "ChildPage"; -const tempBranch = "tempBranch"; +const tempBranch = "feat/tempBranch"; const tempBranch0 = "tempBranch0"; const mainBranch = "master"; +const jsObject = "JSObject1"; let repoName; -describe("Git sync Bugs", function() { +describe("Git sync Bug #10773", function() { before(() => { cy.NavigateToHome(); cy.createOrg(); @@ -35,10 +43,13 @@ describe("Git sync Bugs", function() { cy.get(`.t--entity-name:contains("${pagename}")`).click(); // delete page from tempBranch and merge to master cy.Deletepage(pagename); - cy.commitAndPush(); + cy.get(homePage.publishButton).click(); + cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); + cy.get(gitSyncLocators.commitButton).click(); + cy.wait(8000); + cy.get(gitSyncLocators.closeGitSyncModal).click(); cy.merge(mainBranch); cy.get(gitSyncLocators.closeGitSyncModal).click(); - cy.wait(8000); // verify ChildPage is not on master cy.switchGitBranch(mainBranch); cy.CheckAndUnfoldEntityItem("PAGES"); @@ -48,6 +59,185 @@ describe("Git sync Bugs", function() { cy.CheckAndUnfoldEntityItem("PAGES"); cy.get(`.t--entity-name:contains("${pagename}")`).should("not.exist"); }); +}); + +describe("Git Bug: Fix clone page issue where JSObject are not showing up in destination page when application is connected to git", function() { + it("Connect app to git, clone the Page ,verify JSobject duplication should not happen and validate data binding in deploy mode and edit mode", () => { + cy.NavigateToHome(); + cy.createOrg(); + cy.wait("@createOrg").then((interception) => { + const newOrganizationName = interception.response.body.data.name; + cy.CreateAppForOrg(newOrganizationName, newOrganizationName); + cy.addDsl(dsl); + }); + // connect app to git + cy.generateUUID().then((uid) => { + repoName = uid; + cy.createTestGithubRepo(repoName); + cy.connectToGitRepo(repoName); + }); + ee.expandCollapseEntity("QUERIES/JS", true); + // create JS object and validate its data on Page1 + cy.createJSObject('return "Success";'); + cy.get(`.t--entity-name:contains("Page1")`) + .should("be.visible") + .click({ force: true }); + cy.wait(1000); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + // clone the page1 and validate data binding + cy.get(".t--entity-name:contains(Page1)") + .trigger("mouseover") + .click({ force: true }); + cy.xpath(apiwidget.popover) + .first() + .should("be.hidden") + .invoke("show") + .click({ force: true }); + cy.get(pages.clonePage).click({ force: true }); + cy.wait("@clonePage").should( + "have.nested.property", + "response.body.responseMeta.status", + 201, + ); + cy.CheckAndUnfoldEntityItem("QUERIES/JS"); + // verify jsObject is not duplicated + cy.get(`.t--entity-name:contains(${jsObject})`).should("have.length", 1); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + // deploy the app and validate data binding + cy.get(homePage.publishButton).click(); + cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); + cy.get(gitSyncLocators.commitButton).click(); + cy.wait(8000); + cy.get(gitSyncLocators.closeGitSyncModal).click(); + cy.latestDeployPreview(); + cy.wait(2000); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + // switch to Page1 and validate data binding + cy.get(".t--page-switch-tab") + .contains("Page1") + .click({ force: true }); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + cy.get(commonlocators.backToEditor).click(); + cy.wait(1000); + }); + + it("Bug:12724 Js objects are merged to single page when user creates a new branch", () => { + // create a new branch, clone page and validate jsObject data binding + cy.createGitBranch(tempBranch); + cy.wait(2000); + cy.CheckAndUnfoldEntityItem("PAGES"); + cy.get(".t--entity-name:contains(Page1)") + .last() + .trigger("mouseover") + .click({ force: true }); + cy.CheckAndUnfoldEntityItem("QUERIES/JS"); + // verify jsObject is not duplicated + cy.get(`.t--entity-name:contains(${jsObject})`).should("have.length", 1); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + cy.get(".t--entity-name:contains(Page1)") + .first() + .trigger("mouseover") + .click({ force: true }); + cy.xpath(apiwidget.popover) + .first() + .should("be.hidden") + .invoke("show") + .click({ force: true }); + cy.get(pages.clonePage).click({ force: true }); + cy.wait("@clonePage").should( + "have.nested.property", + "response.body.responseMeta.status", + 201, + ); + }); + + after(() => { + cy.deleteTestGithubRepo(repoName); + }); +}); +describe("Git synced app with JSObject", function() { + it("Create an app with JSObject, connect it to git and verify its data in edit and deploy mode", function() { + cy.NavigateToHome(); + cy.createOrg(); + cy.wait("@createOrg").then((interception) => { + const newOrganizationName = interception.response.body.data.name; + cy.CreateAppForOrg(newOrganizationName, newOrganizationName); + cy.addDsl(dsl); + }); + ee.expandCollapseEntity("QUERIES/JS", true); + // create JS object and validate its data on Page1 + cy.createJSObject('return "Success";'); + cy.get(`.t--entity-name:contains("Page1")`) + .should("be.visible") + .click({ force: true }); + cy.wait(1000); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + // clone the page1 and validate data binding + cy.get(".t--entity-name:contains(Page1)") + .trigger("mouseover") + .click({ force: true }); + cy.xpath(apiwidget.popover) + .first() + .should("be.hidden") + .invoke("show") + .click({ force: true }); + cy.get(pages.clonePage).click({ force: true }); + cy.wait("@clonePage").should( + "have.nested.property", + "response.body.responseMeta.status", + 201, + ); + // connect app to git and deploy + cy.generateUUID().then((uid) => { + repoName = uid; + cy.createTestGithubRepo(repoName); + cy.connectToGitRepo(repoName); + cy.wait(3000); + }); + cy.latestDeployPreview(); + cy.wait(2000); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + // switch to Page1 and validate data binding + cy.get(".t--page-switch-tab") + .contains("Page1") + .click({ force: true }); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + cy.get(commonlocators.backToEditor).click(); + // verify jsObject data binding on Page 1 + cy.CheckAndUnfoldEntityItem("QUERIES/JS"); + cy.get(`.t--entity-name:contains(${jsObject})`).should("have.length", 1); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + // switch to Page1 copy and verify jsObject data binding + cy.CheckAndUnfoldEntityItem("PAGES"); + cy.get(".t--entity-name:contains(Page1)") + .last() + .trigger("mouseover") + .click({ force: true }); + cy.CheckAndUnfoldEntityItem("QUERIES/JS"); + // verify jsObject is not duplicated + cy.get(`.t--entity-name:contains(${jsObject})`).should("have.length", 1); + cy.xpath("//input[@class='bp3-input' and @value='Success']").should( + "be.visible", + ); + }); after(() => { cy.deleteTestGithubRepo(repoName); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Onboarding/FirstTimeUserOnboarding_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Onboarding/FirstTimeUserOnboarding_spec.js index df363aedfb..f3fb8a129b 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Onboarding/FirstTimeUserOnboarding_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Onboarding/FirstTimeUserOnboarding_spec.js @@ -170,7 +170,11 @@ describe("FirstTimeUserOnboarding", function() { .should("be.visible") .wait(800); cy.reload(); - cy.wait("@getUser"); + cy.wait("@getPage").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); cy.get(OnboardingLocator.statusbar).should("be.visible"); cy.get(OnboardingLocator.textWidgetName).should("be.visible"); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js index 0d22effe89..ac4a1d5d1c 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js @@ -62,7 +62,7 @@ describe("Undo/Redo functionality", function() { cy.get("body").click(0, 0); cy.get("body").type(`{${modifierKey}}z`); cy.get("body").type(`{${modifierKey}}z`); - cy.wait(1000); + cy.wait(2000); cy.get(apiwidget.headers).should("have.class", "react-tabs__tab--selected"); cy.get("body").type(`{${modifierKey}}z`); cy.get(`${apiwidget.resourceUrl} .CodeMirror-placeholder`).should( diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 0c34c5e311..1f4e2e5294 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -955,7 +955,7 @@ Cypress.Commands.add("startServerAndRoutes", () => { cy.route("POST", "api/v1/git/connect/*").as("connectGitRepo"); cy.route("POST", "api/v1/git/commit/*").as("commit"); cy.route("POST", "/api/v1/git/import/*").as("importFromGit"); - + cy.route("POST", "/api/v1/git/merge/*").as("mergeBranch"); cy.route("PUT", "api/v1/collections/actions/refactor").as("renameJsAction"); cy.route("POST", "/api/v1/collections/actions").as("createNewJSCollection"); diff --git a/app/client/cypress/support/gitSync.js b/app/client/cypress/support/gitSync.js index 96f170c5ed..73e877a800 100644 --- a/app/client/cypress/support/gitSync.js +++ b/app/client/cypress/support/gitSync.js @@ -10,7 +10,6 @@ const { import gitSyncLocators from "../locators/gitSyncLocators"; import homePage from "../locators/HomePage"; const commonLocators = require("../locators/commonlocators.json"); - const GITHUB_API_BASE = "https://api.github.com"; Cypress.Commands.add("revokeAccessGit", (appName) => { @@ -123,6 +122,26 @@ Cypress.Commands.add( }); }, ); +Cypress.Commands.add("latestDeployPreview", () => { + cy.server(); + cy.route("POST", "/api/v1/applications/publish/*").as("publishApp"); + // Wait before publish + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(2000); + cy.assertPageSave(); + + // Stubbing window.open to open in the same tab + cy.window().then((window) => { + cy.stub(window, "open").callsFake((url) => { + window.location.href = Cypress.config().baseUrl + url.substring(1); + window.location.target = "_self"; + }); + }); + cy.get(gitSyncLocators.bottomBarCommitButton).click(); + cy.xpath("//span[text()='Latest deployed preview']").click(); + cy.log("pagename: " + localStorage.getItem("PageName")); + cy.wait(2000); //wait time for page to load! +}); Cypress.Commands.add("createGitBranch", (branch) => { cy.get(gitSyncLocators.branchButton).click({ force: true }); @@ -208,7 +227,6 @@ Cypress.Commands.add("commitAndPush", (assertFailure) => { cy.get(homePage.publishButton).click(); cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); cy.get(gitSyncLocators.commitButton).click(); - if (!assertFailure) { // check for commit success cy.wait("@commit").should( @@ -216,6 +234,7 @@ Cypress.Commands.add("commitAndPush", (assertFailure) => { "response.body.responseMeta.status", 201, ); + cy.wait(2000); } else { cy.wait("@commit").then((interception) => { const status = interception.response.body.responseMeta.status; @@ -265,6 +284,12 @@ Cypress.Commands.add("merge", (destinationBranch) => { .click(); cy.contains(Cypress.env("MESSAGES").NO_MERGE_CONFLICT()); cy.get(gitSyncLocators.mergeCTA).click(); + cy.wait("@mergeBranch").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); + cy.contains(Cypress.env("MESSAGES").MERGED_SUCCESSFULLY()); }); Cypress.Commands.add( diff --git a/app/client/src/ce/constants/messages.test.ts b/app/client/src/ce/constants/messages.test.ts index 2f29afcf17..2a632651fa 100644 --- a/app/client/src/ce/constants/messages.test.ts +++ b/app/client/src/ce/constants/messages.test.ts @@ -47,6 +47,7 @@ import { MERGE, MERGE_CHANGES, MERGE_CONFLICT_ERROR, + MERGED_SUCCESSFULLY, NO_MERGE_CONFLICT, NONE_REVERSIBLE_MESSAGE, PASTE_SSH_URL_INFO, @@ -271,6 +272,7 @@ describe("git-sync messages", () => { key: "CHANGES_USER_AND_MIGRATION", value: "Appsmith update and user changes since last commit", }, + { key: "MERGED_SUCCESSFULLY", value: "Merged successfully" }, ]; const functions = [ CANNOT_MERGE_DUE_TO_UNCOMMITTED_CHANGES, @@ -319,6 +321,7 @@ describe("git-sync messages", () => { MERGE_CONFLICT_ERROR, NONE_REVERSIBLE_MESSAGE, NO_MERGE_CONFLICT, + MERGED_SUCCESSFULLY, PASTE_SSH_URL_INFO, PULL_CHANGES, REGENERATE_KEY_CONFIRM_MESSAGE,