diff --git a/app/client/cypress.json b/app/client/cypress.json index 31de784788..dacb775096 100644 --- a/app/client/cypress.json +++ b/app/client/cypress.json @@ -13,9 +13,6 @@ "html": true, "json": false }, - "ignoreTestFiles": [ - "**/Regression_TestSuite/Application/PgAdmin_spec*.js" - ], "chromeWebSecurity": false, "viewportHeight": 1100, "viewportWidth": 1400, diff --git a/app/client/cypress/fixtures/promisesStoreValueDsl.json b/app/client/cypress/fixtures/promisesStoreValueDsl.json index dc76b063f9..27df3259b3 100644 --- a/app/client/cypress/fixtures/promisesStoreValueDsl.json +++ b/app/client/cypress/fixtures/promisesStoreValueDsl.json @@ -1110,7 +1110,7 @@ "widgetId": "hzi419yzw9", "accentColor": "{{appsmith.theme.colors.primaryColor}}", "isVisibleFilters": true, - "tableData": "{{TC1api.data.users}}", + "tableData": "{{TC1api.data}}", "isVisible": true, "label": "Data", "searchKey": "", diff --git a/app/client/cypress/integration/Regression_TestSuite/Application/MongoDBShoppingCart_spec.js b/app/client/cypress/integration/Regression_TestSuite/Application/MongoDBShoppingCart_spec.js index cbac44b196..9706d56089 100644 --- a/app/client/cypress/integration/Regression_TestSuite/Application/MongoDBShoppingCart_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/Application/MongoDBShoppingCart_spec.js @@ -3,6 +3,7 @@ const datasource = require("../../../locators/DatasourcesEditor.json"); const queryLocators = require("../../../locators/QueryEditor.json"); const appPage = require("../../../locators/PgAdminlocators.json"); const formControls = require("../../../locators/FormControl.json"); +import * as _ from "../../../support/Objects/ObjectsCore"; let repoName; describe("Shopping cart App", function() { @@ -193,19 +194,22 @@ describe("Shopping cart App", function() { .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); + it("3. Connect the appplication to git and validate data in deploy mode and edit mode", function() { + _.gitSync.CreateNConnectToGit(repoName); + cy.get("@gitRepoName").then((repName) => { + repoName = repName; }); 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(2000); + cy.get(".selected-row") + .children() + .eq(0) + .should("have.text", "A man called ove"); + _.deployMode.NavigateBacktoEditor(); + cy.get(".selected-row") + .children() + .eq(0) + .should("have.text", "A man called ove"); cy.wait(1000); - }) */ + }); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/Application/PgAdmin_spec.js b/app/client/cypress/integration/Regression_TestSuite/Application/PgAdmin_spec.js index 8d08202542..a450d7ef32 100644 --- a/app/client/cypress/integration/Regression_TestSuite/Application/PgAdmin_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/Application/PgAdmin_spec.js @@ -1,6 +1,5 @@ -import homePage from "../../../locators/HomePage"; +import * as _ from "../../../support/Objects/ObjectsCore"; const dsl = require("../../../fixtures/PgAdmindsl.json"); -const datasource = require("../../../locators/DatasourcesEditor.json"); const queryLocators = require("../../../locators/QueryEditor.json"); const widgetsPage = require("../../../locators/Widgets.json"); const appPage = require("../../../locators/PgAdminlocators.json"); @@ -12,25 +11,16 @@ describe("PgAdmin Clone App", function() { cy.addDsl(dsl); }); - beforeEach(() => { - cy.startRoutesForDatasource(); - }); - - it("Add dsl and authenticate datasource", function() { - // authenticating datasource - cy.NavigateToDatasourceEditor(); - cy.get(datasource.PostgreSQL).click(); - cy.fillPostgresDatasourceForm(); - - cy.testSaveDatasource(); - - cy.get("@saveDatasource").then((httpResponse) => { - datasourceName = httpResponse.response.body.data.name; + it("1. Add dsl and authenticate datasource", function() { + _.dataSources.CreateDataSource("Postgres"); + cy.get("@dsName").then(($dsName) => { + datasourceName = $dsName; }); }); - it("Create queries", function() { + it("2. Create queries", function() { cy.NavigateToQueryEditor(); + cy.NavigateToActiveTab(); // clicking on new query to write a query cy.contains(".t--datasource-name", datasourceName) .find(queryLocators.createQuery) @@ -43,16 +33,11 @@ describe("PgAdmin Clone App", function() { cy.get(queryLocators.templateMenu).click(); cy.get(queryLocators.query).click({ force: true }); // writing query to get the schema - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("SELECT schema_name FROM information_schema.schemata;", { - force: true, - parseSpecialCharSequences: false, - }); - cy.WaitAutoSave(); - cy.runQuery(); - // clicking on chevron icon to go back to the datasources page + _.dataSources.EnterQuery( + "SELECT schema_name FROM information_schema.schemata;", + ); + _.dataSources.RunQuery(); + // clicking on chevron icon to go back to the _.dataSources page cy.get(appPage.dropdownChevronLeft).click(); // clicking on new query to write a query cy.contains(".t--datasource-name", datasourceName) @@ -61,19 +46,12 @@ describe("PgAdmin Clone App", function() { cy.get(queryLocators.queryNameField).type("get_tables"); cy.get(queryLocators.templateMenu).click(); // writing query to get all the tables - cy.get(".CodeMirror textarea") - .first() - .focus() - .type( - 'select * from pg_catalog.pg_tables where schemaname = {{schema_select.selectedOptionValue || "public"}} ;', - { - force: true, - parseSpecialCharSequences: false, - }, - ); - cy.WaitAutoSave(); - cy.runQuery(); - // clicking on chevron icon to go back to the datasources page + _.dataSources.EnterQuery( + `select * from pg_catalog.pg_tables where schemaname = {{schema_select.selectedOptionValue || "public"}} ;`, + 2000, + ); + _.dataSources.RunQuery(); + // clicking on chevron icon to go back to the _.dataSources page cy.get(appPage.dropdownChevronLeft).click(); // clicking on new query to write a query cy.contains(".t--datasource-name", datasourceName) @@ -82,21 +60,40 @@ describe("PgAdmin Clone App", function() { cy.get(queryLocators.queryNameField).type("get_columns"); cy.get(queryLocators.templateMenu).click(); // creating query to get the columns of the table - cy.get(".CodeMirror textarea") - .first() - .focus() - .type( - "SELECT column_name, data_type, table_name, ordinal_position, is_nullable FROM information_schema.COLUMNS", - { - force: true, - parseSpecialCharSequences: false, - }, - ); - cy.WaitAutoSave(); - cy.runQuery(); - // clicking on chevron icon to go back to the datasources page - cy.get(appPage.dropdownChevronLeft).click(); - // clicking on new query to write a query + _.dataSources.EnterQuery( + `SELECT column_name, data_type, table_name, ordinal_position, is_nullable FROM information_schema.COLUMNS`, + ); + _.dataSources.RunQuery(); + _.ee.SelectEntityByName("Page1", "Pages"); + _.agHelper.GetNClick(appPage.viewButton, 0, true); + // adding new table + _.agHelper.GetNClick(appPage.addNewtable, 0, true); + _.agHelper.GenerateUUID(); + cy.get("@guid").then((uid) => { + cy.xpath(appPage.addTablename) + .clear() + .type(`table${uid}`); + }); + // adding column to the table + _.agHelper.GetNClick(appPage.addColumn, 0, true); + _.agHelper.AssertElementVisible(appPage.columnNamefield); + _.agHelper.AssertElementVisible(appPage.datatypefield); + cy.xpath(appPage.addTablename) + .click() + .type("id"); + cy.get(appPage.dropdownChevronDown) + .last() + .click(); + _.agHelper.GetNClick(appPage.selectDatatype); + // switching on the Not Null toggle + cy.get(widgetsPage.switchWidgetInactive) + .last() + .click(); + _.agHelper.GetNClick(appPage.submitButton, 0, true); + _.agHelper.AssertElementVisible(appPage.addColumn); + _.agHelper.GetNClick(appPage.closeButton, 0, true); + _.dataSources.NavigateToActiveTab(); + cy.contains(".t--datasource-name", datasourceName) .find(queryLocators.createQuery) .click(); @@ -107,19 +104,12 @@ describe("PgAdmin Clone App", function() { .click({ force: true }); cy.get(queryLocators.templateMenu).click(); // writing query to create new table - cy.get(".CodeMirror textarea") - .first() - .focus() - .type( - 'CREATE TABLE {{schema_select.selectedOptionValue}}.{{nt_name.text.replaceAll(" ","_")}}({{appsmith.store.nt_col.map((c)=>c.name.replaceAll(" ","_") + " " + c.dtype + (c.nnull ? " NOT NULL " : "") + (c.pkey ? " PRIMARY KEY " : "")).join(" , ")}})', - { - force: true, - parseSpecialCharSequences: false, - }, - ); - cy.WaitAutoSave(); - cy.runQuery(); - // clicking on chevron icon to go back to the datasources page + + _.dataSources.EnterQuery( + `CREATE TABLE {{schema_select.selectedOptionValue}}.{{nt_name.text.replaceAll(" ","_")}}({{appsmith.store.nt_col.map((c)=>c.name.replaceAll(" ","_") + " " + c.dtype + (c.nnull ? " NOT NULL " : "") + (c.pkey ? " PRIMARY KEY " : "")).join(" , ")}})`, + ); + _.dataSources.RunQuery(); + // clicking on chevron icon to go back to the _.dataSources page cy.get(appPage.dropdownChevronLeft).click(); // clicking on new query to write a query cy.contains(".t--datasource-name", datasourceName) @@ -132,38 +122,30 @@ describe("PgAdmin Clone App", function() { .last() .click({ force: true }); // creating query to delete the table - cy.get(".CodeMirror textarea") - .first() - .focus() - .type( - "DROP TABLE {{schema_select.selectedOptionValue}}.{{List1.selectedItem.tablename}};", - { - force: true, - parseSpecialCharSequences: false, - }, - ); - cy.WaitAutoSave(); - cy.runQuery(); - // clicking on chevron icon to go back to the datasources page + _.dataSources.EnterQuery( + `DROP TABLE {{schema_select.selectedOptionValue}}.{{List1.selectedItem.tablename}};`, + ); + _.dataSources.RunQuery(); + // clicking on chevron icon to go back to the _.dataSources page cy.get(appPage.dropdownChevronLeft).click(); }); - it("Add new table", function() { - const uuid = () => Cypress._.random(0, 1e6); - const id = uuid(); - const Table = `table${id}`; + it("3. Add new table", function() { // clicking on chevron to go back to the application page cy.get(appPage.dropdownChevronLeft).click(); // adding new table - cy.xpath(appPage.addNewtable).click(); - cy.xpath(appPage.addTablename) - .clear() - .type(Table); + cy.xpath(appPage.addNewtable).click({ force: true }); + cy.wait(500); + cy.generateUUID().then((UUID) => { + cy.xpath(appPage.addTablename) + .clear() + .type(`table${UUID}`); + }); // adding column to the table - cy.xpath(appPage.addColumn).click(); + cy.xpath(appPage.addColumn).click({ force: true }); cy.xpath(appPage.columnNamefield).should("be.visible"); cy.xpath(appPage.datatypefield).should("be.visible"); - cy.xpath(appPage.addTablename).type("id"); + cy.xpath(appPage.addTablename).type("id2"); cy.get(appPage.dropdownChevronDown) .last() .click(); @@ -176,13 +158,16 @@ describe("PgAdmin Clone App", function() { cy.get(widgetsPage.switchWidgetInactive) .last() .click(); - cy.xpath(appPage.submitButton).click(); - cy.xpath(appPage.addColumn).should("be.visible"); cy.xpath(appPage.submitButton).click({ force: true }); - cy.xpath(appPage.closeButton).click(); + cy.xpath(appPage.addColumn).should("be.visible"); + cy.wait(500); + cy.xpath(appPage.submitButton) + .first() + .click({ force: true }); + cy.xpath(appPage.closeButton).click({ force: true }); }); - it("View and Delete table", function() { + it("4.View and Delete table", function() { cy.xpath(appPage.addNewtable).should("be.visible"); // viewing the table's columns by clicking on view button cy.xpath(appPage.viewButton) @@ -192,7 +177,7 @@ describe("PgAdmin Clone App", function() { cy.xpath(appPage.deleteButton) .last() .click({ force: true }); - cy.xpath(appPage.confirmButton).click(); - cy.xpath(appPage.closeButton).click(); + cy.xpath(appPage.confirmButton).click({ force: true }); + cy.xpath(appPage.closeButton).click({ force: true }); }); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/Application/PromisesApp_spec.js b/app/client/cypress/integration/Regression_TestSuite/Application/PromisesApp_spec.js index 03e2da1afb..ca6415c1b5 100644 --- a/app/client/cypress/integration/Regression_TestSuite/Application/PromisesApp_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/Application/PromisesApp_spec.js @@ -13,7 +13,7 @@ describe("JSEditor tests", function() { }); it("Testing promises with resetWidget, storeValue action and API call", () => { - _.apiPage.CreateAndFillApi("https://mock-api.appsmith.com/users", "TC1api"); + _.apiPage.CreateAndFillApi(_.agHelper.mockApiUrl, "TC1api"); _.apiPage.RunAPI(); _.jsEditor.CreateJSObject( `export default { diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Autocomplete/Autocomplete_JS_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Autocomplete/Autocomplete_JS_spec.ts index ebe8a71bbe..9aec4a038a 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Autocomplete/Autocomplete_JS_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Autocomplete/Autocomplete_JS_spec.ts @@ -147,7 +147,7 @@ describe("Autocomplete tests", () => { }); it("5. Api data with array of object autocompletion test", () => { - ApiPage.CreateAndFillApi("https://mock-api.appsmith.com/users"); + ApiPage.CreateAndFillApi(agHelper.mockApiUrl); agHelper.Sleep(2000); ApiPage.RunAPI(); // Using same js object @@ -155,10 +155,10 @@ describe("Autocomplete tests", () => { agHelper.GetNClick(jsEditor._lineinJsEditor(5), 0, true); agHelper.SelectNRemoveLineText(CommonLocators._codeMirrorTextArea); //agHelper.GetNClick(jsEditor._lineinJsEditor(5)); - agHelper.TypeText(CommonLocators._codeMirrorTextArea, "Api1.data.u"); - agHelper.GetNAssertElementText(CommonLocators._hints, "users"); + agHelper.TypeText(CommonLocators._codeMirrorTextArea, "Api1.d"); + agHelper.GetNAssertElementText(CommonLocators._hints, "data"); agHelper.Sleep(); - agHelper.TypeText(CommonLocators._codeMirrorTextArea, "sers[0].e"); + agHelper.TypeText(CommonLocators._codeMirrorTextArea, "ata[0].e"); agHelper.GetNAssertElementText(CommonLocators._hints, "email"); agHelper.Sleep(); agHelper.TypeText(CommonLocators._codeMirrorTextArea, "mail"); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/Bug16377_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/Bug16377_spec.ts index 1a45f229d7..a7b3c0e395 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/Bug16377_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/Bug16377_spec.ts @@ -10,7 +10,8 @@ const locator = ObjectsRegistry.CommonLocators, describe("Binding Expressions should not be truncated in Url and path extraction", function() { it("Bug 16377, When Api url has dynamic binding expressions, ensure the url and path derived is not corrupting Api execution", function() { - const apiUrl = `https://mock-api.appsmith.com/{{true ? 'users' : 'user'}}`; + //Since the specified expression always returns true - it will never run mock-apis - which actually doesn't exist + const apiUrl = `http://host.docker.internal:5001/v1/{{true ? 'mock-api' : 'mock-apis'}}?records=10`; apiPage.CreateAndFillApi(apiUrl, "BindingExpressions"); apiPage.RunAPI(); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/DatasourceSchema_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/DatasourceSchema_spec.ts index 3388a0f46e..6f29ab13f1 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/DatasourceSchema_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/DatasourceSchema_spec.ts @@ -17,20 +17,24 @@ describe("Datasource form related tests", function() { dataSources.CreatePlugIn("PostgreSQL"); agHelper.RenameWithInPane(dataSourceName, false); dataSources.FillPostgresDSForm(false, "docker", "wrongPassword"); - dataSources.verifySchema(dataSourceName, "Failed to initialize pool"); + dataSources.VerifySchema(dataSourceName, "Failed to initialize pool"); agHelper.GetNClick(dataSources._editButton); - dataSources.updatePassword("docker"); - dataSources.verifySchema(dataSourceName, "public.", true); + dataSources.UpdatePassword("docker"); + dataSources.VerifySchema(dataSourceName, "public.", true); + agHelper.GetNClick(dataSources._createQuery) }); }); it("2. Verify if schema was fetched once #18448", () => { - agHelper.RefreshPage(); + agHelper.RefreshPage() + ee.ExpandCollapseEntity("Datasources"); + ee.ExpandCollapseEntity(dataSourceName,false); cy.intercept("GET", dataSources._getStructureReq).as("getDSStructure"); ee.ExpandCollapseEntity("Datasources"); ee.ExpandCollapseEntity(dataSourceName); agHelper.Sleep(1500); - cy.verifyCallCount(`@getDatasourceStructure`, 1); + agHelper.VerifyCallCount(`@getDatasourceStructure`, 1); + dataSources.DeleteQuery("Query1"); dataSources.DeleteDatasouceFromWinthinDS(dataSourceName); }); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/GitBugs_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/GitBugs_Spec.ts index 3745e5188f..8c365422dc 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/GitBugs_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/GitBugs_Spec.ts @@ -25,6 +25,7 @@ describe("Git Bugs", function() { _.agHelper.AssertElementVisible(_.gitSync._branchButton); cy.get("@gitRepoName").then((repoName) => { testName = repoName; + cy.log("testName is :"+ testName) }); }); @@ -54,6 +55,6 @@ describe("Git Bugs", function() { }); after(() => { - //_.gitSync.DeleteTestGithubRepo(testName); + _.gitSync.DeleteTestGithubRepo(testName); }); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/InputTruncateCheck_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/InputTruncateCheck_Spec.ts index 79313bfb58..0075d3534c 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/InputTruncateCheck_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/InputTruncateCheck_Spec.ts @@ -80,7 +80,7 @@ const widgetsToTest = { }; function configureApi() { - apiPage.CreateAndFillApi("https://mock-api.appsmith.com/users", "FirstAPI"); + apiPage.CreateAndFillApi(agHelper.mockApiUrl, "FirstAPI"); apiPage.EnterHeader("value", "{{this.params.value}}"); } diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/ExplorerTests/Scrolling_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/ExplorerTests/Scrolling_Spec.ts index 95349ff76f..db945f0389 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/ExplorerTests/Scrolling_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/ExplorerTests/Scrolling_Spec.ts @@ -27,12 +27,15 @@ describe("Entity explorer context menu should hide on scrolling", function() { dataSources.CreateQuery(mockDBNameMovies); }); cy.get('@usersDB').then((dbName : any)=> { + agHelper.Sleep();//time for mock schema to load ee.ExpandCollapseEntity(dbName); }) cy.get('@moviesDB').then((dbName: any)=> { + agHelper.Sleep();//time for mock schema to load ee.ExpandCollapseEntity(dbName); }) ee.ExpandCollapseEntity("public.users"); + ee.ExpandCollapseEntity("movies") agHelper.GetNClick(locator._createNew); agHelper.AssertElementVisible(ee._createNewPopup); agHelper.ScrollTo(ee._entityExplorerWrapper, "bottom"); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitImport/GitImport_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitImport/GitImport_spec.js index bf3dc3b630..160aa4d676 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitImport/GitImport_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitImport/GitImport_spec.js @@ -7,7 +7,7 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); const datasourceEditor = require("../../../../../locators/DatasourcesEditor.json"); import * as _ from "../../../../../support/Objects/ObjectsCore"; const jsObject = "JSObject1"; -const newBranch = "feat/temp"; +let newBranch = "feat/temp"; const mainBranch = "master"; let repoName, newWorkspaceName; @@ -65,17 +65,13 @@ describe("Git import flow ", function() { force: true, }); cy.wait(1000); - cy.generateUUID().then((uid) => { - repoName = uid; - _.gitSync.CreateNConnectToGit(repoName); - cy.get("@gitRepoName").then((repName) => { - repoName = repName; - _.gitSync.CreateGitBranch(repoName); - }); - // cy.createTestGithubRepo(repoName); - // cy.connectToGitRepo(repoName); + _.gitSync.CreateNConnectToGit(); + cy.get("@gitRepoName").then((repName) => { + repoName = repName; + _.gitSync.CreateGitBranch(repoName); }); + cy.wait(5000); // for git connection to settle! }); }); @@ -149,9 +145,15 @@ describe("Git import flow ", function() { cy.xpath("//input[@value='Success']").should("be.visible"); }); - // skipping this due to open bug #18776 - it.skip("4. Create a new branch, clone page and validate data on that branch in view and edit mode", () => { - cy.createGitBranch(newBranch); + it("4. Create a new branch, clone page and validate data on that branch in view and edit mode", () => { + //cy.createGitBranch(newBranch); + _.gitSync.CreateGitBranch(newBranch, true); + + cy.get("@gitbranchName").then((branName) => { + newBranch = branName; + cy.log("newBranch is " + newBranch); + }); + cy.get(".tbody") .first() .should("contain.text", "Test user 7"); @@ -188,6 +190,7 @@ describe("Git import flow ", function() { // deploy the app and validate data binding cy.wait(2000); cy.get(homePage.publishButton).click(); + _.agHelper.AssertElementExist(_.gitSync._bottomBarPull); cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); cy.get(gitSyncLocators.commitButton).click(); cy.intercept("POST", "api/v1/git/commit/app/*").as("commit"); @@ -220,8 +223,7 @@ describe("Git import flow ", function() { cy.wait(2000); }); - // skipping this due to open bug #18776 - it.skip("5. Switch to master and verify data in edit and view mode", () => { + it("5. Switch to master and verify data in edit and view mode", () => { cy.switchGitBranch("master"); cy.wait(2000); // validate data binding in edit and deploy mode @@ -244,8 +246,7 @@ describe("Git import flow ", function() { cy.wait(2000); }); - // skipping this due to open bug #18776 - it.skip("6. Add widget to master, merge then checkout to child branch and verify data", () => { + it("6. Add widget to master, merge then checkout to child branch and verify data", () => { _.canvasHelper.OpenWidgetPane(); cy.wait(2000); // wait for transition cy.dragAndDropToCanvas("buttonwidget", { x: 300, y: 600 }); @@ -261,6 +262,6 @@ describe("Git import flow ", function() { }); after(() => { - //cy.deleteTestGithubRepo(repoName); + _.gitSync.DeleteTestGithubRepo(repoName); }); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/Deploy_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/Deploy_spec.js similarity index 93% rename from app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/Deploy_spec.ts rename to app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/Deploy_spec.js index 82d95b067b..f42ad7de9a 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/Deploy_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/Deploy_spec.js @@ -2,18 +2,18 @@ import gitSyncLocators from "../../../../../locators/gitSyncLocators"; import homePage from "../../../../../locators/HomePage"; import * as _ from "../../../../../support/Objects/ObjectsCore"; -let repoName: string; +let repoName; describe("Git sync modal: deploy tab", function() { before(() => { _.homePage.NavigateToHome(); cy.createWorkspace(); //_.homePage.CreateNewWorkspace("DeployGitTest"); - cy.wait("@createWorkspace").then((interception: any) => { + cy.wait("@createWorkspace").then((interception) => { const newWorkspaceName = interception.response.body.data.name; cy.CreateAppForWorkspace(newWorkspaceName, newWorkspaceName); }); - _.gitSync.CreateNConnectToGit("Test", false); - cy.get("@gitRepoName").then((repName: any) => { + _.gitSync.CreateNConnectToGit("Test"); + cy.get("@gitRepoName").then((repName) => { repoName = repName; }); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/DisconnectGit_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/DisconnectGit_spec.js index c25e1f6b1e..bb211c1a23 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/DisconnectGit_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/DisconnectGit_spec.js @@ -14,13 +14,11 @@ describe("Git disconnect modal:", function() { cy.generateUUID().then((uid) => { repoName = uid; _.gitSync.CreateTestGiteaRepo(repoName); - //cy.createTestGithubRepo(repoName); }); }); it("1. should be opened with proper components", function() { - _.gitSync.AuthorizeKeyToGitea(repoName, false); - //cy.connectToGitRepo(repoName, false); + _.gitSync.AuthorizeKeyToGitea(repoName); cy.get(gitSyncLocators.bottomBarCommitButton).click(); cy.get("[data-cy=t--tab-GIT_CONNECTION]").click(); // after clicked disconnect on connection modal, @@ -62,7 +60,6 @@ describe("Git disconnect modal:", function() { }); it("2. should have disconnect repo button", function() { - cy.wait(4000); cy.get(gitSyncLocators.bottomBarCommitButton).click(); cy.get("[data-cy=t--tab-GIT_CONNECTION]").click(); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js index 6eb4739b8c..de6f4f2e18 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js @@ -112,6 +112,7 @@ describe("Git sync Bug #10773", function() { ); // deploy the app and validate data binding cy.get(homePage.publishButton).click(); + _.agHelper.AssertElementExist(_.gitSync._bottomBarPull); cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); cy.get(gitSyncLocators.commitButton).click(); cy.wait(8000); @@ -166,7 +167,6 @@ describe("Git sync Bug #10773", function() { 201, ); _.gitSync.DeleteTestGithubRepo(repoName); - //cy.deleteTestGithubRepo(repoName); }); it("4. Create an app with JSObject, connect it to git and verify its data in edit and deploy mode", function() { @@ -203,13 +203,10 @@ describe("Git sync Bug #10773", function() { 201, ); // connect app to git and deploy - _.gitSync.CreateNConnectToGit(repoName); + _.gitSync.CreateNConnectToGit(); cy.get("@gitRepoName").then((repName) => { repoName = repName; - - // cy.createTestGithubRepo(repoName); - // cy.connectToGitRepo(repoName); - cy.wait(3000); + cy.wait(2000); cy.window() .its("store") @@ -218,6 +215,7 @@ describe("Git sync Bug #10773", function() { const commitInputDisabled = state.ui.gitSync.gitStatus?.isClean || state.ui.gitSync.isCommitting; + cy.log("commitInputDisabled is " + commitInputDisabled); if (!commitInputDisabled) { cy.commitAndPush(); } diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/Merge_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/Merge_spec.js index 16faa725ea..02151f26d9 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/Merge_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/Merge_spec.js @@ -22,10 +22,7 @@ describe("Git sync modal: merge tab", function() { it("1. Verify the functionality of the default dropdown under merge tab", function() { cy.get(commonLocators.canvas).click({ force: true }); - //cy.createGitBranch(childBranchKey); - _.gitSync.CreateGitBranch(childBranchKey); - cy.get(gitSyncLocators.bottomBarMergeButton).click(); cy.get(gitSyncLocators.gitSyncModal).should("exist"); cy.get("[data-cy=t--tab-MERGE]").should("exist"); @@ -39,7 +36,9 @@ describe("Git sync modal: merge tab", function() { cy.get(commonLocators.dropdownmenu) .contains(mainBranch) .click(); - cy.wait("@mergeStatus").should( + _.agHelper.AssertElementAbsence(_.gitSync._checkMergeability, 30000); + + cy.wait("@mergeStatus", { timeout: 35000 }).should( "have.nested.property", "response.body.data.isMergeAble", true, @@ -51,6 +50,5 @@ describe("Git sync modal: merge tab", function() { after(() => { _.gitSync.DeleteTestGithubRepo(repoName); - //cy.deleteTestGithubRepo(repoName); }); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/RepoLimitExceededErrorModal_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/RepoLimitExceededErrorModal_spec.js index 8608225e8c..911288acf2 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/RepoLimitExceededErrorModal_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/RepoLimitExceededErrorModal_spec.js @@ -2,7 +2,7 @@ import gitSyncLocators from "../../../../../locators/gitSyncLocators"; import * as _ from "../../../../../support/Objects/ObjectsCore"; let repoName1, repoName2, repoName3, repoName4, windowOpenSpy; -describe.skip("Repo Limit Exceeded Error Modal", function() { +describe("Repo Limit Exceeded Error Modal", function() { before(() => { cy.generateUUID().then((uid) => { cy.Signup(`${uid}@appsmithtest.com`, uid); @@ -12,23 +12,31 @@ describe.skip("Repo Limit Exceeded Error Modal", function() { repoName2 = uuid.v4().split("-")[0]; repoName3 = uuid.v4().split("-")[0]; repoName4 = uuid.v4().split("-")[0]; + _.agHelper.ClickButton("Build on my own"); }); it("1. Modal should be opened with proper components", function() { + _.homePage.NavigateToHome(); _.homePage.CreateNewApplication(); - _.gitSync.CreateNConnectToGit(repoName1, false, true); + _.gitSync.CreateNConnectToGit(repoName1, true, true); cy.get("@gitRepoName").then((repName) => { repoName1 = repName; }); - _.gitSync.CreateNConnectToGit(repoName2, false, true); + _.homePage.NavigateToHome(); + _.homePage.CreateNewApplication(); + _.gitSync.CreateNConnectToGit(repoName2, true, true); cy.get("@gitRepoName").then((repName) => { repoName2 = repName; }); - _.gitSync.CreateNConnectToGit(repoName3, false, true); + _.homePage.NavigateToHome(); + _.homePage.CreateNewApplication(); + _.gitSync.CreateNConnectToGit(repoName3, true, true); cy.get("@gitRepoName").then((repName) => { repoName3 = repName; }); - _.gitSync.CreateNConnectToGit(repoName4, true, true); + _.homePage.NavigateToHome(); + _.homePage.CreateNewApplication(); + _.gitSync.CreateNConnectToGit(repoName4, false, true); cy.get("@gitRepoName").then((repName) => { repoName4 = repName; }); @@ -77,6 +85,7 @@ describe.skip("Repo Limit Exceeded Error Modal", function() { cy.get(gitSyncLocators.repoLimitExceededErrorModal).should("not.exist"); } }); + after(() => { cy.request({ method: "DELETE", diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Onboarding/CreateNewApp_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Onboarding/CreateNewApp_spec.js index dbf40f9def..431cc305c6 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Onboarding/CreateNewApp_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Onboarding/CreateNewApp_spec.js @@ -17,6 +17,13 @@ describe("Creating new app after discontinuing guided tour should not start the .click() .wait(2000); datasources.CloseReconnectDataSourceModal(); + cy.get("body").then(($ele) => { + if ($ele.find(guidedTourLocators.welcomeTour).length) { + cy.get(guidedTourLocators.welcomeTour) + .click() + .wait(2000); + } + }); cy.get(guidedTourLocators.startBuilding).should("be.visible"); // Go back to applications page cy.get(commonlocators.homeIcon).click({ force: true }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Refactoring/Refactoring_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Refactoring/Refactoring_spec.ts index 3833116a38..b890167db6 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Refactoring/Refactoring_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Refactoring/Refactoring_spec.ts @@ -11,7 +11,7 @@ const jsCode = `//TextWidget, InputWidget, QueryRefactor and RefactorAPI are use return 10;`; const query = "SELECT * FROM paintings ORDER BY id LIMIT {{JSObject1.myFun1()}};"; -const apiURL = "https://mock-api.appsmith.com/users"; +const apiURL = _.agHelper.mockApiUrl; const refactorInput = { api: { oldName: "RefactorAPI", newName: "RefactorAPIRenamed" }, query: { oldName: "QueryRefactor", newName: "QueryRefactorRenamed" }, diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/ForkTemplateToGitConnectedApp.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/ForkTemplateToGitConnectedApp.js index e6f7f4cd07..eb47a51342 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/ForkTemplateToGitConnectedApp.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/ForkTemplateToGitConnectedApp.js @@ -1,15 +1,12 @@ import template from "../../../../locators/TemplatesLocators.json"; -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; import gitSyncLocators from "../../../../locators/gitSyncLocators"; import widgetLocators from "../../../../locators/Widgets.json"; let repoName; let appId; -const branchName = "test/template"; -const mainBranch = "master"; -const jsObject = "Utils"; +let branchName = "test/template"; +const jsObject = "JSObject1"; const homePage = require("../../../../locators/HomePage"); - -let ee = ObjectsRegistry.EntityExplorer; +import * as _ from "../../../../support/Objects/ObjectsCore"; describe("Fork a template to the current app", () => { before(() => { @@ -19,35 +16,40 @@ describe("Fork a template to the current app", () => { cy.CreateAppInFirstListedWorkspace(id); localStorage.setItem("AppName", appId); }); - cy.generateUUID().then((uid) => { - repoName = uid; - - cy.createTestGithubRepo(repoName); - cy.connectToGitRepo(repoName); + _.gitSync.CreateNConnectToGit(repoName); + cy.get("@gitRepoName").then((repName) => { + repoName = repName; }); + _.agHelper.Sleep(2000); }); it("1.Bug #17002 Forking a template into an existing app which is connected to git makes the application go into a bad state ", function() { - cy.wait(5000); cy.get(template.startFromTemplateCard).click(); - cy.wait("@fetchTemplate").should( + cy.wait("@fetchTemplate", { timeout: 30000 }).should( "have.nested.property", "response.body.responseMeta.status", 200, ); cy.wait(1000); 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.wait("@getTemplatePages").should( "have.nested.property", "response.body.responseMeta.status", 200, ); - cy.wait(6000); + cy.xpath( + "//div[text()='Meeting Scheduler']/following-sibling::div//button[contains(@class, 'fork-button')]//span[contains(@class, 't--left-icon')]", + ) + .scrollIntoView() + .click(); + cy.waitUntil(() => cy.xpath("//span[text()='Setting up the template']"), { + errorMsg: "Setting Templates did not finish even after 75 seconds", + timeout: 950000, + interval: 5000, + }).then(($ele) => { + cy.wrap($ele).should("have.length", 0); + }); + cy.wait(10000); cy.get("body").then(($ele) => { if ($ele.find(widgetLocators.toastAction).length <= 0) { if ($ele.find(template.templateViewForkButton).length > 0) { @@ -55,57 +57,63 @@ describe("Fork a template to the current app", () => { } } }); - cy.get(widgetLocators.toastAction).should( - "contain", - "template added successfully", - ); + // cy.get(widgetLocators.toastAction, { timeout: 40000 }).should( + // "contain", + // "template added successfully", + // ); cy.commitAndPush(); }); + it("2. Bug #17262 On forking template to a child branch of git connected app is throwing Page not found error ", function() { - cy.createGitBranch(branchName); - ee.AddNewPage(); - ee.AddNewPage("add-page-from-template"); + _.gitSync.CreateGitBranch(branchName, true); + cy.get("@gitbranchName").then((branName) => { + branchName = branName; + _.ee.AddNewPage(); + _.ee.AddNewPage("add-page-from-template"); + cy.get(template.templateDialogBox).should("be.visible"); + cy.xpath("//div[text()='Slack Bot']").click(); + cy.wait(10000); // for templates page to load fully + // cy.xpath(template.selectAllPages) + // .next() + // .click(); + // cy.wait(1000); + // cy.xpath("//span[text()='SEARCH']") + // .parent() + // .next() + // .click(); + // [Bug]: On forking selected pages from a template, resource not found error is shown #17270 + cy.get(template.templateViewForkButton).click(); + cy.wait(5000); + cy.get(widgetLocators.toastAction, { timeout: 40000 }).should( + "contain", + "template added successfully", + ); + // [Bug]: On forking a template the JS Objects are not cloned #17425 + cy.CheckAndUnfoldEntityItem("Queries/JS"); + cy.get(`.t--entity-name:contains(${jsObject})`).should("have.length", 1); + cy.NavigateToHome(); + cy.get(homePage.searchInput) + .clear() + .type(appId); + cy.wait(2000); + cy.get(homePage.applicationCard) + .first() + .trigger("mouseover"); + cy.get(homePage.appEditIcon) + .first() + .click({ force: true }); + cy.wait(5000); + cy.switchGitBranch(branchName); + cy.get(homePage.publishButton).click({ force: true }); + _.agHelper.AssertElementExist(_.gitSync._bottomBarPull); + cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); + cy.get(gitSyncLocators.commitButton).click(); + cy.wait(10000); + cy.get(gitSyncLocators.closeGitSyncModal).click(); + }); + }); - cy.wait(5000); - cy.get(template.templateDialogBox).should("be.visible"); - cy.xpath("//div[text()='Customer Support Dashboard']").click(); - - cy.xpath(template.selectAllPages) - .next() - .click(); - cy.wait(1000); - cy.xpath("//span[text()='SEARCH']") - .parent() - .next() - .click(); - // [Bug]: On forking selected pages from a template, resource not found error is shown #17270 - cy.get(template.templateViewForkButton).click(); - - cy.wait(3000); - cy.get(widgetLocators.toastAction).should( - "contain", - "template added successfully", - ); - // [Bug]: On forking a template the JS Objects are not cloned #17425 - cy.CheckAndUnfoldEntityItem("Queries/JS"); - cy.get(`.t--entity-name:contains(${jsObject})`).should("have.length", 1); - cy.NavigateToHome(); - cy.get(homePage.searchInput) - .clear() - .type(appId); - cy.wait(2000); - cy.get(homePage.applicationCard) - .first() - .trigger("mouseover"); - cy.get(homePage.appEditIcon) - .first() - .click({ force: true }); - cy.wait(5000); - cy.switchGitBranch(branchName); - cy.get(homePage.publishButton).click(); - cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); - cy.get(gitSyncLocators.commitButton).click(); - cy.wait(10000); - cy.get(gitSyncLocators.closeGitSyncModal).click(); + after(() => { + _.gitSync.DeleteTestGithubRepo(repoName); }); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_Existing_app_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_Existing_app_spec.js index e77ba78b92..bd30c62922 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_Existing_app_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_Existing_app_spec.js @@ -1,6 +1,21 @@ import widgetLocators from "../../../../locators/Widgets.json"; import template from "../../../../locators/TemplatesLocators.json"; const publish = require("../../../../locators/publishWidgetspage.json"); +import * as _ from "../../../../support/Objects/ObjectsCore" + +beforeEach(() => { + // Closes template dialog if it is already open - useful for retry + cy.get("body").then(($ele) => { + if ($ele.find(template.templateDialogBox).length) { + cy.get(template.closeButton).click(); + } + }); + cy.CheckAndUnfoldEntityItem("Pages"); + cy.get(`.t--entity-name:contains(Page1)`) + .trigger("mouseover") + .click({ force: true }); +}); + describe("Fork a template to the current app from new page popover", () => { it("1. Fork template from page section", () => { @@ -21,6 +36,9 @@ describe("Fork a template to the current app from new page popover", () => { 200, ); cy.wait(6000); + _.agHelper.CheckForErrorToast( + "Internal server error while processing request", + ); cy.get("body").then(($ele) => { if ($ele.find(widgetLocators.toastAction).length <= 0) { if ($ele.find(template.templateViewForkButton).length > 0) { diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js index d4b060e75b..e178a43760 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js @@ -1,27 +1,38 @@ import widgetLocators from "../../../../locators/Widgets.json"; import template from "../../../../locators/TemplatesLocators.json"; const publish = require("../../../../locators/publishWidgetspage.json"); -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +import * as _ from "../../../../support/Objects/ObjectsCore"; -let agHelper = ObjectsRegistry.AggregateHelper; +let appId, newWorkspaceName; describe("Fork a template to the current app", () => { afterEach(() => { - agHelper.SaveLocalStorageCache(); + _.agHelper.SaveLocalStorageCache(); }); beforeEach(() => { - agHelper.RestoreLocalStorageCache(); + _.agHelper.RestoreLocalStorageCache(); + // Closes template dialog if it is already open - useful for retry + cy.get("body").then(($ele) => { + if ($ele.find(template.templateDialogBox).length) { + cy.get(template.closeButton).click(); + } + }); + cy.CheckAndUnfoldEntityItem("Pages"); + cy.get(`.t--entity-name:contains(Page1)`) + .trigger("mouseover") + .click({ force: true }); }); it("1. Fork a template to the current app", () => { cy.wait(5000); cy.get(template.startFromTemplateCard).click(); - cy.wait("@fetchTemplate").should( - "have.nested.property", - "response.body.responseMeta.status", - 200, - ); + // Commented out below code as fetch template call is not going through when template dialog is closed + // cy.wait("@fetchTemplate").should( + // "have.nested.property", + // "response.body.responseMeta.status", + // 200, + // ); cy.wait(5000); cy.get(template.templateDialogBox).should("be.visible"); cy.xpath( @@ -29,6 +40,7 @@ describe("Fork a template to the current app", () => { ) .scrollIntoView() .click(); + _.agHelper.CheckForErrorToast("INTERNAL_SERVER_ERROR"); cy.wait("@getTemplatePages").should( "have.nested.property", "response.body.responseMeta.status", @@ -40,22 +52,6 @@ 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( @@ -80,14 +76,16 @@ describe("Fork a template to the current app", () => { .click({ force: true }); cy.wait(1000); cy.get(template.startFromTemplateCard).click(); - cy.wait("@fetchTemplate").should( - "have.nested.property", - "response.body.responseMeta.status", - 200, - ); + // Commented out below code as fetch template call is not going through when template dialog is closed + // cy.wait("@fetchTemplate").should( + // "have.nested.property", + // "response.body.responseMeta.status", + // 200, + // ); cy.wait(5000); cy.get(template.templateDialogBox).should("be.visible"); cy.xpath("//div[text()='Customer Support Dashboard']").click(); + _.agHelper.CheckForErrorToast("INTERNAL_SERVER_ERROR"); cy.wait("@getTemplatePages").should( "have.nested.property", "response.body.responseMeta.status", diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_spec.js index 07d724efec..4f0bf26e3c 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_spec.js @@ -29,6 +29,7 @@ describe("Fork a template to an workspace", () => { cy.get(templateLocators.templateCard) .first() .click(); + AggregateHelper.CheckForErrorToast("INTERNAL_SERVER_ERROR"); cy.get(templateLocators.templateViewForkButton).click(); cy.location().should((location) => { expect(location.search).to.eq("?showForkTemplateModal=true"); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Filepicker/FilePickerV2_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Filepicker/FilePickerV2_spec.js index 1ae73d61a8..73dc9b8292 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Filepicker/FilePickerV2_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Filepicker/FilePickerV2_spec.js @@ -1,6 +1,7 @@ const explorer = require("../../../../../locators/explorerlocators.json"); const commonlocators = require("../../../../../locators/commonlocators.json"); const widgetsPage = require("../../../../../locators/Widgets.json"); +import { agHelper } from "../../../../../support/Objects/ObjectsCore"; import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; let ee = ObjectsRegistry.EntityExplorer, canvasHelper = ObjectsRegistry.CanvasHelper; @@ -38,7 +39,7 @@ describe("File picker widget v2", () => { ".t--property-control-text", `{{FilePicker1.files[0].name}}`, ); - cy.createAndFillApi("https://mock-api.appsmith.com/users", ""); + cy.createAndFillApi(agHelper.mockApiUrl, ""); cy.updateCodeInput( "[class*='t--actionConfiguration']", "{{FilePicker1.files}}", diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Tab/Tab_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Tab/Tab_spec.js index 5500f19779..c82eab11d9 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Tab/Tab_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Tab/Tab_spec.js @@ -31,14 +31,14 @@ describe("Tab widget test", function() { cy.get(Layoutpage.tabButton).click({ force: true }); // eslint-disable-next-line cypress/no-unnecessary-waiting cy.tabVerify(1, "Day"); - cy.get(Layoutpage.tabDelete) - .eq(1) - .click({ force: true }); + cy.xpath(Layoutpage.deleteTab.replace("tabName", "Day")).click({ + force: true, + }); cy.get(Layoutpage.tabWidget) .contains("Day") .should("not.exist"); // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(300); + cy.wait(500); /** * @param{toggleButton Css} Assert to be checked */ @@ -46,7 +46,7 @@ describe("Tab widget test", function() { cy.get(Layoutpage.tabContainer) .scrollIntoView({ easing: "linear" }) .should("be.visible"); - cy.CheckForPageSaveError(); + cy.assertPageSave(); cy.PublishtheApp(); }); it("2. Tab Widget Functionality To Select Tabs", function() { @@ -72,9 +72,9 @@ describe("Tab widget test", function() { }); it("5. Tab Widget Functionality To Check tab invisiblity", function() { cy.openPropertyPane("tabswidget"); - cy.get(Layoutpage.tabEdit) - .eq(1) - .click({ force: true }); + cy.xpath(Layoutpage.tabEdit.replace("tabName", "Tab 1")).click({ + force: true, + }); cy.get(Layoutpage.tabVisibility) .first() .click({ force: true }); @@ -89,9 +89,9 @@ describe("Tab widget test", function() { }); it("6. Tab Widget Functionality To Check tab visibility", function() { cy.openPropertyPane("tabswidget"); - cy.get(Layoutpage.tabEdit) - .eq(1) - .click({ force: true }); + cy.xpath(Layoutpage.tabEdit.replace("tabName", "Tab 1")).click({ + force: true, + }); cy.get(Layoutpage.tabVisibility) .first() .click({ force: true }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/ApiTests/CurlImportFlow_spec.js b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/ApiTests/CurlImportFlow_spec.js index 39332b3fbe..15489a89d2 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/ApiTests/CurlImportFlow_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/ApiTests/CurlImportFlow_spec.js @@ -2,6 +2,7 @@ const apiwidget = require("../../../../locators/apiWidgetslocator.json"); const pages = require("../../../../locators/Pages.json"); const globalSearchLocators = require("../../../../locators/GlobalSearch.json"); import ApiEditor from "../../../../locators/ApiEditor"; +import { agHelper } from "../../../../support/Objects/ObjectsCore"; describe("Test curl import flow", function() { it("Test curl import flow Run and Delete", function() { @@ -11,7 +12,7 @@ describe("Test curl import flow", function() { .should("be.visible") .click({ force: true }); cy.get(ApiEditor.curlImage).click({ force: true }); - cy.get("textarea").type("curl -X GET https://mock-api.appsmith.com/users"); + cy.get("textarea").type("curl -X GET "+agHelper.mockApiUrl); cy.importCurl(); cy.get("@curlImport").then((response) => { cy.expect(response.response.body.responseMeta.success).to.eq(true); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/JsFunctionExecution/SetTimeout_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/JsFunctionExecution/SetTimeout_spec.ts index e69122ce26..91fad26e8d 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/JsFunctionExecution/SetTimeout_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/JsFunctionExecution/SetTimeout_spec.ts @@ -146,7 +146,7 @@ describe("Tests setTimeout API", function() { }); it("6. Access to args passed into success/error callback functions in API.run when using setTimeout", () => { - apiPage.CreateAndFillApi("https://mock-api.appsmith.com/users");//https://mock-api.appsmith.com/users?page=2&pageSize=10 + apiPage.CreateAndFillApi(agHelper.mockApiUrl); jsEditor.CreateJSObject( `export default { myVar1: [], @@ -154,7 +154,7 @@ describe("Tests setTimeout API", function() { myFun1: (x) => { Api1.run((res) => { setTimeout(() => { - showAlert(res.users[0].name); + showAlert(res[0].name); }, 3000); }, (error) => { console.log(error); @@ -163,7 +163,7 @@ describe("Tests setTimeout API", function() { myFun2: (x) => { Api1.run().then((res) => { setTimeout(() => { - showAlert(res.users[0].name); + showAlert(res[0].name); }, 3000); }); } @@ -182,7 +182,7 @@ describe("Tests setTimeout API", function() { agHelper.Sleep(3000); cy.wait("@postExecute").then((interception : any) => { //Js function to match any name returned from API - userName = JSON.stringify(interception.response.body.data.body.users[0].name).replace(/['"]+/g, '');//removing double quotes + userName = JSON.stringify(interception.response.body.data.body[0].name).replace(/['"]+/g, '');//removing double quotes agHelper.AssertContains(userName); }); @@ -191,20 +191,20 @@ describe("Tests setTimeout API", function() { jsEditor.RunJSObj(); agHelper.Sleep(3000); cy.wait("@postExecute").then((interception : any) => { - userName = JSON.stringify(interception.response.body.data.body.users[0].name).replace(/['"]+/g, ''); + userName = JSON.stringify(interception.response.body.data.body[0].name).replace(/['"]+/g, ''); agHelper.AssertContains(userName); }); }); it("7. Verifies whether setTimeout executes on page load", () => { - //apiPage.CreateAndFillApi("https://mock-api.appsmith.com/users"); + //apiPage.CreateAndFillApi(agHelper.mockApiUrl); jsEditor.CreateJSObject( `export default { myVar1: [], myVar2: {}, myFun1: (x) => { setTimeout(() => { - Api1.run().then(() => showAlert("Success!")); + showAlert("Success!"); Timeouts.myFun2(); }, 3000) }, @@ -219,11 +219,11 @@ describe("Tests setTimeout API", function() { ); jsEditor.EnableDisableAsyncFuncSettings("myFun1", true, false); deployMode.DeployApp(); - agHelper.Sleep(3000); + agHelper.Sleep(1000);//DeployApp already waiting 2000ms hence reducing it here to equate to 3000 timeout agHelper.AssertContains("Success!"); - agHelper.Sleep(3000); + agHelper.Sleep(1000); cy.wait("@postExecute").then((interception : any) => { - userName = JSON.stringify(interception.response.body.data.body.users[0].name).replace(/['"]+/g, ''); + userName = JSON.stringify(interception.response.body.data.body[0].name).replace(/['"]+/g, ''); agHelper.AssertContains(userName); }); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/APIOnLoad_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/APIOnLoad_Spec.ts index 2c396cb5b1..e030acbf0d 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/APIOnLoad_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/APIOnLoad_Spec.ts @@ -18,6 +18,7 @@ describe("JSObjects OnLoad Actions tests", function() { it("1. Api mapping on page load", function() { apiPage.CreateAndFillApi(dataSet.baseUrl + dataSet.methods, "PageLoadApi"); + agHelper.PressEscape(); ee.ExpandCollapseEntity("Container3"); ee.SelectEntityByName("Table1"); propPane.UpdatePropertyFieldValue( diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts index eb4c1bce6b..eddefc9380 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts @@ -36,8 +36,6 @@ describe("Layout OnLoad Actions tests", function() { }); }); - //Skipping others tests due to RTS server changes - it("2. Bug 8595: OnPageLoad execution - when Query Parmas added via Params tab", function() { cy.fixture("onPageLoadActionsDsl").then((val: any) => { agHelper.AddDsl(val, locator._imageWidget); diff --git a/app/client/cypress/locators/Layout.json b/app/client/cypress/locators/Layout.json index c6c5c65415..ac5cf782e4 100644 --- a/app/client/cypress/locators/Layout.json +++ b/app/client/cypress/locators/Layout.json @@ -6,7 +6,8 @@ "tabButton": ".t--property-control-tabs button", "tabDelete": ".t--property-control-tabs .t--delete-column-btn", "tabContainer": "div[type='TABS_WIDGET']", - "tabEdit": ".t--property-control-tabs .t--edit-column-btn", + "tabEdit": "//input[@value ='tabName']//parent::div//parent::div//following-sibling::div//div[contains(@class,'t--edit-column-btn')]", "tabVisibility": ".t--property-control-visible .bp3-control-indicator", - "tabNumber": ".t--number-of-tabs" + "tabNumber": ".t--number-of-tabs", + "deleteTab":"//input[@value ='tabName']//parent::div//parent::div//following-sibling::div//div[contains(@class,'t--delete-column-btn')]" } diff --git a/app/client/cypress/locators/PgAdminlocators.json b/app/client/cypress/locators/PgAdminlocators.json index 3231ec9ed3..cc4dab1156 100644 --- a/app/client/cypress/locators/PgAdminlocators.json +++ b/app/client/cypress/locators/PgAdminlocators.json @@ -2,13 +2,13 @@ "dropdownChevronLeft":".bp3-icon-chevron-left", "addNewtable":"//span[text()='New Table']", "addTablename":"(//div[@class='bp3-input-group']//input)[2]", - "addColumn":"//span[text()='Add Column']", + "addColumn":"//span[text()='Add Column']/parent::button/parent::div", "textField":"//span[text()='Text']", "selectDatatype":"//div[text()='Varchar']", "submitButton":"//span[text()='Submit']", "closeButton":"//span[text()='Close']", "viewButton":"//span[text()='View']", - "dropdownChevronDown":".t--draggable-selectwidget", + "dropdownChevronDown":".t--draggable-dropdownwidget", "selectInformationSchema":"//div[text()='information_schema']", "deleteButton":"//span[text()='Delete']", "confirmButton":"//span[text()='Confirm']", diff --git a/app/client/cypress/locators/TemplatesLocators.json b/app/client/cypress/locators/TemplatesLocators.json index fa8eb68e2b..6ff809e7e8 100644 --- a/app/client/cypress/locators/TemplatesLocators.json +++ b/app/client/cypress/locators/TemplatesLocators.json @@ -6,6 +6,7 @@ "templateViewForkButton": "[data-cy='template-fork-button']", "startFromTemplateCard": "[data-cy=start-from-template]", "templateDialogBox": "[data-testid='t--dialog-component']", - "selectAllPages": "//span[text()='Select all']" + "selectAllPages": "//span[text()='Select all']", + "closeButton":"[name='close-x']" } \ No newline at end of file diff --git a/app/client/cypress/support/Pages/AggregateHelper.ts b/app/client/cypress/support/Pages/AggregateHelper.ts index 9ce3c0c898..c44f79b7ad 100644 --- a/app/client/cypress/support/Pages/AggregateHelper.ts +++ b/app/client/cypress/support/Pages/AggregateHelper.ts @@ -18,7 +18,7 @@ const DEFAULT_ENTERVALUE_OPTIONS = { }; export class AggregateHelper { private locator = ObjectsRegistry.CommonLocators; - + public mockApiUrl = "http://host.docker.internal:5001/v1/mock-api?records=10" public isMac = Cypress.platform === "darwin"; private selectLine = `${ this.isMac ? "{cmd}{shift}{leftArrow}" : "{shift}{home}" @@ -504,6 +504,11 @@ export class AggregateHelper { }); } + public VerifyCallCount(alias: string, expectedNumberOfCalls: number) { + cy.wait(alias); + cy.get(`${alias}.all`).should("have.length", expectedNumberOfCalls); + } + public GetNClick( selector: string, index = 0, diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index 7b79bd91e0..2af6835e99 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -41,7 +41,7 @@ export class DataSources { _templateMenu = ".t--template-menu"; _templateMenuOption = (action: string) => "//div[contains(@class, 't--template-menu')]//div[text()='" + action + "']"; - private _createQuery = ".t--create-query"; + _createQuery = ".t--create-query"; _visibleTextSpan = (spanText: string) => "//span[contains(text(),'" + spanText + "')]"; _dropdownTitle = (ddTitle: string) => @@ -621,12 +621,13 @@ export class DataSources { this.agHelper.AssertAutoSave(); } - public EnterQuery(query: string) { + public EnterQuery(query: string, sleep= 500) { cy.get(this.locator._codeEditorTarget).then(($field: any) => { this.agHelper.UpdateCodeInput($field, query); }); this.agHelper.AssertAutoSave(); - this.agHelper.Sleep(500); //waiting a bit before proceeding! + this.agHelper.Sleep(sleep); //waiting a bit before proceeding! + cy.wait("@saveAction"); } public RunQueryNVerifyResponseViews( @@ -778,13 +779,13 @@ export class DataSources { } //Update with new password in the datasource conf page - public updatePassword(newPassword: string) { + public UpdatePassword(newPassword: string) { this.ExpandSectionByName(this._sectionAuthentication); cy.get(this._password).type(newPassword); } //Fetch schema from server and validate UI for the updates - public verifySchema( + public VerifySchema( dataSourceName: string, schema: string, isUpdate = false, diff --git a/app/client/cypress/support/Pages/DeployModeHelper.ts b/app/client/cypress/support/Pages/DeployModeHelper.ts index 3bedc9ce84..bdc66abaa1 100644 --- a/app/client/cypress/support/Pages/DeployModeHelper.ts +++ b/app/client/cypress/support/Pages/DeployModeHelper.ts @@ -68,6 +68,7 @@ export class DeployMode { cy.get(this.locator._backToEditor).click(); this.agHelper.Sleep(2000); localStorage.setItem("inDeployedMode", "false"); + this.agHelper.AssertElementVisible(this.locator._dropHere);//Assert if canvas is visible after Navigating back! } public EnterJSONInputValue(fieldName: string, value: string, index = 0) { diff --git a/app/client/cypress/support/Pages/GitSync.ts b/app/client/cypress/support/Pages/GitSync.ts index 2937e6afcd..058f6fd675 100644 --- a/app/client/cypress/support/Pages/GitSync.ts +++ b/app/client/cypress/support/Pages/GitSync.ts @@ -17,6 +17,11 @@ export class GitSync { private _gitConfigEmailInput = ".t--git-config-email-input"; _branchButton = "[data-testid=t--branch-button-container]"; private _branchSearchInput = ".t--branch-search-input"; + private _bottomBarCommit = ".t--bottom-bar-commit span[name='plus']"; + _bottomBarPull = ".t--bottom-bar-pull span[name='down-arrow-2']"; + private _branchName = (branch: string) => + "//div[contains(@class, 't--branch-button')]//*[text()='" + branch + "']"; + _checkMergeability = "//span[contains(text(), 'Checking mergeability')]"; OpenGitSyncModal() { this.agHelper.GetNClick(this._connectGitBottomBar); @@ -28,11 +33,15 @@ export class GitSync { this.agHelper.AssertElementAbsence(this._gitSyncModal); } - CreateNConnectToGit(repoName: string = "Test", assertConnect = true, privateFlag = false) { + CreateNConnectToGit( + repoName: string = "Test", + assertConnect = true, + privateFlag = false, + ) { this.agHelper.GenerateUUID(); cy.get("@guid").then((uid) => { repoName += uid; - this.CreateTestGiteaRepo(repoName); + this.CreateTestGiteaRepo(repoName, privateFlag); //this.CreateLocalGithubRepo(repoName); this.AuthorizeKeyToGitea(repoName, assertConnect); // cy.get("@remoteUrl").then((remoteUrl: any) => { @@ -92,8 +101,9 @@ export class GitSync { this.agHelper.ClickButton("CONNECT"); if (assertConnect) { this.agHelper.ValidateNetworkStatus("@connectGitLocalRepo"); + this.agHelper.AssertElementExist(this._bottomBarCommit); + this.CloseGitSyncModal(); } - this.CloseGitSyncModal(); }); } @@ -215,6 +225,7 @@ export class GitSync { CreateGitBranch(branch: string = "Test", toUseNewGuid = false) { if (toUseNewGuid) this.agHelper.GenerateUUID(); + this.agHelper.AssertElementExist(this._bottomBarCommit); this.agHelper.GetNClick(this._branchButton); this.agHelper.Sleep(2000); //branch pop up to open cy.get("@guid").then((uid) => { @@ -225,9 +236,10 @@ export class GitSync { 0, true, ); + this.agHelper.AssertElementExist(this.locator._runBtnSpinner); + this.agHelper.AssertElementAbsence(this.locator._runBtnSpinner, 70000); //Since page taking more time to laod in some cases + this.agHelper.AssertElementVisible(this._branchName(branch + uid)); cy.wrap(branch + uid).as("gitbranchName"); }); - this.agHelper.AssertElementExist(this.locator._spinner); - this.agHelper.AssertElementAbsence(this.locator._spinner, 30000); } } diff --git a/app/client/cypress/support/Pages/JSEditor.ts b/app/client/cypress/support/Pages/JSEditor.ts index 5e1d85a7be..1db4de4fb3 100644 --- a/app/client/cypress/support/Pages/JSEditor.ts +++ b/app/client/cypress/support/Pages/JSEditor.ts @@ -81,10 +81,7 @@ export class JSEditor { "')]//*[contains(text(),'" + jsFuncName + "')]"; - _dialogInDeployView = - "//div[@class='bp3-dialog-body']//*[contains(text(), '" + - Cypress.env("MESSAGES").QUERY_CONFIRMATION_MODAL_MESSAGE() + - "')]"; + _dialogInDeployView = "//div[@class='bp3-dialog-body']//*[contains(text(), '" + Cypress.env("MESSAGES").QUERY_CONFIRMATION_MODAL_MESSAGE() +"')]"; _funcDropdown = ".t--formActionButtons div[role='listbox']"; _funcDropdownOptions = ".ads-dropdown-options-wrapper div > span div"; _getJSFunctionSettingsId = (JSFunctionName: string) => diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index f8cb1e2d34..136cf8933c 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -1181,7 +1181,7 @@ Cypress.Commands.add("CheckForPageSaveError", () => { Cypress.Commands.add("assertPageSave", () => { cy.CheckForPageSaveError(); cy.get(commonlocators.saveStatusContainer).should("not.exist", { - timeout: 40000, + timeout: 30000, }); }); diff --git a/app/client/cypress/support/gitSync.js b/app/client/cypress/support/gitSync.js index 3b8f51bcd7..1d6152cc8e 100644 --- a/app/client/cypress/support/gitSync.js +++ b/app/client/cypress/support/gitSync.js @@ -5,6 +5,10 @@ require("cy-verify-downloads").addCustomCommand(); require("cypress-file-upload"); import gitSyncLocators from "../locators/gitSyncLocators"; import homePage from "../locators/HomePage"; +import { ObjectsRegistry } from "../support/Objects/Registry"; + +let gitSync = ObjectsRegistry.GitSync, + agHelper = ObjectsRegistry.AggregateHelper; const commonLocators = require("../locators/commonlocators.json"); const GITHUB_API_BASE = "https://api.github.com"; @@ -157,6 +161,7 @@ Cypress.Commands.add("createGitBranch", (branch) => { }); Cypress.Commands.add("switchGitBranch", (branch, expectError) => { + agHelper.AssertElementExist(gitSync._bottomBarPull); cy.get(gitSyncLocators.branchButton).click({ force: true }); cy.get(gitSyncLocators.branchSearchInput).type(`{selectall}${branch}`); cy.wait(1000); @@ -233,18 +238,20 @@ Cypress.Commands.add( Cypress.Commands.add("commitAndPush", (assertFailure) => { cy.get(homePage.publishButton).click(); + agHelper.AssertElementExist(gitSync._bottomBarPull); cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); cy.get(gitSyncLocators.commitButton).click(); if (!assertFailure) { // check for commit success - cy.wait("@commit").should( + //adding timeout since commit is taking longer sometimes + cy.wait("@commit", { timeout: 35000 }).should( "have.nested.property", "response.body.responseMeta.status", 201, ); cy.wait(3000); } else { - cy.wait("@commit").then((interception) => { + cy.wait("@commit", { timeout: 35000 }).then((interception) => { const status = interception.response.body.responseMeta.status; expect(status).to.be.gte(400); }); @@ -285,6 +292,7 @@ Cypress.Commands.add( ); Cypress.Commands.add("merge", (destinationBranch) => { + agHelper.AssertElementExist(gitSync._bottomBarPull); cy.get(gitSyncLocators.bottomBarMergeButton).click(); cy.wait(6000); // wait for git status call to finish /*cy.wait("@gitStatus").should( @@ -292,11 +300,19 @@ Cypress.Commands.add("merge", (destinationBranch) => { "response.body.responseMeta.status", 200, ); */ + + agHelper.AssertElementEnabledDisabled( + gitSyncLocators.mergeBranchDropdownDestination, + 0, + false, + ); + cy.wait(3000); cy.get(gitSyncLocators.mergeBranchDropdownDestination).click(); cy.get(commonLocators.dropdownmenu) .contains(destinationBranch) .click(); - cy.wait("@mergeStatus").should( + agHelper.AssertElementAbsence(gitSync._checkMergeability, 30000); + cy.wait("@mergeStatus", { timeout: 35000 }).should( "have.nested.property", "response.body.data.isMergeAble", true, @@ -304,11 +320,11 @@ Cypress.Commands.add("merge", (destinationBranch) => { cy.wait(2000); cy.contains(Cypress.env("MESSAGES").NO_MERGE_CONFLICT()); cy.get(gitSyncLocators.mergeCTA).click(); - cy.wait("@mergeBranch").should( + cy.wait("@mergeBranch", { timeout: 35000 }).should( "have.nested.property", "response.body.responseMeta.status", 200, - ); + ); //adding timeout since merge is taking longer sometimes cy.contains(Cypress.env("MESSAGES").MERGED_SUCCESSFULLY()); }); diff --git a/app/client/cypress_ci.json b/app/client/cypress_ci.json index 30ab12b5a5..9ad65f1668 100644 --- a/app/client/cypress_ci.json +++ b/app/client/cypress_ci.json @@ -13,9 +13,6 @@ "html": true, "json": false }, - "ignoreTestFiles": [ - "**/Regression_TestSuite/Application/PgAdmin_spec*.js" - ], "chromeWebSecurity": false, "viewportHeight": 1100, "viewportWidth": 1400,