diff --git a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js index 835e5b42e6..5bb6666552 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js @@ -33,6 +33,6 @@ describe("Button Widget Functionality", function() { afterEach(() => { //clean up - cy.DeleteModal(); + // cy.DeleteModal(); }); }); diff --git a/app/client/cypress/locators/HomePage.json b/app/client/cypress/locators/HomePage.json index 636a48d0f7..850bfb5973 100644 --- a/app/client/cypress/locators/HomePage.json +++ b/app/client/cypress/locators/HomePage.json @@ -1,8 +1,11 @@ { + "CreateApp":"span[class='bp3-button-text']", "searchInput": "input[type='text']", "appEditIcon": ".t--application-edit-link", "publishButton":".t--application-publish-btn", "publishCrossButton":"span[icon='small-cross']", - "homePageID":"//div[@id='root']" + "homePageID":"//div[@id='root']", + "appMoreIcon":".bp3-popover-wrapper.more .bp3-popover-target", + "deleteButton":".bp3-menu-item.bp3-popover-dismiss" } \ No newline at end of file diff --git a/app/client/cypress/locators/commonlocators.json b/app/client/cypress/locators/commonlocators.json index 204cd880d2..07f2047337 100644 --- a/app/client/cypress/locators/commonlocators.json +++ b/app/client/cypress/locators/commonlocators.json @@ -2,7 +2,6 @@ "editIcon":".t--widget-propertypane-toggle", "editPropCrossButton":".t--property-pane-close-btn", "deleteWidgetIcon":".t--widget-delete-control", - "dropdownSelectButton":".t--open-dropdown-Select-Action" - - + "dropdownSelectButton":".t--open-dropdown-Select-Action", + "homeIcon":".bp3-icon.bp3-icon-home" } \ No newline at end of file diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 917d3da225..959859d48c 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -5,6 +5,29 @@ const commonlocators = require("../locators/commonlocators.json"); const modalWidgetPage = require("../locators/ModalWidget.json"); const widgetsPage = require("../locators/Widgets.json"); +Cypress.Commands.add("CreateApp", appname => { + cy.get(homePage.CreateApp) + .contains("Create Application") + .click({ force: true }); + cy.get("form input").type(appname); + cy.get(homePage.CreateApp) + .contains("Submit") + .click({ force: true }); + // cy.wait(2000); + cy.get("#loading").should("not.exist"); +}); + +Cypress.Commands.add("DeleteApp", appName => { + cy.get(commonlocators.homeIcon).click({ force: true }); + cy.get(homePage.searchInput).type(appName); + //cy.wait(2000); + cy.get("#loading").should("not.exist"); + cy.get(homePage.appMoreIcon) + .first() + .click({ force: true }); + cy.get(homePage.deleteButton).click({ force: true }); +}); + Cypress.Commands.add("LogintoApp", (uname, pword) => { cy.visit("/user/login"); cy.get(loginPage.username).should("be.visible"); @@ -84,7 +107,7 @@ Cypress.Commands.add("CreateModal", () => { .find(".bp3-button > .bp3-button-text") .should("have.text", "Alert Modal"); cy.get(commonlocators.editPropCrossButton).click(); - cy.PublishtheApp(); + cy.reload(); }); Cypress.Commands.add("PublishtheApp", () => { diff --git a/app/client/cypress/support/index.js b/app/client/cypress/support/index.js index 2a1dee9ec9..27b7e4556f 100644 --- a/app/client/cypress/support/index.js +++ b/app/client/cypress/support/index.js @@ -16,6 +16,7 @@ require("cypress-xpath"); const loginData = require("../fixtures/user.json"); const inputData = require("../fixtures/inputdata.json"); let pageid; +let appId; // Import commands.js using ES2015 syntax: import "./commands"; @@ -37,8 +38,10 @@ before(function() { cy.route("PUT", "/api/v1/layouts/*/pages/*").as("updateLayout"); cy.LogintoApp(loginData.username, loginData.password); - cy.SearchApp(inputData.appname); - + cy.generateUUID().then(id => { + appId = id; + cy.CreateApp(id); + }); cy.generateUUID().then(uid => { pageid = uid; cy.Createpage(pageid); @@ -50,7 +53,11 @@ before(function() { }); after(function() { - cy.Deletepage(pageid); - // cy.PublishtheApp(); + + // ---commenting Publish app and Delete page as of now--- // + //cy.Deletepage(pageid); + //cy.PublishtheApp(); + cy.DeleteApp(appId); + }); });