App creation and Deletion is added

This commit is contained in:
rashminagarajp 2020-05-05 14:38:31 +05:30
parent 2cc7fc6e11
commit 2376aa304b
4 changed files with 36 additions and 8 deletions

View File

@ -1,8 +1,11 @@
{ {
"CreateApp":"span[class='bp3-button-text']",
"searchInput": "input[type='text']", "searchInput": "input[type='text']",
"appEditIcon": ".t--application-edit-link", "appEditIcon": ".t--application-edit-link",
"publishButton":".t--application-publish-btn", "publishButton":".t--application-publish-btn",
"publishCrossButton":"span[icon='small-cross']", "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"
} }

View File

@ -2,7 +2,6 @@
"editIcon":".t--widget-propertypane-toggle", "editIcon":".t--widget-propertypane-toggle",
"editPropCrossButton":".t--property-pane-close-btn", "editPropCrossButton":".t--property-pane-close-btn",
"deleteWidgetIcon":".t--widget-delete-control", "deleteWidgetIcon":".t--widget-delete-control",
"dropdownSelectButton":".t--open-dropdown-Select-Action" "dropdownSelectButton":".t--open-dropdown-Select-Action",
"homeIcon":".bp3-icon.bp3-icon-home"
} }

View File

@ -5,6 +5,27 @@ const commonlocators = require("../locators/commonlocators.json");
const modalWidgetPage = require("../locators/ModalWidget.json"); const modalWidgetPage = require("../locators/ModalWidget.json");
const widgetsPage = require("../locators/Widgets.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.SearchApp(appName);
cy.get(homePage.appMoreIcon)
.first()
.click({ force: true });
cy.get(homePage.deleteButton).click({ force: true });
});
Cypress.Commands.add("LogintoApp", (uname, pword) => { Cypress.Commands.add("LogintoApp", (uname, pword) => {
cy.visit("/"); cy.visit("/");
cy.get(loginPage.username).should("be.visible"); cy.get(loginPage.username).should("be.visible");

View File

@ -16,6 +16,7 @@ require("cypress-xpath");
const loginData = require("../fixtures/user.json"); const loginData = require("../fixtures/user.json");
const inputData = require("../fixtures/inputdata.json"); const inputData = require("../fixtures/inputdata.json");
let pageid; let pageid;
let appId;
// Import commands.js using ES2015 syntax: // Import commands.js using ES2015 syntax:
import "./commands"; import "./commands";
@ -37,8 +38,10 @@ before(function() {
cy.route("PUT", "/api/v1/layouts/*/pages/*").as("updateLayout"); cy.route("PUT", "/api/v1/layouts/*/pages/*").as("updateLayout");
cy.LogintoApp(loginData.username, loginData.password); cy.LogintoApp(loginData.username, loginData.password);
cy.SearchApp(inputData.appname); cy.generateUUID().then(id => {
appId = id;
cy.CreateApp(id);
});
cy.generateUUID().then(uid => { cy.generateUUID().then(uid => {
pageid = uid; pageid = uid;
cy.Createpage(pageid); cy.Createpage(pageid);
@ -50,7 +53,9 @@ before(function() {
}); });
after(function() { after(function() {
cy.Deletepage(pageid); // ---commenting Publish app and Delete page as of now--- //
cy.PublishtheApp(); //cy.Deletepage(pageid);
//cy.PublishtheApp();
cy.DeleteApp(appId);
}); });
}); });