2020-03-27 09:02:11 +00:00
|
|
|
const loginPage = require("../locators/LoginPage.json");
|
|
|
|
|
const homePage = require("../locators/HomePage.json");
|
2020-04-02 04:47:48 +00:00
|
|
|
const pages = require("../locators/Pages.json");
|
2020-03-10 09:38:12 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
Cypress.Commands.add("LogintoApp", (uname, pword) => {
|
|
|
|
|
cy.visit("/");
|
|
|
|
|
cy.get(loginPage.username).should("be.visible");
|
|
|
|
|
cy.get(loginPage.username).type(uname);
|
|
|
|
|
cy.get(loginPage.password).type(pword);
|
|
|
|
|
cy.get(loginPage.submitBtn).click();
|
|
|
|
|
});
|
2020-04-02 04:47:48 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
Cypress.Commands.add("SearchApp", appname => {
|
|
|
|
|
cy.get(homePage.searchInput).type(appname);
|
2020-04-02 04:47:48 +00:00
|
|
|
cy.get(homePage.appEditIcon).should("be.visible");
|
|
|
|
|
cy.wait(2000);
|
2020-03-27 09:02:11 +00:00
|
|
|
cy.get(homePage.appEditIcon)
|
|
|
|
|
.first()
|
|
|
|
|
.click();
|
|
|
|
|
cy.get("#loading").should("not.exist");
|
|
|
|
|
});
|
2020-03-20 14:21:24 +00:00
|
|
|
|
2020-04-02 04:47:48 +00:00
|
|
|
Cypress.Commands.add("NavigateToCommonWidgets", () => {
|
|
|
|
|
cy.get(pages.pagesIcon).click({ force: true });
|
|
|
|
|
cy.xpath(pages.commonWidgets).click();
|
|
|
|
|
cy.get("#loading").should("not.exist");
|
|
|
|
|
cy.get(pages.widgetsEditor).click();
|
|
|
|
|
cy.get("#loading").should("not.exist");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("NavigateToFormWidgets", () => {
|
|
|
|
|
cy.get(pages.pagesIcon).click({ force: true });
|
|
|
|
|
cy.xpath(pages.formWidgets).click({ force: true });
|
|
|
|
|
cy.get("#loading").should("not.exist");
|
|
|
|
|
cy.get(pages.widgetsEditor).click();
|
|
|
|
|
cy.get("#loading").should("not.exist");
|
|
|
|
|
});
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
Cypress.Commands.add("PublishtheApp", () => {
|
2020-04-03 09:29:52 +00:00
|
|
|
cy.xpath(homePage.homePageID).contains("All changes saved");
|
2020-03-27 09:02:11 +00:00
|
|
|
cy.get(homePage.publishButton).click();
|
|
|
|
|
cy.window().then(win => {
|
|
|
|
|
cy.get(homePage.publishCrossButton).click();
|
|
|
|
|
});
|
|
|
|
|
});
|