2020-06-19 14:32:56 +00:00
|
|
|
/// <reference types="Cypress" />
|
|
|
|
|
|
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-05-08 05:40:14 +00:00
|
|
|
const datasourceEditor = require("../locators/DatasourcesEditor.json");
|
2020-05-11 09:03:46 +00:00
|
|
|
const datasourceFormData = require("../fixtures/datasources.json");
|
2020-04-08 13:38:19 +00:00
|
|
|
const commonlocators = require("../locators/commonlocators.json");
|
2020-05-11 09:03:46 +00:00
|
|
|
const queryEditor = require("../locators/QueryEditor.json");
|
2020-04-08 13:38:19 +00:00
|
|
|
const modalWidgetPage = require("../locators/ModalWidget.json");
|
2020-05-01 07:48:33 +00:00
|
|
|
const widgetsPage = require("../locators/Widgets.json");
|
2020-05-16 07:28:13 +00:00
|
|
|
const LayoutPage = require("../locators/Layout.json");
|
2020-05-08 09:01:11 +00:00
|
|
|
const formWidgetsPage = require("../locators/FormWidgets.json");
|
2020-05-07 08:07:50 +00:00
|
|
|
const ApiEditor = require("../locators/ApiEditor.json");
|
2020-05-12 13:47:13 +00:00
|
|
|
const apiwidget = require("../locators/apiWidgetslocator.json");
|
2020-06-04 13:49:22 +00:00
|
|
|
const dynamicInputLocators = require("../locators/DynamicInput.json");
|
2020-07-16 05:50:46 +00:00
|
|
|
|
2020-05-27 11:21:11 +00:00
|
|
|
let pageidcopy = " ";
|
2020-03-10 09:38:12 +00:00
|
|
|
|
2020-07-20 09:38:35 +00:00
|
|
|
Cypress.Commands.add("createOrg", orgName => {
|
|
|
|
|
cy.get(homePage.createOrg)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.xpath(homePage.inputOrgName)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.type(orgName);
|
|
|
|
|
cy.xpath(homePage.submitBtn).click();
|
|
|
|
|
cy.wait("@applications").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("navigateToOrgSettings", orgName => {
|
|
|
|
|
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
|
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible");
|
|
|
|
|
cy.get(homePage.orgSectionBtn)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.xpath(homePage.OrgSettings).click({ force: true });
|
|
|
|
|
cy.wait("@getRoles").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
cy.xpath(homePage.inviteUser).should("be.visible");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("inviteUserForOrg", (orgName, email, role) => {
|
|
|
|
|
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
|
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible");
|
|
|
|
|
cy.get(homePage.orgList.concat(orgName).concat(homePage.shareOrg))
|
|
|
|
|
.first()
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click();
|
|
|
|
|
cy.xpath(homePage.email)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.type(email);
|
|
|
|
|
cy.xpath(homePage.selectRole).click({ force: true });
|
|
|
|
|
cy.xpath(role).click({ force: true });
|
|
|
|
|
cy.xpath(homePage.inviteBtn).click({ force: true });
|
|
|
|
|
cy.wait("@postInvite").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
cy.contains(email);
|
|
|
|
|
cy.get(homePage.manageUsers).click({ force: true });
|
|
|
|
|
cy.xpath(homePage.appHome)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("deleteUserFromOrg", (orgName, email) => {
|
|
|
|
|
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
|
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible");
|
|
|
|
|
cy.get(homePage.orgSection.concat(orgName).concat(")"))
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.xpath(homePage.OrgSettings).click({ force: true });
|
|
|
|
|
cy.wait("@getRoles").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
cy.xpath(homePage.DeleteBtn).click({ force: true });
|
|
|
|
|
cy.xpath(homePage.appHome)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click();
|
|
|
|
|
cy.wait("@applications").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("updateUserRoleForOrg", (orgName, email, role) => {
|
|
|
|
|
cy.get(homePage.orgList.concat(orgName).concat(")"))
|
|
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible");
|
|
|
|
|
cy.get(homePage.orgSection.concat(orgName).concat(")"))
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.xpath(homePage.OrgSettings).click({ force: true });
|
|
|
|
|
cy.wait("@getRoles").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
cy.xpath(homePage.inviteUser).click({ force: true });
|
|
|
|
|
cy.xpath(homePage.email)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.type(email);
|
|
|
|
|
cy.xpath(homePage.selectRole).click({ force: true });
|
|
|
|
|
cy.xpath(role).click({ force: true });
|
|
|
|
|
cy.xpath(homePage.inviteBtn).click({ force: true });
|
|
|
|
|
cy.wait("@postInvite").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
cy.contains(email);
|
|
|
|
|
cy.get(homePage.manageUsers).click({ force: true });
|
|
|
|
|
cy.xpath(homePage.appHome)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click();
|
|
|
|
|
cy.wait("@applications").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("launchApp", appName => {
|
|
|
|
|
cy.get(homePage.appView)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.first()
|
|
|
|
|
.click();
|
|
|
|
|
cy.get("#loading").should("not.exist");
|
|
|
|
|
cy.wait("@getPagesForApp").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("CreateAppForOrg", (orgName, appname) => {
|
|
|
|
|
cy.get(homePage.orgList.concat(orgName).concat(homePage.createAppFrOrg))
|
|
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click();
|
|
|
|
|
cy.get(homePage.inputAppName).type(appname);
|
|
|
|
|
cy.get(homePage.CreateApp)
|
|
|
|
|
.contains("Submit")
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get("#loading").should("not.exist");
|
|
|
|
|
cy.wait("@getPropertyPane");
|
|
|
|
|
cy.get("@getPropertyPane").should("have.property", "status", 200);
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-05 09:08:31 +00:00
|
|
|
Cypress.Commands.add("CreateApp", appname => {
|
2020-06-17 10:47:01 +00:00
|
|
|
cy.get(homePage.createNew)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(homePage.inputAppName).type(appname);
|
2020-05-05 09:08:31 +00:00
|
|
|
cy.get(homePage.CreateApp)
|
|
|
|
|
.contains("Submit")
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get("#loading").should("not.exist");
|
2020-05-12 13:47:13 +00:00
|
|
|
cy.wait("@getPropertyPane");
|
|
|
|
|
cy.get("@getPropertyPane").should("have.property", "status", 200);
|
2020-05-05 09:08:31 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-20 11:04:39 +00:00
|
|
|
Cypress.Commands.add("DeleteApp", appName => {
|
|
|
|
|
cy.get(commonlocators.homeIcon).click({ force: true });
|
|
|
|
|
cy.wait("@applications").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
2020-06-10 12:16:50 +00:00
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
cy.wait("@organizations").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
2020-05-20 11:04:39 +00:00
|
|
|
200,
|
|
|
|
|
);
|
2020-05-21 09:45:48 +00:00
|
|
|
cy.get('button span[icon="chevron-down"]').should("be.visible");
|
|
|
|
|
cy.get(homePage.searchInput).type(appName, { force: true });
|
|
|
|
|
cy.get(homePage.appMoreIcon)
|
|
|
|
|
.should("have.length", 1)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(homePage.deleteButton)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click({ force: true });
|
2020-05-20 11:04:39 +00:00
|
|
|
});
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
Cypress.Commands.add("LogintoApp", (uname, pword) => {
|
2020-05-05 12:16:51 +00:00
|
|
|
cy.visit("/user/login");
|
2020-03-27 09:02:11 +00:00
|
|
|
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-17 08:17:25 +00:00
|
|
|
cy.wait("@applications").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
2020-03-27 09:02:11 +00:00
|
|
|
});
|
2020-06-17 10:47:01 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("LoginFromAPI", (uname, pword) => {
|
|
|
|
|
cy.request({
|
|
|
|
|
method: "POST",
|
|
|
|
|
url: "api/v1/login",
|
|
|
|
|
headers: {
|
|
|
|
|
"content-type": "application/x-www-form-urlencoded",
|
|
|
|
|
},
|
|
|
|
|
followRedirect: false,
|
|
|
|
|
form: true,
|
|
|
|
|
body: {
|
|
|
|
|
username: uname,
|
|
|
|
|
password: pword,
|
|
|
|
|
},
|
|
|
|
|
}).then(response => {
|
|
|
|
|
expect(response.status).equal(302);
|
|
|
|
|
cy.log(response.body);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("DeleteApp", appName => {
|
|
|
|
|
cy.get(commonlocators.homeIcon).click({ force: true });
|
|
|
|
|
cy.get(homePage.searchInput).type(appName);
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
cy.get(homePage.appMoreIcon)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(homePage.deleteButton).click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("Deletepage", Pagename => {
|
|
|
|
|
cy.get(pages.pagesIcon).click({ force: true });
|
|
|
|
|
cy.get(".t--page-sidebar-" + Pagename + "");
|
|
|
|
|
cy.get(
|
|
|
|
|
".t--page-sidebar-" +
|
|
|
|
|
Pagename +
|
|
|
|
|
">.t--page-sidebar-menu-actions>.bp3-popover-target",
|
|
|
|
|
).click({ force: true });
|
|
|
|
|
cy.get(pages.Menuaction).click({ force: true });
|
|
|
|
|
cy.get(pages.Delete).click({ force: true });
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-19 06:13:15 +00:00
|
|
|
Cypress.Commands.add("LogOut", () => {
|
|
|
|
|
cy.request("POST", "/api/v1/logout").then(response => {
|
|
|
|
|
expect(response.status).equal(200);
|
|
|
|
|
});
|
|
|
|
|
});
|
2020-04-02 04:47:48 +00:00
|
|
|
|
2020-06-17 10:47:01 +00:00
|
|
|
Cypress.Commands.add("NavigateToHome", () => {
|
|
|
|
|
cy.get(commonlocators.homeIcon).click({ force: true });
|
|
|
|
|
cy.wait("@applications").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-01 07:48:33 +00:00
|
|
|
Cypress.Commands.add("NavigateToWidgets", pageName => {
|
2020-04-02 04:47:48 +00:00
|
|
|
cy.get(pages.pagesIcon).click({ force: true });
|
2020-05-01 07:48:33 +00:00
|
|
|
cy.get(".t--page-sidebar-" + pageName + "")
|
2020-04-08 13:38:19 +00:00
|
|
|
.find(">div")
|
|
|
|
|
.click({ force: true });
|
2020-04-02 04:47:48 +00:00
|
|
|
cy.get("#loading").should("not.exist");
|
2020-04-21 14:19:12 +00:00
|
|
|
cy.get(pages.widgetsEditor).click();
|
2020-04-17 08:17:25 +00:00
|
|
|
cy.wait("@getPage");
|
2020-04-02 04:47:48 +00:00
|
|
|
cy.get("#loading").should("not.exist");
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-01 07:48:33 +00:00
|
|
|
Cypress.Commands.add("SearchApp", appname => {
|
|
|
|
|
cy.get(homePage.searchInput).type(appname);
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
cy.get(homePage.appEditIcon)
|
|
|
|
|
.first()
|
2020-04-21 14:19:12 +00:00
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get("#loading").should("not.exist");
|
2020-05-01 07:48:33 +00:00
|
|
|
// Wait added because after opening the application editor, sometimes it takes a little time.
|
2020-04-02 04:47:48 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-12 13:47:13 +00:00
|
|
|
Cypress.Commands.add("SearchAPI", (apiname1, apiname2) => {
|
|
|
|
|
cy.get("span:contains(".concat(apiname2).concat(")")).should("be.visible");
|
|
|
|
|
cy.get(apiwidget.searchApi)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.type(apiname1, { force: true });
|
|
|
|
|
cy.get("span:contains(".concat(apiname1).concat(")")).should("be.visible");
|
|
|
|
|
cy.get("span:contains(".concat(apiname2).concat(")")).should(
|
|
|
|
|
"not.be.visible",
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("ResponseStatusCheck", statusCode => {
|
2020-05-20 16:04:37 +00:00
|
|
|
cy.xpath(apiwidget.responseStatus).should("be.visible");
|
|
|
|
|
cy.xpath(apiwidget.responseStatus).contains(statusCode);
|
2020-05-12 13:47:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("ResponseCheck", textTocheck => {
|
|
|
|
|
//Explicit assert
|
2020-06-19 14:32:56 +00:00
|
|
|
cy.get(apiwidget.responseText).should("be.visible");
|
2020-05-12 13:47:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("NavigateToAPI_Panel", () => {
|
|
|
|
|
cy.get(pages.apiEditorIcon)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get("#loading").should("not.exist");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("CreateAPI", apiname => {
|
2020-05-20 16:04:37 +00:00
|
|
|
cy.get(apiwidget.createApiOnSideBar)
|
2020-05-12 13:47:13 +00:00
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(apiwidget.createapi).click({ force: true });
|
2020-06-26 13:56:18 +00:00
|
|
|
cy.wait("@createNewApi");
|
2020-05-12 13:47:13 +00:00
|
|
|
cy.get(apiwidget.resourceUrl).should("be.visible");
|
2020-07-16 05:00:51 +00:00
|
|
|
cy.get(apiwidget.apiTxt).click();
|
2020-05-12 13:47:13 +00:00
|
|
|
cy.get(apiwidget.apiTxt)
|
|
|
|
|
.clear()
|
|
|
|
|
.type(apiname)
|
2020-07-03 08:58:58 +00:00
|
|
|
.should("have.value", apiname)
|
|
|
|
|
.blur();
|
2020-07-21 12:05:06 +00:00
|
|
|
cy.WaitAutoSave();
|
2020-06-16 10:23:19 +00:00
|
|
|
// Added because api name edit takes some time to
|
|
|
|
|
// reflect in api sidebar after the call passes.
|
2020-07-06 05:38:39 +00:00
|
|
|
cy.wait(2000);
|
2020-05-12 13:47:13 +00:00
|
|
|
});
|
2020-05-20 16:04:37 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("CreateSubsequentAPI", apiname => {
|
|
|
|
|
cy.get(apiwidget.createApiOnSideBar)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(apiwidget.resourceUrl).should("be.visible");
|
2020-06-16 10:23:19 +00:00
|
|
|
// cy.get(ApiEditor.nameOfApi)
|
2020-05-20 16:04:37 +00:00
|
|
|
cy.get(apiwidget.apiTxt)
|
|
|
|
|
.clear()
|
|
|
|
|
.type(apiname)
|
|
|
|
|
.should("have.value", apiname);
|
2020-06-10 17:42:51 +00:00
|
|
|
cy.WaitAutoSave();
|
2020-05-20 16:04:37 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-12 13:47:13 +00:00
|
|
|
Cypress.Commands.add("EditApiName", apiname => {
|
2020-06-17 10:47:01 +00:00
|
|
|
//cy.wait("@getUser");
|
2020-06-30 04:19:16 +00:00
|
|
|
cy.get(apiwidget.EditApiName).click();
|
2020-05-12 13:47:13 +00:00
|
|
|
cy.get(apiwidget.apiTxt)
|
|
|
|
|
.clear()
|
|
|
|
|
.type(apiname)
|
|
|
|
|
.should("have.value", apiname);
|
2020-06-10 17:42:51 +00:00
|
|
|
cy.WaitAutoSave();
|
2020-05-12 13:47:13 +00:00
|
|
|
});
|
|
|
|
|
|
2020-06-10 17:42:51 +00:00
|
|
|
Cypress.Commands.add("WaitAutoSave", () => {
|
2020-07-03 08:58:58 +00:00
|
|
|
// wait for save query to trigger
|
|
|
|
|
cy.wait(200);
|
2020-07-21 12:05:06 +00:00
|
|
|
cy.wait("@saveAction");
|
2020-06-24 13:52:41 +00:00
|
|
|
//cy.wait("@postExecute");
|
2020-05-12 13:47:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("RunAPI", () => {
|
|
|
|
|
cy.get(ApiEditor.ApiRunBtn).click({ force: true });
|
2020-07-21 12:05:06 +00:00
|
|
|
cy.wait("@postExecute").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
2020-05-12 13:47:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("SaveAndRunAPI", () => {
|
2020-06-10 17:42:51 +00:00
|
|
|
cy.WaitAutoSave();
|
2020-05-12 13:47:13 +00:00
|
|
|
cy.RunAPI();
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-20 16:04:37 +00:00
|
|
|
Cypress.Commands.add("SelectAction", action => {
|
|
|
|
|
cy.get(ApiEditor.ApiVerb)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.xpath(action)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("ClearSearch", () => {
|
|
|
|
|
cy.get(apiwidget.searchApi).clear();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("SearchAPIandClick", apiname1 => {
|
|
|
|
|
cy.get(apiwidget.searchApi)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.type(apiname1, { force: true });
|
|
|
|
|
cy.get(".t--sidebar span:contains(".concat(apiname1).concat(")"))
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("enterDatasourceAndPath", (datasource, path) => {
|
|
|
|
|
cy.get(apiwidget.resourceUrl)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.type(datasource);
|
2020-07-03 08:58:58 +00:00
|
|
|
/*
|
2020-05-20 16:04:37 +00:00
|
|
|
cy.xpath(apiwidget.autoSuggest)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
2020-06-17 10:47:01 +00:00
|
|
|
*/
|
2020-06-03 05:40:48 +00:00
|
|
|
cy.get(apiwidget.editResourceUrl)
|
|
|
|
|
.first()
|
2020-05-20 16:04:37 +00:00
|
|
|
.click({ force: true })
|
|
|
|
|
.type(path, { parseSpecialCharSequences: false });
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-12 13:47:13 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"EnterSourceDetailsWithHeader",
|
|
|
|
|
(baseUrl, v1method, hKey, hValue) => {
|
2020-05-20 16:04:37 +00:00
|
|
|
cy.enterDatasourceAndPath(baseUrl, v1method);
|
|
|
|
|
cy.xpath(apiwidget.headerKey)
|
2020-05-12 13:47:13 +00:00
|
|
|
.first()
|
|
|
|
|
.click({ force: true })
|
2020-05-20 16:04:37 +00:00
|
|
|
.type(hKey, { force: true })
|
|
|
|
|
.should("have.value", hKey);
|
|
|
|
|
cy.xpath(apiwidget.headerValue)
|
|
|
|
|
.first()
|
2020-05-12 13:47:13 +00:00
|
|
|
.click({ force: true })
|
2020-05-20 16:04:37 +00:00
|
|
|
.type(hValue, { force: true })
|
|
|
|
|
.should("have.value", hValue);
|
2020-06-10 17:42:51 +00:00
|
|
|
cy.WaitAutoSave();
|
2020-05-20 16:04:37 +00:00
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("EditSourceDetail", (baseUrl, v1method) => {
|
|
|
|
|
cy.get(apiwidget.editResourceUrl)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true })
|
2020-06-03 05:40:48 +00:00
|
|
|
.clear()
|
|
|
|
|
.type(`{backspace}${baseUrl}`);
|
2020-05-20 16:04:37 +00:00
|
|
|
cy.xpath(apiwidget.autoSuggest)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(ApiEditor.ApiRunBtn).scrollIntoView();
|
2020-06-03 05:40:48 +00:00
|
|
|
cy.get(apiwidget.editResourceUrl)
|
|
|
|
|
.first()
|
2020-05-20 16:04:37 +00:00
|
|
|
.focus()
|
2020-06-03 05:40:48 +00:00
|
|
|
.type(v1method)
|
2020-05-20 16:04:37 +00:00
|
|
|
.should("have.value", v1method);
|
2020-06-10 17:42:51 +00:00
|
|
|
cy.WaitAutoSave();
|
2020-05-20 16:04:37 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-27 11:21:11 +00:00
|
|
|
Cypress.Commands.add("switchToPaginationTab", () => {
|
|
|
|
|
cy.get(apiwidget.paginationTab)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("switchToAPIInputTab", () => {
|
|
|
|
|
cy.get(apiwidget.apiInputTab)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("selectPaginationType", option => {
|
|
|
|
|
cy.get(apiwidget.paginationOption)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.xpath(option).click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("clickTest", testbutton => {
|
|
|
|
|
cy.get(testbutton)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("enterUrl", (apiname, url, value) => {
|
|
|
|
|
cy.get(url)
|
|
|
|
|
.first()
|
|
|
|
|
.type("{{".concat(apiname).concat(value), {
|
|
|
|
|
force: true,
|
|
|
|
|
parseSpecialCharSequences: false,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-20 16:04:37 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"EnterSourceDetailsWithQueryParam",
|
|
|
|
|
(baseUrl, v1method, hKey, hValue, qKey, qValue) => {
|
|
|
|
|
cy.enterDatasourceAndPath(baseUrl, v1method);
|
|
|
|
|
cy.xpath(apiwidget.headerKey)
|
|
|
|
|
.first()
|
2020-05-12 13:47:13 +00:00
|
|
|
.click({ force: true })
|
|
|
|
|
.type(hKey, { force: true })
|
|
|
|
|
.should("have.value", hKey);
|
2020-05-20 16:04:37 +00:00
|
|
|
cy.xpath(apiwidget.headerValue)
|
|
|
|
|
.first()
|
2020-05-12 13:47:13 +00:00
|
|
|
.click({ force: true })
|
2020-05-20 16:04:37 +00:00
|
|
|
.type(hValue, { force: true })
|
2020-05-12 13:47:13 +00:00
|
|
|
.should("have.value", hValue);
|
2020-05-20 16:04:37 +00:00
|
|
|
cy.xpath(apiwidget.queryKey)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.type(qKey, { force: true })
|
|
|
|
|
.should("have.value", qKey);
|
|
|
|
|
cy.xpath(apiwidget.queryValue)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.type(qValue, { force: true })
|
|
|
|
|
.should("have.value", qValue);
|
2020-06-10 17:42:51 +00:00
|
|
|
cy.WaitAutoSave();
|
2020-05-12 13:47:13 +00:00
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2020-05-20 16:04:37 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"EnterSourceDetailsWithbody",
|
|
|
|
|
(baseUrl, v1method, hKey, hValue) => {
|
|
|
|
|
cy.enterDatasourceAndPath(baseUrl, v1method);
|
|
|
|
|
cy.get(apiwidget.addHeader)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ first: true });
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2020-05-12 13:47:13 +00:00
|
|
|
Cypress.Commands.add("CreationOfUniqueAPIcheck", apiname => {
|
2020-05-20 16:04:37 +00:00
|
|
|
cy.get(apiwidget.createApiOnSideBar)
|
2020-05-12 13:47:13 +00:00
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(apiwidget.createapi).click({ force: true });
|
2020-06-16 10:23:19 +00:00
|
|
|
cy.wait("@createNewApi");
|
|
|
|
|
// cy.wait("@getUser");
|
2020-05-12 13:47:13 +00:00
|
|
|
cy.get(apiwidget.resourceUrl).should("be.visible");
|
|
|
|
|
cy.get(apiwidget.apiTxt)
|
|
|
|
|
.clear()
|
|
|
|
|
.type(apiname)
|
2020-06-10 17:42:51 +00:00
|
|
|
.should("have.value", apiname)
|
|
|
|
|
.focus();
|
2020-05-12 13:47:13 +00:00
|
|
|
cy.get(".bp3-popover-content").should($x => {
|
|
|
|
|
console.log($x);
|
2020-06-19 14:32:56 +00:00
|
|
|
expect($x).contain(apiname.concat(" is already being used."));
|
2020-05-12 13:47:13 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("MoveAPIToHome", apiname => {
|
|
|
|
|
cy.get(apiwidget.popover)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(apiwidget.moveTo).click({ force: true });
|
|
|
|
|
cy.get(apiwidget.home).click({ force: true });
|
|
|
|
|
cy.wait("@createNewApi").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
201,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-27 11:21:11 +00:00
|
|
|
Cypress.Commands.add("MoveAPIToPage", () => {
|
|
|
|
|
cy.get(apiwidget.popover)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(apiwidget.moveTo).click({ force: true });
|
2020-06-10 07:49:27 +00:00
|
|
|
cy.get(apiwidget.home).click({ force: true });
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.wait("@createNewApi").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
201,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-12 13:47:13 +00:00
|
|
|
Cypress.Commands.add("CopyAPIToHome", apiname => {
|
|
|
|
|
cy.get(apiwidget.popover)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(apiwidget.copyTo).click({ force: true });
|
|
|
|
|
cy.get(apiwidget.home).click({ force: true });
|
|
|
|
|
cy.wait("@createNewApi").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
201,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("DeleteAPI", apiname => {
|
|
|
|
|
cy.get(apiwidget.popover)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(apiwidget.delete).click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-01 07:48:33 +00:00
|
|
|
Cypress.Commands.add("CreateModal", () => {
|
|
|
|
|
cy.get(modalWidgetPage.selectModal).click();
|
|
|
|
|
cy.get(modalWidgetPage.createModalButton).click({ force: true });
|
|
|
|
|
cy.get(modalWidgetPage.controlModalType)
|
|
|
|
|
.find(".bp3-button")
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.get("ul.bp3-menu")
|
|
|
|
|
.children()
|
|
|
|
|
.contains("Alert Modal")
|
|
|
|
|
.click();
|
|
|
|
|
cy.get(modalWidgetPage.controlModalType)
|
|
|
|
|
.find(".bp3-button > .bp3-button-text")
|
|
|
|
|
.should("have.text", "Alert Modal");
|
|
|
|
|
cy.get(commonlocators.editPropCrossButton).click();
|
2020-05-05 09:25:42 +00:00
|
|
|
cy.reload();
|
2020-05-01 07:48:33 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-08 09:01:11 +00:00
|
|
|
Cypress.Commands.add("createModal", (modalType, ModalName) => {
|
|
|
|
|
cy.get(widgetsPage.buttonOnClick)
|
|
|
|
|
.get(commonlocators.dropdownSelectButton)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.get("ul.bp3-menu")
|
|
|
|
|
.children()
|
2020-05-28 19:03:37 +00:00
|
|
|
.contains("Open Popup")
|
2020-05-08 09:01:11 +00:00
|
|
|
.click();
|
|
|
|
|
cy.get(modalWidgetPage.selectModal).click();
|
|
|
|
|
cy.get(modalWidgetPage.createModalButton).click({ force: true });
|
|
|
|
|
|
|
|
|
|
cy.get(modalWidgetPage.controlModalType)
|
|
|
|
|
.find(".bp3-button")
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.get("ul.bp3-menu")
|
|
|
|
|
.children()
|
|
|
|
|
.contains(modalType)
|
|
|
|
|
.click();
|
|
|
|
|
cy.xpath(homePage.homePageID).contains("All changes saved");
|
|
|
|
|
|
|
|
|
|
// changing the model name verify
|
|
|
|
|
cy.widgetText(
|
|
|
|
|
ModalName,
|
|
|
|
|
modalWidgetPage.modalName,
|
|
|
|
|
modalWidgetPage.modalName,
|
|
|
|
|
);
|
|
|
|
|
cy.get(commonlocators.editPropCrossButton).click();
|
2020-05-28 06:37:47 +00:00
|
|
|
|
|
|
|
|
//changing the Model label
|
|
|
|
|
cy.get(modalWidgetPage.modalWidget + " " + widgetsPage.textWidget)
|
|
|
|
|
.first()
|
|
|
|
|
.trigger("mouseover");
|
|
|
|
|
|
|
|
|
|
cy.get(widgetsPage.textWidget + " " + commonlocators.editIcon).click();
|
|
|
|
|
cy.testCodeMirror(ModalName);
|
|
|
|
|
cy.get(widgetsPage.textAlign + " " + commonlocators.dropDownBtn).click();
|
|
|
|
|
cy.get(widgetsPage.textAlign + " .bp3-menu-item")
|
|
|
|
|
.contains("Center")
|
|
|
|
|
.click();
|
|
|
|
|
cy.xpath(homePage.homePageID).contains("All changes saved");
|
2020-05-08 09:01:11 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-28 06:37:47 +00:00
|
|
|
Cypress.Commands.add("CheckWidgetProperties", checkboxCss => {
|
|
|
|
|
cy.get(checkboxCss).check({
|
2020-05-08 09:01:11 +00:00
|
|
|
force: true,
|
|
|
|
|
});
|
|
|
|
|
cy.xpath(homePage.homePageID).contains("All changes saved");
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-28 06:37:47 +00:00
|
|
|
Cypress.Commands.add("UncheckWidgetProperties", checkboxCss => {
|
|
|
|
|
cy.get(checkboxCss).uncheck({
|
2020-05-08 09:01:11 +00:00
|
|
|
force: true,
|
|
|
|
|
});
|
|
|
|
|
cy.xpath(homePage.homePageID).contains("All changes saved");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"ChangeTextStyle",
|
|
|
|
|
(dropDownValue, textStylecss, labelName) => {
|
|
|
|
|
cy.get(commonlocators.dropDownIcon).click();
|
|
|
|
|
cy.get("ul.bp3-menu")
|
|
|
|
|
.children()
|
|
|
|
|
.contains(dropDownValue)
|
|
|
|
|
.click();
|
|
|
|
|
cy.get(textStylecss).should("have.text", labelName);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("widgetText", (text, inputcss, innercss) => {
|
|
|
|
|
cy.get(commonlocators.editWidgetName)
|
|
|
|
|
.dblclick({ force: true })
|
2020-06-17 10:47:01 +00:00
|
|
|
.type(text, { force: true })
|
2020-05-08 09:01:11 +00:00
|
|
|
.type("{enter}");
|
|
|
|
|
cy.get(inputcss)
|
|
|
|
|
.first()
|
|
|
|
|
.trigger("mouseover", { force: true });
|
|
|
|
|
cy.get(innercss).should("have.text", text);
|
|
|
|
|
});
|
|
|
|
|
|
2020-07-11 06:42:53 +00:00
|
|
|
Cypress.Commands.add("EvaluateDataType", dataType => {
|
|
|
|
|
cy.get(commonlocators.evaluatedType)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.contains(dataType);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("EvaluateCurrentValue", currentValue => {
|
|
|
|
|
cy.get(commonlocators.evaluatedCurrentValue)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.contains(currentValue);
|
|
|
|
|
});
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
Cypress.Commands.add("PublishtheApp", () => {
|
2020-05-26 12:22:29 +00:00
|
|
|
cy.server();
|
|
|
|
|
cy.route("POST", "/api/v1/applications/publish/*").as("publishApp");
|
2020-07-11 06:42:53 +00:00
|
|
|
// Wait before publish
|
|
|
|
|
cy.wait(2000);
|
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();
|
2020-04-17 08:17:25 +00:00
|
|
|
cy.wait("@publishApp");
|
2020-05-21 09:45:48 +00:00
|
|
|
cy.get('a[class="bp3-button"]')
|
|
|
|
|
.invoke("removeAttr", "target")
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.url().should("include", "/pages");
|
|
|
|
|
cy.log("pagename: " + localStorage.getItem("PageName"));
|
2020-04-17 08:17:25 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("getCodeMirror", () => {
|
|
|
|
|
return cy
|
|
|
|
|
.get(".CodeMirror textarea")
|
|
|
|
|
.first()
|
|
|
|
|
.focus()
|
|
|
|
|
.type("{ctrl}{shift}{downarrow}");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("testCodeMirror", value => {
|
|
|
|
|
cy.get(".CodeMirror textarea")
|
|
|
|
|
.first()
|
|
|
|
|
.focus()
|
|
|
|
|
.type("{ctrl}{shift}{downarrow}")
|
|
|
|
|
.then($cm => {
|
|
|
|
|
if ($cm.val() !== "") {
|
|
|
|
|
cy.get(".CodeMirror textarea")
|
|
|
|
|
.first()
|
|
|
|
|
.clear({
|
|
|
|
|
force: true,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cy.get(".CodeMirror textarea")
|
|
|
|
|
.first()
|
|
|
|
|
.type(value, {
|
|
|
|
|
force: true,
|
|
|
|
|
parseSpecialCharSequences: false,
|
|
|
|
|
});
|
2020-05-15 12:20:09 +00:00
|
|
|
cy.get(".CodeMirror textarea")
|
2020-04-17 08:17:25 +00:00
|
|
|
.first()
|
2020-05-15 12:20:09 +00:00
|
|
|
.should("have.value", value);
|
2020-04-17 08:17:25 +00:00
|
|
|
});
|
2020-03-27 09:02:11 +00:00
|
|
|
});
|
2020-05-01 07:48:33 +00:00
|
|
|
|
2020-06-17 10:19:56 +00:00
|
|
|
Cypress.Commands.add("testJsontext", (endp, value) => {
|
2020-05-15 12:20:09 +00:00
|
|
|
cy.get(".t--property-control-" + endp + " .CodeMirror textarea")
|
|
|
|
|
.first()
|
|
|
|
|
.focus({ force: true })
|
2020-06-17 10:19:56 +00:00
|
|
|
.type("{uparrow}", { force: true })
|
2020-05-15 12:20:09 +00:00
|
|
|
.type("{ctrl}{shift}{downarrow}", { force: true });
|
|
|
|
|
cy.focused().then($cm => {
|
2020-05-20 10:07:53 +00:00
|
|
|
if ($cm.contents != "") {
|
|
|
|
|
cy.log("The field is empty");
|
2020-05-28 10:35:54 +00:00
|
|
|
cy.get(".t--property-control-" + endp + " .CodeMirror textarea")
|
2020-05-15 12:20:09 +00:00
|
|
|
.first()
|
2020-06-17 10:19:56 +00:00
|
|
|
.clear({
|
|
|
|
|
force: true,
|
|
|
|
|
});
|
2020-05-15 12:20:09 +00:00
|
|
|
}
|
2020-05-28 10:35:54 +00:00
|
|
|
cy.get(".t--property-control-" + endp + " .CodeMirror textarea")
|
2020-05-15 12:20:09 +00:00
|
|
|
.first()
|
2020-06-17 10:19:56 +00:00
|
|
|
.type(value, {
|
2020-05-15 12:20:09 +00:00
|
|
|
force: true,
|
|
|
|
|
parseSpecialCharSequences: false,
|
|
|
|
|
});
|
|
|
|
|
});
|
2020-07-11 06:42:53 +00:00
|
|
|
cy.wait(200);
|
2020-05-15 12:20:09 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-08 09:01:11 +00:00
|
|
|
Cypress.Commands.add("SetDateToToday", () => {
|
2020-05-28 06:37:47 +00:00
|
|
|
cy.get(formWidgetsPage.datepickerFooter)
|
2020-05-08 09:01:11 +00:00
|
|
|
.contains("Today")
|
|
|
|
|
.click();
|
|
|
|
|
cy.xpath(homePage.homePageID).contains("All changes saved");
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-28 06:37:47 +00:00
|
|
|
Cypress.Commands.add("ClearDate", () => {
|
|
|
|
|
cy.get(formWidgetsPage.datepickerFooter)
|
|
|
|
|
.contains("Clear")
|
|
|
|
|
.click();
|
|
|
|
|
cy.xpath(homePage.homePageID).contains("All changes saved");
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-01 07:48:33 +00:00
|
|
|
Cypress.Commands.add("DeleteModal", () => {
|
|
|
|
|
cy.get(widgetsPage.textbuttonWidget).dblclick("topRight", { force: true });
|
|
|
|
|
cy.get(widgetsPage.deleteWidget)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("Createpage", Pagename => {
|
|
|
|
|
cy.get(pages.pagesIcon).click({ force: true });
|
|
|
|
|
cy.get(pages.AddPage).click();
|
|
|
|
|
cy.get(pages.editInput)
|
|
|
|
|
.type(Pagename)
|
|
|
|
|
.type("{Enter}");
|
2020-05-27 11:21:11 +00:00
|
|
|
pageidcopy = Pagename;
|
2020-05-01 07:48:33 +00:00
|
|
|
cy.get("#loading").should("not.exist");
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("Deletepage", Pagename => {
|
|
|
|
|
cy.get(pages.pagesIcon).click({ force: true });
|
|
|
|
|
cy.get(".t--page-sidebar-" + Pagename + "");
|
|
|
|
|
cy.get(
|
|
|
|
|
".t--page-sidebar-" +
|
|
|
|
|
Pagename +
|
|
|
|
|
">.t--page-sidebar-menu-actions>.bp3-popover-target",
|
|
|
|
|
).click({ force: true });
|
|
|
|
|
cy.get(pages.Menuaction).click({ force: true });
|
|
|
|
|
cy.get(pages.Delete).click({ force: true });
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("generateUUID", () => {
|
|
|
|
|
const uuid = require("uuid");
|
|
|
|
|
const id = uuid.v4();
|
|
|
|
|
return id;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("addDsl", dsl => {
|
|
|
|
|
let currentURL;
|
|
|
|
|
let pageid;
|
|
|
|
|
let layoutId;
|
|
|
|
|
cy.url().then(url => {
|
|
|
|
|
currentURL = url;
|
|
|
|
|
const myRegexp = /pages(.*)/;
|
|
|
|
|
const match = myRegexp.exec(currentURL);
|
|
|
|
|
pageid = match[1].split("/")[1];
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.log(pageidcopy + "page id copy");
|
2020-05-01 07:48:33 +00:00
|
|
|
cy.log(pageid + "page id");
|
|
|
|
|
//Fetch the layout id
|
|
|
|
|
cy.server();
|
2020-05-14 05:10:36 +00:00
|
|
|
cy.request("GET", "api/v1/pages/" + pageid).then(response => {
|
2020-05-01 07:48:33 +00:00
|
|
|
const len = JSON.stringify(response.body);
|
|
|
|
|
cy.log(len);
|
|
|
|
|
layoutId = JSON.parse(len).data.layouts[0].id;
|
|
|
|
|
// Dumpimg the DSL to the created page
|
|
|
|
|
cy.request(
|
|
|
|
|
"PUT",
|
2020-05-14 05:10:36 +00:00
|
|
|
"api/v1/layouts/" + layoutId + "/pages/" + pageid,
|
2020-05-01 07:48:33 +00:00
|
|
|
dsl,
|
|
|
|
|
).then(response => {
|
|
|
|
|
expect(response.status).equal(200);
|
|
|
|
|
cy.reload();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
2020-05-08 05:40:14 +00:00
|
|
|
|
2020-05-12 04:35:21 +00:00
|
|
|
Cypress.Commands.add("DeleteAppByApi", () => {
|
|
|
|
|
let currentURL;
|
|
|
|
|
let appId;
|
|
|
|
|
cy.url().then(url => {
|
|
|
|
|
currentURL = url;
|
|
|
|
|
const myRegexp = /applications(.*)/;
|
|
|
|
|
const match = myRegexp.exec(currentURL);
|
|
|
|
|
appId = match[1].split("/")[1];
|
2020-05-20 11:04:39 +00:00
|
|
|
|
|
|
|
|
if (appId != null) {
|
|
|
|
|
cy.log(appId + "appId");
|
|
|
|
|
cy.request("DELETE", "api/v1/applications/" + appId).then(response => {
|
|
|
|
|
expect(response.status).equal(200);
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-05-12 04:35:21 +00:00
|
|
|
});
|
|
|
|
|
});
|
2020-06-17 10:19:56 +00:00
|
|
|
Cypress.Commands.add("togglebar", value => {
|
|
|
|
|
cy.get(value)
|
|
|
|
|
.check({ force: true })
|
|
|
|
|
.should("be.checked");
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("radiovalue", (value, value2) => {
|
|
|
|
|
cy.get(value)
|
|
|
|
|
.click()
|
|
|
|
|
.clear()
|
|
|
|
|
.type(value2);
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("optionValue", (value, value2) => {
|
|
|
|
|
cy.get(value)
|
|
|
|
|
.click()
|
|
|
|
|
.clear()
|
|
|
|
|
.type(value2);
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("dropdownDynamic", text => {
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
cy.get("ul[class='bp3-menu']")
|
|
|
|
|
.first()
|
|
|
|
|
.contains(text)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.should("have.text", text);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("getAlert", alertcss => {
|
|
|
|
|
cy.get(commonlocators.dropdownSelectButton).click({ force: true });
|
|
|
|
|
cy.get(widgetsPage.menubar)
|
|
|
|
|
.contains("Show Alert")
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.should("have.text", "Show Alert");
|
|
|
|
|
|
|
|
|
|
cy.get(alertcss)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.type("{command}{A}{del}")
|
|
|
|
|
.type("hello")
|
|
|
|
|
.should("not.to.be.empty");
|
|
|
|
|
cy.get(".t--open-dropdown-Select-type").click({ force: true });
|
|
|
|
|
cy.get(".bp3-popover-content .bp3-menu li")
|
|
|
|
|
.contains("Success")
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("widgetText", (text, inputcss, innercss) => {
|
|
|
|
|
cy.get(commonlocators.editWidgetName)
|
|
|
|
|
.dblclick({ force: true })
|
|
|
|
|
.type(text)
|
|
|
|
|
.type("{enter}");
|
|
|
|
|
cy.get(inputcss)
|
|
|
|
|
.first()
|
|
|
|
|
.trigger("mouseover", { force: true });
|
|
|
|
|
cy.get(innercss).should("have.text", text);
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("radioInput", (index, text) => {
|
|
|
|
|
cy.get(widgetsPage.RadioInput)
|
|
|
|
|
.eq(index)
|
|
|
|
|
.click()
|
|
|
|
|
.clear()
|
|
|
|
|
.type(text);
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("tabVerify", (index, text) => {
|
|
|
|
|
cy.get(".t--property-control-tabs input")
|
|
|
|
|
.eq(index)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.clear()
|
|
|
|
|
.type(text);
|
|
|
|
|
cy.get(LayoutPage.tabWidget)
|
|
|
|
|
.contains(text)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.should("be.visible");
|
|
|
|
|
});
|
2020-05-20 11:04:39 +00:00
|
|
|
|
2020-05-16 07:28:13 +00:00
|
|
|
Cypress.Commands.add("togglebar", value => {
|
|
|
|
|
cy.get(value)
|
|
|
|
|
.check({ force: true })
|
|
|
|
|
.should("be.checked");
|
|
|
|
|
});
|
2020-05-26 12:22:29 +00:00
|
|
|
Cypress.Commands.add("togglebarDisable", value => {
|
|
|
|
|
cy.get(value)
|
|
|
|
|
.uncheck({ force: true })
|
|
|
|
|
.should("not.checked");
|
|
|
|
|
});
|
2020-05-16 07:28:13 +00:00
|
|
|
Cypress.Commands.add("radiovalue", (value, value2) => {
|
|
|
|
|
cy.get(value)
|
|
|
|
|
.click()
|
|
|
|
|
.clear()
|
|
|
|
|
.type(value2);
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("optionValue", (value, value2) => {
|
|
|
|
|
cy.get(value)
|
|
|
|
|
.click()
|
|
|
|
|
.clear()
|
|
|
|
|
.type(value2);
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("dropdownDynamic", text => {
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
cy.get("ul[class='bp3-menu']")
|
|
|
|
|
.first()
|
|
|
|
|
.contains(text)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.should("have.text", text);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("getAlert", alertcss => {
|
|
|
|
|
cy.get(commonlocators.dropdownSelectButton).click({ force: true });
|
|
|
|
|
cy.get(widgetsPage.menubar)
|
2020-05-28 18:59:09 +00:00
|
|
|
.contains("Show Message")
|
2020-05-16 07:28:13 +00:00
|
|
|
.click({ force: true })
|
2020-05-28 18:59:09 +00:00
|
|
|
.should("have.text", "Show Message");
|
2020-05-16 07:28:13 +00:00
|
|
|
|
|
|
|
|
cy.get(alertcss)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.type("{command}{A}{del}")
|
|
|
|
|
.type("hello")
|
|
|
|
|
.should("not.to.be.empty");
|
|
|
|
|
cy.get(".t--open-dropdown-Select-type").click({ force: true });
|
|
|
|
|
cy.get(".bp3-popover-content .bp3-menu li")
|
|
|
|
|
.contains("Success")
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("widgetText", (text, inputcss, innercss) => {
|
|
|
|
|
cy.get(commonlocators.editWidgetName)
|
|
|
|
|
.dblclick({ force: true })
|
|
|
|
|
.type(text)
|
|
|
|
|
.type("{enter}");
|
|
|
|
|
cy.get(inputcss)
|
|
|
|
|
.first()
|
|
|
|
|
.trigger("mouseover", { force: true });
|
|
|
|
|
cy.get(innercss).should("have.text", text);
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("radioInput", (index, text) => {
|
|
|
|
|
cy.get(widgetsPage.RadioInput)
|
|
|
|
|
.eq(index)
|
|
|
|
|
.click()
|
|
|
|
|
.clear()
|
|
|
|
|
.type(text);
|
|
|
|
|
});
|
|
|
|
|
Cypress.Commands.add("tabVerify", (index, text) => {
|
|
|
|
|
cy.get(".t--property-control-tabs input")
|
|
|
|
|
.eq(index)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.clear()
|
|
|
|
|
.type(text);
|
|
|
|
|
cy.get(LayoutPage.tabWidget)
|
|
|
|
|
.contains(text)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.should("be.visible");
|
|
|
|
|
});
|
2020-05-12 04:35:21 +00:00
|
|
|
|
2020-05-08 05:40:14 +00:00
|
|
|
Cypress.Commands.add("NavigateToDatasourceEditor", () => {
|
|
|
|
|
cy.get(datasourceEditor.datasourceEditorIcon).click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("getPluginFormsAndCreateDatasource", () => {
|
|
|
|
|
cy.wait("@getPluginForm").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
cy.wait("@createDatasource").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
201,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-07 08:07:50 +00:00
|
|
|
Cypress.Commands.add("NavigateToApiEditor", () => {
|
|
|
|
|
cy.get(pages.apiEditorIcon).click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("testCreateApiButton", () => {
|
|
|
|
|
cy.get(ApiEditor.createBlankApiCard).click({ force: true });
|
|
|
|
|
cy.wait("@createNewApi").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
201,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-08 05:40:14 +00:00
|
|
|
Cypress.Commands.add("testSaveDeleteDatasource", () => {
|
|
|
|
|
cy.get(".t--test-datasource").click();
|
|
|
|
|
cy.wait("@testDatasource").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.data.success",
|
|
|
|
|
true,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
cy.get(".t--save-datasource").click();
|
|
|
|
|
cy.wait("@saveDatasource").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
cy.get(".t--delete-datasource").click();
|
|
|
|
|
cy.wait("@deleteDatasource").should(
|
|
|
|
|
"have.nested.property",
|
2020-05-07 08:07:50 +00:00
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("importCurl", () => {
|
|
|
|
|
cy.get(ApiEditor.curlImportBtn).click({ force: true });
|
|
|
|
|
cy.wait("@curlImport").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
201,
|
|
|
|
|
);
|
|
|
|
|
});
|
2020-05-08 15:31:36 +00:00
|
|
|
|
2020-05-11 09:03:46 +00:00
|
|
|
Cypress.Commands.add("NavigateToDatasourceEditor", () => {
|
|
|
|
|
cy.get(datasourceEditor.datasourceEditorIcon).click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("NavigateToQueryEditor", () => {
|
|
|
|
|
cy.get(queryEditor.queryEditorIcon).click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("testSaveDatasource", () => {
|
|
|
|
|
cy.get(".t--test-datasource").click();
|
|
|
|
|
cy.wait("@testDatasource").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.data.success",
|
|
|
|
|
true,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
cy.get(".t--save-datasource").click();
|
|
|
|
|
cy.wait("@saveDatasource").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("fillMongoDatasourceForm", () => {
|
|
|
|
|
cy.get(datasourceEditor["host"]).type(datasourceFormData["mongo-host"]);
|
|
|
|
|
cy.get(datasourceEditor["port"]).type(datasourceFormData["mongo-port"]);
|
2020-06-12 05:09:49 +00:00
|
|
|
|
|
|
|
|
cy.get(datasourceEditor.sectionAuthentication).click();
|
2020-05-11 09:03:46 +00:00
|
|
|
cy.get(datasourceEditor["databaseName"])
|
|
|
|
|
.clear()
|
|
|
|
|
.type(datasourceFormData["mongo-databaseName"]);
|
|
|
|
|
cy.get(datasourceEditor["username"]).type(
|
|
|
|
|
datasourceFormData["mongo-username"],
|
|
|
|
|
);
|
|
|
|
|
cy.get(datasourceEditor["password"]).type(
|
|
|
|
|
datasourceFormData["mongo-password"],
|
|
|
|
|
);
|
|
|
|
|
|
2020-06-12 05:09:49 +00:00
|
|
|
cy.get(datasourceEditor.sectionSSL).click();
|
2020-05-11 09:03:46 +00:00
|
|
|
cy.get(datasourceEditor["authenticationAuthtype"]).click();
|
|
|
|
|
cy.contains(datasourceFormData["mongo-authenticationAuthtype"]).click({
|
|
|
|
|
force: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cy.get(datasourceEditor["sslAuthtype"]).click();
|
|
|
|
|
cy.contains(datasourceFormData["mongo-sslAuthtype"]).click({
|
|
|
|
|
force: true,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("fillPostgresDatasourceForm", () => {
|
|
|
|
|
cy.get(datasourceEditor.host).type(datasourceFormData["postgres-host"]);
|
|
|
|
|
cy.get(datasourceEditor.port).type(datasourceFormData["postgres-port"]);
|
|
|
|
|
cy.get(datasourceEditor.databaseName)
|
|
|
|
|
.clear()
|
|
|
|
|
.type(datasourceFormData["postgres-databaseName"]);
|
2020-06-12 05:09:49 +00:00
|
|
|
|
|
|
|
|
cy.get(datasourceEditor.sectionAuthentication).click();
|
2020-05-11 09:03:46 +00:00
|
|
|
cy.get(datasourceEditor.username).type(
|
|
|
|
|
datasourceFormData["postgres-username"],
|
|
|
|
|
);
|
|
|
|
|
cy.get(datasourceEditor.password).type(
|
|
|
|
|
datasourceFormData["postgres-password"],
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2020-07-02 05:29:55 +00:00
|
|
|
Cypress.Commands.add("runAndDeleteQuery", () => {
|
2020-05-11 09:03:46 +00:00
|
|
|
cy.get(queryEditor.runQuery).click();
|
2020-05-12 13:47:13 +00:00
|
|
|
cy.wait("@postExecute").should(
|
2020-05-11 09:03:46 +00:00
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
cy.get(queryEditor.deleteQuery).click();
|
|
|
|
|
cy.wait("@deleteAction").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-08 15:31:36 +00:00
|
|
|
Cypress.Commands.add("openPropertyPane", widgetType => {
|
|
|
|
|
const selector = `.t--draggable-${widgetType}`;
|
|
|
|
|
cy.get(selector)
|
|
|
|
|
.first()
|
|
|
|
|
.trigger("mouseover")
|
|
|
|
|
.wait(500);
|
|
|
|
|
cy.get(`${selector}:first-of-type .t--widget-propertypane-toggle`)
|
|
|
|
|
.first()
|
2020-06-26 13:56:18 +00:00
|
|
|
.click({ force: true });
|
2020-05-08 15:31:36 +00:00
|
|
|
});
|
2020-05-14 09:16:39 +00:00
|
|
|
|
2020-06-04 13:49:22 +00:00
|
|
|
Cypress.Commands.add("closePropertyPane", () => {
|
|
|
|
|
cy.get(commonlocators.editPropCrossButton).click();
|
|
|
|
|
});
|
|
|
|
|
|
2020-07-03 08:58:58 +00:00
|
|
|
Cypress.Commands.add("createAndFillApi", (url, parameters) => {
|
|
|
|
|
cy.NavigateToApiEditor();
|
|
|
|
|
cy.testCreateApiButton();
|
2020-05-14 11:02:41 +00:00
|
|
|
cy.get("@createNewApi").then(response => {
|
|
|
|
|
cy.get(ApiEditor.ApiNameField).should("be.visible");
|
|
|
|
|
cy.expect(response.response.body.responseMeta.success).to.eq(true);
|
2020-06-26 13:56:18 +00:00
|
|
|
cy.get(ApiEditor.ApiNameField)
|
2020-07-21 12:05:06 +00:00
|
|
|
.click()
|
2020-06-26 13:56:18 +00:00
|
|
|
.invoke("text")
|
|
|
|
|
.then(text => {
|
|
|
|
|
const someText = text;
|
|
|
|
|
expect(someText).to.equal(response.response.body.data.name);
|
|
|
|
|
});
|
2020-05-14 11:02:41 +00:00
|
|
|
});
|
2020-05-18 05:34:49 +00:00
|
|
|
|
2020-07-11 06:42:53 +00:00
|
|
|
cy.get(ApiEditor.dataSourceField)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.type(url, { parseSpecialCharSequences: false }, { force: true });
|
2020-05-14 09:16:39 +00:00
|
|
|
cy.contains(url).click({
|
|
|
|
|
force: true,
|
|
|
|
|
});
|
2020-06-03 05:40:48 +00:00
|
|
|
cy.get(apiwidget.editResourceUrl)
|
2020-05-15 12:20:09 +00:00
|
|
|
.first()
|
|
|
|
|
.click({ force: true })
|
2020-06-10 12:25:16 +00:00
|
|
|
.type(parameters, { parseSpecialCharSequences: false }, { force: true });
|
2020-06-10 17:42:51 +00:00
|
|
|
cy.WaitAutoSave();
|
2020-05-14 09:16:39 +00:00
|
|
|
cy.get(ApiEditor.formActionButtons).should("be.visible");
|
|
|
|
|
cy.get(ApiEditor.ApiRunBtn).should("not.be.disabled");
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-16 07:28:13 +00:00
|
|
|
Cypress.Commands.add("isSelectRow", index => {
|
|
|
|
|
cy.get(
|
2020-06-03 10:50:10 +00:00
|
|
|
'.tbody .td[data-rowindex="' + index + '"][data-colindex="' + 0 + '"]',
|
2020-05-16 07:28:13 +00:00
|
|
|
).click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-14 09:16:39 +00:00
|
|
|
Cypress.Commands.add("readTabledata", (rowNum, colNum) => {
|
2020-06-03 10:50:10 +00:00
|
|
|
// const selector = `.t--draggable-tablewidget .e-gridcontent.e-lib.e-droppable td[index=${rowNum}][aria-colindex=${colNum}]`;
|
|
|
|
|
const selector = `.t--draggable-tablewidget .tbody .td[data-rowindex=${rowNum}][data-colindex=${colNum}] div`;
|
2020-05-14 09:16:39 +00:00
|
|
|
const tabVal = cy.get(selector).invoke("text");
|
|
|
|
|
return tabVal;
|
|
|
|
|
});
|
2020-05-18 04:28:41 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("getDate", (date, dateFormate) => {
|
2020-05-28 06:37:47 +00:00
|
|
|
const eDate = Cypress.moment()
|
2020-05-18 04:28:41 +00:00
|
|
|
.add(date, "days")
|
|
|
|
|
.format(dateFormate);
|
2020-05-28 06:37:47 +00:00
|
|
|
return eDate;
|
2020-05-18 04:28:41 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("setDate", (date, dateFormate) => {
|
|
|
|
|
const expDate = Cypress.moment()
|
|
|
|
|
.add(date, "days")
|
|
|
|
|
.format(dateFormate);
|
|
|
|
|
const sel = `.DayPicker-Day[aria-label=\"${expDate}\"]`;
|
|
|
|
|
cy.get(sel).click();
|
|
|
|
|
});
|
2020-05-18 05:34:49 +00:00
|
|
|
|
2020-05-16 07:28:13 +00:00
|
|
|
Cypress.Commands.add("pageNo", index => {
|
2020-06-03 10:50:10 +00:00
|
|
|
cy.get(".page-item")
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
2020-05-16 07:28:13 +00:00
|
|
|
});
|
2020-05-18 05:34:49 +00:00
|
|
|
|
2020-05-16 07:28:13 +00:00
|
|
|
Cypress.Commands.add("pageNoValidate", index => {
|
|
|
|
|
const data = '.e-numericcontainer a[index="' + index + '"]';
|
|
|
|
|
const pageVal = cy.get(data);
|
|
|
|
|
return pageVal;
|
|
|
|
|
});
|
2020-05-27 11:21:11 +00:00
|
|
|
|
2020-05-28 06:37:47 +00:00
|
|
|
Cypress.Commands.add("validateDisableWidget", (widgetCss, disableCss) => {
|
|
|
|
|
cy.get(widgetCss + disableCss).should("exist");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("validateEnableWidget", (widgetCss, disableCss) => {
|
|
|
|
|
cy.get(widgetCss + disableCss).should("not.exist");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("validateHTMLText", (widgetCss, htmlTag, value) => {
|
|
|
|
|
cy.get(widgetCss + " iframe").then($iframe => {
|
|
|
|
|
const $body = $iframe.contents().find("body");
|
|
|
|
|
cy.wrap($body)
|
|
|
|
|
.find(htmlTag)
|
|
|
|
|
.should("have.text", value);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-27 11:21:11 +00:00
|
|
|
Cypress.Commands.add("startServerAndRoutes", () => {
|
|
|
|
|
cy.server();
|
2020-06-17 10:47:01 +00:00
|
|
|
cy.route("GET", "/api/v1/applications/new").as("applications");
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.route("GET", "/api/v1/users/profile").as("getUser");
|
|
|
|
|
cy.route("GET", "/api/v1/plugins").as("getPlugins");
|
|
|
|
|
cy.route("POST", "/api/v1/logout").as("postLogout");
|
|
|
|
|
|
2020-07-16 05:50:46 +00:00
|
|
|
cy.route({
|
|
|
|
|
method: "GET",
|
|
|
|
|
url: "**/api/v1/configs/name/propertyPane",
|
|
|
|
|
status: 200,
|
|
|
|
|
response: "fixture:../fixtures/propertyPaneResponse.json",
|
|
|
|
|
delay: 100,
|
|
|
|
|
}).as("getPropertyPane");
|
|
|
|
|
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.route("GET", "/api/v1/datasources").as("getDataSources");
|
|
|
|
|
cy.route("GET", "/api/v1/pages/application/*").as("getPagesForApp");
|
|
|
|
|
cy.route("GET", "/api/v1/pages/*").as("getPage");
|
|
|
|
|
cy.route("GET", "/api/v1/actions*").as("getActions");
|
|
|
|
|
cy.route("GET", "api/v1/providers/categories").as("getCategories");
|
|
|
|
|
cy.route("GET", "api/v1/import/templateCollections").as(
|
|
|
|
|
"getTemplateCollections",
|
|
|
|
|
);
|
|
|
|
|
cy.route("DELETE", "/api/v1/actions/*").as("deleteAPI");
|
|
|
|
|
cy.route("DELETE", "/api/v1/applications/*").as("deleteApp");
|
|
|
|
|
cy.route("DELETE", "/api/v1/actions/*").as("deleteAction");
|
|
|
|
|
cy.route("DELETE", "/api/v1/pages/*").as("deletePage");
|
|
|
|
|
|
|
|
|
|
cy.route("GET", "/api/v1/plugins/*/form").as("getPluginForm");
|
|
|
|
|
cy.route("POST", "/api/v1/datasources").as("createDatasource");
|
|
|
|
|
cy.route("POST", "/api/v1/datasources/test").as("testDatasource");
|
|
|
|
|
cy.route("PUT", "/api/v1/datasources/*").as("saveDatasource");
|
|
|
|
|
cy.route("DELETE", "/api/v1/datasources/*").as("deleteDatasource");
|
|
|
|
|
|
|
|
|
|
cy.route("GET", "/api/v1/organizations").as("organizations");
|
|
|
|
|
cy.route("POST", "/api/v1/actions/execute").as("executeAction");
|
|
|
|
|
cy.route("POST", "/api/v1/applications/publish/*").as("publishApp");
|
|
|
|
|
cy.route("PUT", "/api/v1/layouts/*/pages/*").as("updateLayout");
|
|
|
|
|
|
|
|
|
|
cy.route("POST", "/track/*").as("postTrack");
|
|
|
|
|
cy.route("POST", "/api/v1/actions/execute").as("postExecute");
|
|
|
|
|
|
|
|
|
|
cy.route("POST", "/api/v1/actions").as("createNewApi");
|
|
|
|
|
cy.route("POST", "/api/v1/import?type=CURL&pageId=*&name=*").as("curlImport");
|
|
|
|
|
cy.route("DELETE", "/api/v1/actions/*").as("deleteAction");
|
|
|
|
|
cy.route("GET", "/api/v1/marketplace/providers?category=*&page=*&size=*").as(
|
|
|
|
|
"get3PProviders",
|
|
|
|
|
);
|
|
|
|
|
cy.route("GET", "/api/v1/marketplace/templates?providerId=*").as(
|
|
|
|
|
"get3PProviderTemplates",
|
|
|
|
|
);
|
|
|
|
|
cy.route("POST", "/api/v1/items/addToPage").as("add3PApiToPage");
|
|
|
|
|
|
|
|
|
|
cy.route("GET", "/api/v1/plugins/*/form").as("getPluginForm");
|
|
|
|
|
cy.route("POST", "/api/v1/datasources").as("createDatasource");
|
|
|
|
|
cy.route("POST", "/api/v1/datasources/test").as("testDatasource");
|
|
|
|
|
cy.route("PUT", "/api/v1/datasources/*").as("saveDatasource");
|
|
|
|
|
cy.route("DELETE", "/api/v1/datasources/*").as("deleteDatasource");
|
|
|
|
|
cy.route("DELETE", "/api/v1/applications/*").as("deleteApplication");
|
|
|
|
|
|
2020-07-06 05:38:39 +00:00
|
|
|
cy.route("PUT", "/api/v1/actions/*").as("saveAction");
|
2020-07-20 09:38:35 +00:00
|
|
|
|
|
|
|
|
cy.route("POST", "/api/v1/organizations").as("createOrg");
|
|
|
|
|
cy.route("POST", "/api/v1/users/invite").as("postInvite");
|
|
|
|
|
cy.route("GET", "/api/v1/organizations/roles").as("getRoles");
|
2020-05-27 11:21:11 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-26 12:22:29 +00:00
|
|
|
Cypress.Commands.add("alertValidate", text => {
|
|
|
|
|
cy.get(commonlocators.success)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.and("have.text", text);
|
|
|
|
|
});
|
2020-05-29 10:02:03 +00:00
|
|
|
|
2020-05-28 10:35:54 +00:00
|
|
|
Cypress.Commands.add("ExportVerify", (togglecss, name) => {
|
|
|
|
|
cy.togglebar(togglecss);
|
|
|
|
|
cy.get(".t--draggable-tablewidget button")
|
|
|
|
|
.invoke("attr", "aria-label")
|
|
|
|
|
.should("contain", name);
|
|
|
|
|
cy.togglebarDisable(togglecss);
|
|
|
|
|
});
|
2020-05-29 10:02:03 +00:00
|
|
|
|
2020-05-28 10:35:54 +00:00
|
|
|
Cypress.Commands.add("readTabledataPublish", (rowNum, colNum) => {
|
2020-06-03 10:50:10 +00:00
|
|
|
// const selector = `.t--widget-tablewidget .e-gridcontent.e-lib.e-droppable td[index=${rowNum}][aria-colindex=${colNum}]`;
|
|
|
|
|
const selector = `.t--widget-tablewidget .tbody .td[data-rowindex=${rowNum}][data-colindex=${colNum}] div`;
|
2020-05-28 10:35:54 +00:00
|
|
|
const tabVal = cy.get(selector).invoke("text");
|
|
|
|
|
return tabVal;
|
|
|
|
|
});
|
2020-06-04 13:49:22 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("assertEvaluatedValuePopup", expectedType => {
|
|
|
|
|
cy.get(dynamicInputLocators.evaluatedValue)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.children("p")
|
|
|
|
|
.should("contain.text", "Expected type:")
|
|
|
|
|
.should("contain.text", "Current Value:")
|
|
|
|
|
.siblings("pre")
|
|
|
|
|
.should("have.text", expectedType);
|
|
|
|
|
});
|
2020-06-10 12:25:16 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("validateToastMessage", value => {
|
|
|
|
|
cy.get(commonlocators.toastMsg).should("have.text", value);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("NavigateToPaginationTab", () => {
|
|
|
|
|
cy.get(ApiEditor.apiTab)
|
|
|
|
|
.contains("Pagination")
|
|
|
|
|
.click();
|
|
|
|
|
cy.get(ApiEditor.apiPaginationTab).click();
|
|
|
|
|
cy.get(ApiEditor.apiPaginationTab + " input")
|
|
|
|
|
.first()
|
|
|
|
|
.type("Paginate with Response Url", { force: true })
|
|
|
|
|
.type("{enter}");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("ValidateTableData", () => {
|
|
|
|
|
cy.isSelectRow(0);
|
|
|
|
|
cy.readTabledata("0", "1").then(tabData => {
|
|
|
|
|
const tableData = tabData;
|
|
|
|
|
cy.get(commonlocators.labelTextStyle).should("have.text", tableData);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("ValidatePublishTableData", () => {
|
|
|
|
|
cy.isSelectRow(0);
|
|
|
|
|
cy.readTabledataPublish("0", "1").then(tabData => {
|
|
|
|
|
const tableData = tabData;
|
|
|
|
|
cy.get(commonlocators.labelTextStyle).should("have.text", tableData);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("ValidatePaginateResponseUrlData", runTestCss => {
|
|
|
|
|
cy.NavigateToApiEditor();
|
|
|
|
|
cy.get("div[tabindex='0'] >div>span")
|
|
|
|
|
.contains("Api2")
|
|
|
|
|
.first()
|
|
|
|
|
.click();
|
|
|
|
|
cy.NavigateToPaginationTab();
|
|
|
|
|
cy.RunAPI();
|
|
|
|
|
cy.get(ApiEditor.apiPaginationNextTest).click();
|
|
|
|
|
cy.wait("@postExecute");
|
|
|
|
|
cy.get(runTestCss).click();
|
|
|
|
|
cy.wait("@postExecute");
|
|
|
|
|
cy.get(ApiEditor.formActionButtons).should("be.visible");
|
|
|
|
|
cy.get(ApiEditor.ApiRunBtn).should("not.be.disabled");
|
|
|
|
|
cy.get(ApiEditor.responseBody)
|
|
|
|
|
.contains("url")
|
|
|
|
|
.siblings("span")
|
|
|
|
|
.invoke("text")
|
|
|
|
|
.then(tabData => {
|
2020-07-11 06:42:53 +00:00
|
|
|
const respBody = tabData.match(/"(.*)"/)[0];
|
2020-06-10 12:25:16 +00:00
|
|
|
localStorage.setItem("respBody", respBody);
|
|
|
|
|
cy.log(respBody);
|
|
|
|
|
cy.get(pages.pagesIcon).click({ force: true });
|
2020-06-11 05:13:18 +00:00
|
|
|
// cy.openPropertyPane("tablewidget");
|
|
|
|
|
// cy.testJsontext("tabledata", "{{Api2.data.results}}");
|
2020-06-10 12:25:16 +00:00
|
|
|
cy.isSelectRow(0);
|
|
|
|
|
cy.get(commonlocators.labelTextStyle)
|
|
|
|
|
.invoke("text")
|
|
|
|
|
.then(inputdata => {
|
|
|
|
|
expect(respBody).to.eq(`\"${inputdata}\"`);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("ValidatePaginationInputData", () => {
|
|
|
|
|
cy.isSelectRow(0);
|
|
|
|
|
cy.get(commonlocators.labelTextStyle)
|
|
|
|
|
.invoke("text")
|
|
|
|
|
.then(inputdata => {
|
|
|
|
|
expect(localStorage.getItem("respBody")).to.eq(`\"${inputdata}\"`);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("callApi", apiname => {
|
|
|
|
|
cy.get(commonlocators.callApi)
|
|
|
|
|
.first()
|
|
|
|
|
.click();
|
|
|
|
|
cy.get(commonlocators.singleSelectMenuItem)
|
2020-06-17 06:00:43 +00:00
|
|
|
.contains("Call An API")
|
2020-06-10 12:25:16 +00:00
|
|
|
.click();
|
|
|
|
|
cy.get(commonlocators.selectMenuItem)
|
|
|
|
|
.contains(apiname)
|
|
|
|
|
.click();
|
|
|
|
|
});
|