2021-02-16 10:29:08 +00:00
|
|
|
/* eslint-disable cypress/no-unnecessary-waiting */
|
|
|
|
|
/* eslint-disable cypress/no-assigning-return-values */
|
2022-04-11 03:30:37 +00:00
|
|
|
/* This file is used to maintain comman methods across tests , refer other *.js files for adding common methods */
|
|
|
|
|
|
2021-11-30 15:26:37 +00:00
|
|
|
require("cy-verify-downloads").addCustomCommand();
|
2020-12-03 05:32:50 +00:00
|
|
|
require("cypress-file-upload");
|
2022-04-12 10:01:22 +00:00
|
|
|
//require('cy-verify-downloads').addCustomCommand();
|
|
|
|
|
const path = require("path");
|
2021-11-30 15:26:37 +00:00
|
|
|
|
2021-08-25 14:01:04 +00:00
|
|
|
const dayjs = require("dayjs");
|
2021-12-24 12:17:22 +00:00
|
|
|
const {
|
|
|
|
|
addMatchImageSnapshotCommand,
|
|
|
|
|
} = require("cypress-image-snapshot/command");
|
2020-03-27 09:02:11 +00:00
|
|
|
const loginPage = require("../locators/LoginPage.json");
|
2021-10-01 16:25:55 +00:00
|
|
|
const signupPage = require("../locators/SignupPage.json");
|
2022-02-25 06:13:16 +00:00
|
|
|
import homePage from "../locators/HomePage";
|
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");
|
2022-03-02 16:54:43 +00:00
|
|
|
import ApiEditor from "../locators/ApiEditor";
|
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-08-20 05:38:08 +00:00
|
|
|
const explorer = require("../locators/explorerlocators.json");
|
2021-04-06 13:29:27 +00:00
|
|
|
const datasource = require("../locators/DatasourcesEditor.json");
|
2021-06-24 14:28:20 +00:00
|
|
|
const viewWidgetsPage = require("../locators/ViewWidgets.json");
|
2021-07-29 08:13:10 +00:00
|
|
|
const generatePage = require("../locators/GeneratePage.json");
|
2021-10-07 02:29:16 +00:00
|
|
|
const jsEditorLocators = require("../locators/JSEditor.json");
|
2022-02-25 06:13:16 +00:00
|
|
|
const commonLocators = require("../locators/commonlocators.json");
|
2022-03-02 16:54:43 +00:00
|
|
|
import commentsLocators from "../locators/CommentsLocators";
|
2021-11-18 14:27:51 +00:00
|
|
|
const queryLocators = require("../locators/QueryEditor.json");
|
2021-10-29 09:10:30 +00:00
|
|
|
const welcomePage = require("../locators/welcomePage.json");
|
2021-11-30 15:26:37 +00:00
|
|
|
const publishWidgetspage = require("../locators/publishWidgetspage.json");
|
2022-05-11 06:13:28 +00:00
|
|
|
const themelocator = require("../locators/ThemeLocators.json");
|
2022-02-25 06:13:16 +00:00
|
|
|
import gitSyncLocators from "../locators/gitSyncLocators";
|
|
|
|
|
|
2020-05-27 11:21:11 +00:00
|
|
|
let pageidcopy = " ";
|
2022-02-25 06:13:16 +00:00
|
|
|
const GITHUB_API_BASE = "https://api.github.com";
|
2021-11-26 10:47:53 +00:00
|
|
|
const chainStart = Symbol();
|
2020-03-10 09:38:12 +00:00
|
|
|
|
2021-07-02 06:04:36 +00:00
|
|
|
export const initLocalstorage = () => {
|
|
|
|
|
cy.window().then((window) => {
|
|
|
|
|
window.localStorage.setItem("ShowCommentsButtonToolTip", "");
|
2022-03-25 10:43:26 +00:00
|
|
|
window.localStorage.setItem("updateDismissed", "true");
|
2021-07-02 06:04:36 +00:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-04 12:50:40 +00:00
|
|
|
Cypress.Commands.add("goToEditFromPublish", () => {
|
|
|
|
|
cy.url().then((url) => {
|
2021-10-27 11:32:26 +00:00
|
|
|
const urlObject = new URL(url);
|
|
|
|
|
if (!urlObject.pathname.includes("edit")) {
|
|
|
|
|
urlObject.pathname = urlObject.pathname + "/edit";
|
|
|
|
|
cy.visit(urlObject.toString());
|
2021-08-04 12:50:40 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2020-09-08 10:54:55 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"dragTo",
|
|
|
|
|
{ prevSubject: "element" },
|
|
|
|
|
(subject, targetEl) => {
|
|
|
|
|
cy.wrap(subject).trigger("dragstart");
|
|
|
|
|
cy.get(targetEl).trigger("drop");
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2021-11-30 15:26:37 +00:00
|
|
|
Cypress.Commands.add("downloadData", (filetype) => {
|
|
|
|
|
cy.get(publishWidgetspage.downloadBtn).click({ force: true });
|
|
|
|
|
|
|
|
|
|
cy.get(publishWidgetspage.downloadOption)
|
|
|
|
|
.contains(filetype)
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("validateDownload", (fileName) => {
|
2022-04-12 10:01:22 +00:00
|
|
|
// const downloadedFilename = Cypress.config("downloadsFolder")
|
|
|
|
|
// .concat("/")
|
|
|
|
|
// .concat(fileName);
|
|
|
|
|
// cy.readFile(downloadedFilename, "binary", {
|
|
|
|
|
// timeout: 15000,
|
|
|
|
|
// }).should((buffer) => expect(buffer.length).to.be.gt(100));
|
|
|
|
|
|
|
|
|
|
let downloadsFolder = Cypress.config("downloadsFolder");
|
|
|
|
|
cy.log("downloadsFolder is:" + downloadsFolder);
|
|
|
|
|
cy.readFile(path.join(downloadsFolder, fileName)).should("exist");
|
2021-11-30 15:26:37 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"AddFilterWithOperator",
|
|
|
|
|
(operator, option, condition, value) => {
|
|
|
|
|
cy.get(publishWidgetspage.addFilter).click();
|
|
|
|
|
cy.get(publishWidgetspage.operatorsDropdown).click({ force: true });
|
|
|
|
|
cy.get(publishWidgetspage.attributeValue)
|
|
|
|
|
.contains(operator)
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(publishWidgetspage.attributesDropdown)
|
|
|
|
|
.last()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(publishWidgetspage.attributeValue)
|
|
|
|
|
.contains(option)
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(publishWidgetspage.conditionDropdown)
|
|
|
|
|
.last()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(publishWidgetspage.attributeValue)
|
|
|
|
|
.contains(condition)
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(publishWidgetspage.inputValue)
|
|
|
|
|
.last()
|
|
|
|
|
.type(value);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2021-04-06 13:29:27 +00:00
|
|
|
Cypress.Commands.add("stubPostHeaderReq", () => {
|
|
|
|
|
cy.intercept("POST", "/api/v1/users/invite", (req) => {
|
2021-11-23 08:01:46 +00:00
|
|
|
req.headers["origin"] = "Cypress";
|
2021-04-06 13:29:27 +00:00
|
|
|
}).as("mockPostInvite");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"addOauthAuthDetails",
|
|
|
|
|
(accessTokenUrl, clientId, clientSecret, authURL) => {
|
|
|
|
|
cy.get(datasource.authType).click();
|
2021-12-27 12:04:45 +00:00
|
|
|
cy.get(datasource.OAuth2).click();
|
2021-04-06 13:29:27 +00:00
|
|
|
cy.get(datasource.grantType).click();
|
2021-12-27 12:04:45 +00:00
|
|
|
cy.get(datasource.authorisecode).click();
|
2021-04-06 13:29:27 +00:00
|
|
|
cy.get(datasource.accessTokenUrl).type(accessTokenUrl);
|
|
|
|
|
cy.get(datasource.clienID).type(clientId);
|
|
|
|
|
cy.get(datasource.clientSecret).type(clientSecret);
|
|
|
|
|
cy.get(datasource.authorizationURL).type(authURL);
|
|
|
|
|
cy.xpath('//input[contains(@value,"api/v1/datasources/authorize")]')
|
|
|
|
|
.first()
|
|
|
|
|
.invoke("attr", "value")
|
|
|
|
|
.then((text) => {
|
|
|
|
|
const firstTxt = text;
|
|
|
|
|
cy.log("date time : ", firstTxt);
|
|
|
|
|
const expectedvalue = Cypress.config().baseUrl.concat(
|
|
|
|
|
"api/v1/datasources/authorize",
|
|
|
|
|
);
|
|
|
|
|
expect(firstTxt).to.equal(expectedvalue);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2021-05-10 11:57:54 +00:00
|
|
|
Cypress.Commands.add("addBasicProfileDetails", (username, password) => {
|
|
|
|
|
cy.get(datasource.authType).click();
|
|
|
|
|
cy.xpath(datasource.basic).click();
|
|
|
|
|
cy.get(datasource.basicUsername).type(username);
|
|
|
|
|
cy.get(datasource.basicPassword).type(password);
|
|
|
|
|
});
|
|
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("DeleteApp", (appName) => {
|
2020-05-20 11:04:39 +00:00
|
|
|
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 });
|
2020-08-18 06:40:11 +00:00
|
|
|
cy.get(homePage.applicationCard).trigger("mouseover");
|
2020-05-21 09:45:48 +00:00
|
|
|
cy.get(homePage.appMoreIcon)
|
|
|
|
|
.should("have.length", 1)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
2020-10-14 10:35:19 +00:00
|
|
|
cy.get(homePage.deleteAppConfirm)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click({ force: true });
|
2020-09-16 11:50:47 +00:00
|
|
|
cy.get(homePage.deleteApp)
|
2020-05-21 09:45:48 +00:00
|
|
|
.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) => {
|
2022-03-02 16:54:43 +00:00
|
|
|
cy.wait(1000); //waiting for window to load
|
2021-02-03 07:59:00 +00:00
|
|
|
cy.window()
|
|
|
|
|
.its("store")
|
|
|
|
|
.invoke("dispatch", { type: "LOGOUT_USER_INIT" });
|
|
|
|
|
cy.wait("@postLogout");
|
|
|
|
|
|
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);
|
2022-03-31 11:51:08 +00:00
|
|
|
cy.get(loginPage.password).type(pword, { log: false });
|
2020-03-27 09:02:11 +00:00
|
|
|
cy.get(loginPage.submitBtn).click();
|
2022-04-03 16:43:20 +00:00
|
|
|
cy.wait("@getMe");
|
2021-11-17 15:45:48 +00:00
|
|
|
cy.wait(3000);
|
2021-11-17 10:10:57 +00:00
|
|
|
cy.get(".t--applications-container .createnew").should("be.visible");
|
|
|
|
|
cy.get(".t--applications-container .createnew").should("be.enabled");
|
2021-07-02 06:04:36 +00:00
|
|
|
initLocalstorage();
|
2020-03-27 09:02:11 +00:00
|
|
|
});
|
2020-06-17 10:47:01 +00:00
|
|
|
|
2021-10-01 16:25:55 +00:00
|
|
|
Cypress.Commands.add("Signup", (uname, pword) => {
|
|
|
|
|
cy.window()
|
|
|
|
|
.its("store")
|
|
|
|
|
.invoke("dispatch", { type: "LOGOUT_USER_INIT" });
|
|
|
|
|
cy.wait("@postLogout");
|
|
|
|
|
|
|
|
|
|
cy.visit("/user/signup");
|
|
|
|
|
cy.get(signupPage.username).should("be.visible");
|
|
|
|
|
cy.get(signupPage.username).type(uname);
|
|
|
|
|
cy.get(signupPage.password).type(pword);
|
|
|
|
|
cy.get(signupPage.submitBtn).click();
|
2021-10-21 05:36:17 +00:00
|
|
|
cy.wait(1000);
|
|
|
|
|
cy.get(signupPage.roleDropdown).click();
|
|
|
|
|
cy.get(signupPage.dropdownOption).click();
|
|
|
|
|
cy.get(signupPage.useCaseDropdown).click();
|
|
|
|
|
cy.get(signupPage.dropdownOption).click();
|
|
|
|
|
cy.get(signupPage.roleUsecaseSubmit).click();
|
|
|
|
|
|
2022-04-03 16:43:20 +00:00
|
|
|
cy.wait("@getMe");
|
2021-11-17 15:45:48 +00:00
|
|
|
cy.wait(3000);
|
2021-10-01 16:25:55 +00:00
|
|
|
initLocalstorage();
|
|
|
|
|
});
|
|
|
|
|
|
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,
|
|
|
|
|
},
|
2021-01-04 10:16:08 +00:00
|
|
|
}).then((response) => {
|
2020-06-17 10:47:01 +00:00
|
|
|
expect(response.status).equal(302);
|
2022-04-03 16:43:20 +00:00
|
|
|
//cy.log(response.body);
|
2020-06-17 10:47:01 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("DeleteApp", (appName) => {
|
2020-06-17 10:47:01 +00:00
|
|
|
cy.get(commonlocators.homeIcon).click({ force: true });
|
|
|
|
|
cy.get(homePage.searchInput).type(appName);
|
2021-03-31 08:35:19 +00:00
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2020-06-17 10:47:01 +00:00
|
|
|
cy.wait(2000);
|
2020-10-31 06:40:51 +00:00
|
|
|
cy.get(homePage.applicationCard)
|
|
|
|
|
.first()
|
|
|
|
|
.trigger("mouseover");
|
2020-06-17 10:47:01 +00:00
|
|
|
cy.get(homePage.appMoreIcon)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
2020-10-14 10:35:19 +00:00
|
|
|
cy.get(homePage.deleteAppConfirm)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click({ force: true });
|
2020-09-16 11:50:47 +00:00
|
|
|
cy.get(homePage.deleteApp)
|
2020-10-14 10:35:19 +00:00
|
|
|
.contains("Are you sure?")
|
2020-09-01 07:16:54 +00:00
|
|
|
.click({ force: true });
|
2020-06-17 10:47:01 +00:00
|
|
|
});
|
|
|
|
|
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
Cypress.Commands.add("DeletepageFromSideBar", () => {
|
|
|
|
|
cy.xpath(pages.popover)
|
|
|
|
|
.last()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(pages.deletePage)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
2022-03-23 05:33:06 +00:00
|
|
|
cy.get(pages.deletePageConfirm)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
2021-03-31 08:35:19 +00:00
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2020-06-17 10:47:01 +00:00
|
|
|
cy.wait(2000);
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-19 06:13:15 +00:00
|
|
|
Cypress.Commands.add("LogOut", () => {
|
2020-08-03 14:18:48 +00:00
|
|
|
cy.request("POST", "/api/v1/logout");
|
2020-05-19 06:13:15 +00:00
|
|
|
});
|
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 });
|
2021-03-31 08:35:19 +00:00
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2021-11-23 08:01:46 +00:00
|
|
|
cy.wait(3000);
|
|
|
|
|
cy.get(".t--applications-container .createnew").should("be.visible");
|
|
|
|
|
cy.get(".t--applications-container .createnew").should("be.enabled");
|
2020-06-17 10:47:01 +00:00
|
|
|
});
|
|
|
|
|
|
2021-01-04 10:16:08 +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");
|
|
|
|
|
});
|
|
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("SearchApp", (appname) => {
|
2020-05-01 07:48:33 +00:00
|
|
|
cy.get(homePage.searchInput).type(appname);
|
2021-03-31 08:35:19 +00:00
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2020-05-01 07:48:33 +00:00
|
|
|
cy.wait(2000);
|
2020-09-17 17:01:01 +00:00
|
|
|
cy.get(homePage.applicationCard)
|
|
|
|
|
.first()
|
|
|
|
|
.trigger("mouseover", { force: true });
|
2020-05-01 07:48:33 +00:00
|
|
|
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
|
|
|
});
|
|
|
|
|
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
Cypress.Commands.add("SearchEntity", (apiname1, apiname2) => {
|
2022-05-20 05:02:13 +00:00
|
|
|
cy.get(commonlocators.searchEntityInExplorer)
|
2021-06-09 12:20:15 +00:00
|
|
|
.clear({ force: true })
|
|
|
|
|
.type(apiname1, { force: true });
|
2021-03-31 08:35:19 +00:00
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2022-01-29 07:26:19 +00:00
|
|
|
cy.get(".t--entity-name").click({ multiple: true });
|
2020-08-20 11:18:10 +00:00
|
|
|
cy.wait(500);
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
cy.get(
|
|
|
|
|
commonlocators.entitySearchResult.concat(apiname1).concat("')"),
|
|
|
|
|
).should("be.visible");
|
|
|
|
|
cy.get(
|
|
|
|
|
commonlocators.entitySearchResult.concat(apiname2).concat("')"),
|
2021-01-14 05:44:07 +00:00
|
|
|
).should("not.exist");
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
});
|
|
|
|
|
|
2022-02-25 06:13:16 +00:00
|
|
|
Cypress.Commands.add("GlobalSearchEntity", (apiname1, dontAssertVisibility) => {
|
2021-06-09 12:20:15 +00:00
|
|
|
// entity explorer search will be hidden
|
2022-05-20 05:02:13 +00:00
|
|
|
cy.get(commonlocators.searchEntityInExplorer)
|
2021-06-09 12:20:15 +00:00
|
|
|
.clear({ force: true })
|
|
|
|
|
.type(apiname1, { force: true });
|
2021-03-31 08:35:19 +00:00
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2022-01-29 07:26:19 +00:00
|
|
|
cy.CheckAndUnfoldWidgets();
|
2020-08-20 11:18:10 +00:00
|
|
|
cy.wait(500);
|
2022-02-25 06:13:16 +00:00
|
|
|
if (!dontAssertVisibility) {
|
|
|
|
|
cy.get(
|
|
|
|
|
commonlocators.entitySearchResult.concat(apiname1).concat("')"),
|
|
|
|
|
).should("be.visible");
|
|
|
|
|
}
|
2020-05-12 13:47:13 +00:00
|
|
|
});
|
|
|
|
|
|
2020-09-02 13:13:06 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"EditEntityNameByDoubleClick",
|
|
|
|
|
(entityName, updatedName) => {
|
|
|
|
|
cy.get(explorer.entity)
|
|
|
|
|
.contains(entityName)
|
|
|
|
|
.dblclick({ force: true });
|
|
|
|
|
cy.log(updatedName);
|
|
|
|
|
cy.get(explorer.editEntityField)
|
|
|
|
|
.clear()
|
|
|
|
|
.type(updatedName + "{enter}", { force: true });
|
|
|
|
|
cy.wait("@saveDatasource").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
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
|
2021-03-31 08:35:19 +00:00
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2020-07-24 04:31:39 +00:00
|
|
|
cy.wait(2000);
|
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
|
|
|
});
|
|
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("SelectAction", (action) => {
|
2020-05-20 16:04:37 +00:00
|
|
|
cy.get(ApiEditor.ApiVerb)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.xpath(action)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("ClearSearch", () => {
|
2021-06-09 12:20:15 +00:00
|
|
|
cy.get(commonlocators.entityExplorersearch).clear({ force: true });
|
2020-05-20 16:04:37 +00:00
|
|
|
});
|
|
|
|
|
|
2020-08-20 05:38:08 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"paste",
|
|
|
|
|
{
|
|
|
|
|
prevSubject: true,
|
|
|
|
|
element: true,
|
|
|
|
|
},
|
|
|
|
|
($element, text) => {
|
2022-04-13 07:00:38 +00:00
|
|
|
const subString = text.slice(0, -1);
|
2020-08-20 05:38:08 +00:00
|
|
|
const lastChar = text.slice(-1);
|
|
|
|
|
|
|
|
|
|
cy.get(commonlocators.entityExplorersearch)
|
2021-06-09 12:20:15 +00:00
|
|
|
.clear({ force: true })
|
|
|
|
|
.click({ force: true })
|
2020-08-20 05:38:08 +00:00
|
|
|
.then(() => {
|
|
|
|
|
$element.text(subString);
|
|
|
|
|
$element.val(subString);
|
|
|
|
|
cy.get($element).type(lastChar);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2022-01-29 07:26:19 +00:00
|
|
|
Cypress.Commands.add("CheckAndUnfoldWidgets", () => {
|
|
|
|
|
cy.get(commonlocators.widgetSection)
|
|
|
|
|
.invoke("attr", "name")
|
|
|
|
|
.then((name) => {
|
|
|
|
|
if (name === "arrow-right") {
|
|
|
|
|
cy.get(commonlocators.widgetSection).click({ force: true });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("SearchEntityandOpen", (apiname1) => {
|
2022-05-20 05:02:13 +00:00
|
|
|
cy.get(commonlocators.searchEntityInExplorer)
|
2021-06-09 12:20:15 +00:00
|
|
|
.clear({ force: true })
|
|
|
|
|
.type(apiname1, { force: true });
|
2022-01-29 07:26:19 +00:00
|
|
|
cy.CheckAndUnfoldWidgets();
|
|
|
|
|
cy.get(
|
|
|
|
|
commonlocators.entitySearchResult.concat(apiname1).concat("')"),
|
|
|
|
|
).scrollIntoView({ easing: "linear" });
|
2021-03-31 08:35:19 +00:00
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2020-08-20 11:18:10 +00:00
|
|
|
cy.wait(500);
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
cy.get(
|
|
|
|
|
commonlocators.entitySearchResult.concat(apiname1).concat("')"),
|
|
|
|
|
).should("be.visible");
|
2020-10-29 13:53:10 +00:00
|
|
|
cy.get(commonlocators.entitySearchResult.concat(apiname1).concat("')"))
|
|
|
|
|
.last()
|
|
|
|
|
.click({ force: true });
|
2022-01-29 07:26:19 +00:00
|
|
|
//cy.get('.t--entity-name').click({multiple:true})
|
2020-05-20 16:04:37 +00:00
|
|
|
});
|
2021-12-03 06:24:08 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("SearchEntityAndUnfold", (apiname1) => {
|
2022-05-20 05:02:13 +00:00
|
|
|
cy.get(commonlocators.searchEntityInExplorer)
|
2021-12-03 06:24:08 +00:00
|
|
|
.clear({ force: true })
|
|
|
|
|
.type(apiname1, { force: true });
|
|
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2022-01-29 07:26:19 +00:00
|
|
|
cy.CheckAndUnfoldWidgets();
|
2021-12-03 06:24:08 +00:00
|
|
|
cy.wait(500);
|
|
|
|
|
cy.get(
|
|
|
|
|
commonlocators.entitySearchResult.concat(apiname1).concat("')"),
|
|
|
|
|
).should("be.visible");
|
|
|
|
|
cy.get(commonlocators.entitySearchResult.concat(apiname1).concat("')"))
|
|
|
|
|
.parents(commonlocators.entityItem)
|
|
|
|
|
.first()
|
|
|
|
|
.children(commonlocators.entityCollapseToggle)
|
|
|
|
|
.last()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
2022-01-29 07:26:19 +00:00
|
|
|
Cypress.Commands.add("OpenBindings", (apiname1) => {
|
|
|
|
|
cy.wait(500);
|
2022-05-20 05:02:13 +00:00
|
|
|
cy.get(commonlocators.searchEntityInExplorer)
|
2022-01-29 07:26:19 +00:00
|
|
|
.clear({ force: true })
|
|
|
|
|
.type(apiname1, { force: true });
|
|
|
|
|
cy.CheckAndUnfoldWidgets();
|
|
|
|
|
cy.wait(500);
|
|
|
|
|
cy.get(
|
|
|
|
|
commonlocators.entitySearchResult.concat(apiname1).concat("')"),
|
|
|
|
|
).should("be.visible");
|
|
|
|
|
cy.get(commonlocators.entitySearchResult.concat(apiname1).concat("')"))
|
|
|
|
|
.parents(commonlocators.entityItem)
|
|
|
|
|
.first()
|
|
|
|
|
.trigger("mouseover")
|
|
|
|
|
.find(commonlocators.entityContextMenu)
|
|
|
|
|
.last()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(commonlocators.entityContextMenuContent)
|
|
|
|
|
.children("li")
|
|
|
|
|
.contains("Show Bindings")
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
2021-09-07 12:48:38 +00:00
|
|
|
Cypress.Commands.add("SearchEntityandDblClick", (apiname1) => {
|
|
|
|
|
cy.get(
|
|
|
|
|
commonlocators.entitySearchResult.concat(apiname1).concat("')"),
|
|
|
|
|
).should("be.visible");
|
2021-10-21 04:37:34 +00:00
|
|
|
return cy
|
|
|
|
|
.get(commonlocators.entitySearchResult.concat(apiname1).concat("')"))
|
|
|
|
|
.dblclick()
|
2022-01-13 13:21:57 +00:00
|
|
|
.get("input[type=text]")
|
2021-10-21 04:37:34 +00:00
|
|
|
.last();
|
2021-09-07 12:48:38 +00:00
|
|
|
});
|
2020-05-20 16:04:37 +00:00
|
|
|
|
2022-04-11 03:30:37 +00:00
|
|
|
Cypress.Commands.add("clickTest", (testbutton) => {
|
|
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
cy.wait("@saveAction");
|
|
|
|
|
cy.get(testbutton)
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.wait("@postExecute");
|
2020-05-20 16:04:37 +00:00
|
|
|
});
|
|
|
|
|
|
2022-04-11 03:30:37 +00:00
|
|
|
Cypress.Commands.add("EvaluateCurrentValue", (currentValue) => {
|
|
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
|
|
|
cy.wait(3000);
|
|
|
|
|
cy.get(commonlocators.evaluatedCurrentValue)
|
2021-05-10 11:57:54 +00:00
|
|
|
.first()
|
2022-04-11 03:30:37 +00:00
|
|
|
.should("be.visible")
|
|
|
|
|
.should("not.have.text", "undefined");
|
|
|
|
|
cy.get(commonlocators.evaluatedCurrentValue)
|
|
|
|
|
.first()
|
|
|
|
|
//.should("be.visible")
|
2021-05-10 11:57:54 +00:00
|
|
|
.click({ force: true })
|
2022-04-11 03:30:37 +00:00
|
|
|
.then(($text) => {
|
|
|
|
|
if ($text.text()) expect($text.text()).to.eq(currentValue);
|
2020-11-12 12:04:44 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2022-04-11 03:30:37 +00:00
|
|
|
Cypress.Commands.add("PublishtheApp", () => {
|
|
|
|
|
cy.server();
|
|
|
|
|
cy.route("POST", "/api/v1/applications/publish/*").as("publishApp");
|
|
|
|
|
// Wait before publish
|
|
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
cy.assertPageSave();
|
|
|
|
|
|
|
|
|
|
// Stubbing window.open to open in the same tab
|
|
|
|
|
cy.window().then((window) => {
|
|
|
|
|
cy.stub(window, "open").callsFake((url) => {
|
|
|
|
|
window.location.href = Cypress.config().baseUrl + url.substring(1);
|
|
|
|
|
window.location.target = "_self";
|
2021-02-16 10:29:08 +00:00
|
|
|
});
|
2022-04-11 03:30:37 +00:00
|
|
|
});
|
2020-12-30 07:31:20 +00:00
|
|
|
|
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.log("pagename: " + localStorage.getItem("PageName"));
|
2022-04-11 03:30:37 +00:00
|
|
|
cy.wait(1000); //wait time for page to load!
|
2020-05-01 07:48:33 +00:00
|
|
|
});
|
|
|
|
|
|
2022-04-11 03:30:37 +00:00
|
|
|
Cypress.Commands.add("tabPopertyUpdate", (tabId, newTabName) => {
|
|
|
|
|
cy.get("[data-rbd-draggable-id='" + tabId + "'] input")
|
|
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click({
|
|
|
|
|
force: true,
|
|
|
|
|
});
|
|
|
|
|
cy.get("[data-rbd-draggable-id='" + tabId + "'] input").clear({
|
|
|
|
|
force: true,
|
2022-03-18 08:45:38 +00:00
|
|
|
});
|
2022-04-11 03:30:37 +00:00
|
|
|
cy.get("[data-rbd-draggable-id='" + tabId + "'] input").type(newTabName, {
|
|
|
|
|
force: true,
|
2022-03-28 05:10:07 +00:00
|
|
|
});
|
2022-04-11 03:30:37 +00:00
|
|
|
cy.get(`.t--tabid-${tabId}`)
|
|
|
|
|
.contains(newTabName)
|
|
|
|
|
.should("be.visible");
|
2020-05-01 07:48:33 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("generateUUID", () => {
|
|
|
|
|
const uuid = require("uuid");
|
|
|
|
|
const id = uuid.v4();
|
2020-09-16 11:50:47 +00:00
|
|
|
return id.split("-")[0];
|
2020-05-01 07:48:33 +00:00
|
|
|
});
|
|
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("addDsl", (dsl) => {
|
2020-05-01 07:48:33 +00:00
|
|
|
let currentURL;
|
|
|
|
|
let pageid;
|
|
|
|
|
let layoutId;
|
2021-01-04 10:16:08 +00:00
|
|
|
cy.url().then((url) => {
|
2020-05-01 07:48:33 +00:00
|
|
|
currentURL = url;
|
2022-03-25 10:43:26 +00:00
|
|
|
pageid = currentURL
|
2022-04-07 05:39:15 +00:00
|
|
|
.split("/")[5]
|
2022-03-25 10:43:26 +00:00
|
|
|
?.split("-")
|
|
|
|
|
.pop();
|
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
|
2021-01-04 10:16:08 +00:00
|
|
|
cy.request("GET", "api/v1/pages/" + pageid).then((response) => {
|
2021-06-21 11:09:51 +00:00
|
|
|
const respBody = JSON.stringify(response.body);
|
|
|
|
|
layoutId = JSON.parse(respBody).data.layouts[0].id;
|
|
|
|
|
// Dumping the DSL to the created page
|
2020-05-01 07:48:33 +00:00
|
|
|
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,
|
2021-01-04 10:16:08 +00:00
|
|
|
).then((response) => {
|
2021-06-21 11:09:51 +00:00
|
|
|
cy.log(response.body);
|
2020-05-01 07:48:33 +00:00
|
|
|
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", () => {
|
2022-03-25 10:43:26 +00:00
|
|
|
const appId = localStorage.getItem("applicationId");
|
|
|
|
|
if (appId !== null) {
|
|
|
|
|
cy.log(appId + "appId");
|
|
|
|
|
cy.request({
|
|
|
|
|
method: "DELETE",
|
|
|
|
|
url: "api/v1/applications/" + appId,
|
|
|
|
|
failOnStatusCode: false,
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
cy.log(response.body);
|
|
|
|
|
cy.log(response.status);
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-05-12 04:35:21 +00:00
|
|
|
});
|
2021-10-29 07:02:45 +00:00
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("togglebar", (value) => {
|
2020-06-17 10:19:56 +00:00
|
|
|
cy.get(value)
|
|
|
|
|
.check({ force: true })
|
|
|
|
|
.should("be.checked");
|
|
|
|
|
});
|
2021-10-29 07:02:45 +00:00
|
|
|
|
2020-06-17 10:19:56 +00:00
|
|
|
Cypress.Commands.add("radiovalue", (value, value2) => {
|
|
|
|
|
cy.get(value)
|
|
|
|
|
.click()
|
|
|
|
|
.clear()
|
|
|
|
|
.type(value2);
|
|
|
|
|
});
|
2021-10-29 07:02:45 +00:00
|
|
|
|
2020-06-17 10:19:56 +00:00
|
|
|
Cypress.Commands.add("optionValue", (value, value2) => {
|
|
|
|
|
cy.get(value)
|
|
|
|
|
.click()
|
|
|
|
|
.clear()
|
|
|
|
|
.type(value2);
|
|
|
|
|
});
|
2021-10-29 07:02:45 +00:00
|
|
|
|
2022-03-24 19:34:28 +00:00
|
|
|
Cypress.Commands.add("typeIntoDraftEditor", (selector, text) => {
|
|
|
|
|
cy.get(selector).then((input) => {
|
|
|
|
|
var textarea = input.get(0);
|
|
|
|
|
textarea.dispatchEvent(new Event("focus"));
|
|
|
|
|
|
|
|
|
|
var textEvent = document.createEvent("TextEvent");
|
|
|
|
|
textEvent.initTextEvent("textInput", true, true, null, text);
|
|
|
|
|
textarea.dispatchEvent(textEvent);
|
|
|
|
|
|
|
|
|
|
textarea.dispatchEvent(new Event("blur"));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-08 05:40:14 +00:00
|
|
|
Cypress.Commands.add("getPluginFormsAndCreateDatasource", () => {
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
/*
|
2020-05-08 05:40:14 +00:00
|
|
|
cy.wait("@getPluginForm").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
cy.wait("@createDatasource").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
201,
|
|
|
|
|
);
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
*/
|
2020-05-08 05:40:14 +00:00
|
|
|
});
|
|
|
|
|
|
2020-08-20 05:38:08 +00:00
|
|
|
Cypress.Commands.add("NavigateToWidgetsInExplorer", () => {
|
|
|
|
|
cy.get(explorer.entityWidget).click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
2021-10-07 02:29:16 +00:00
|
|
|
Cypress.Commands.add("NavigateToJSEditor", () => {
|
2022-01-29 07:26:19 +00:00
|
|
|
cy.get(explorer.createNew).click({ force: true });
|
|
|
|
|
cy.get(".t--file-operation")
|
|
|
|
|
.eq(1)
|
2021-12-24 07:16:08 +00:00
|
|
|
.click({ force: true });
|
2021-10-07 02:29:16 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-07 08:07:50 +00:00
|
|
|
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
|
|
|
|
2021-11-18 14:27:51 +00:00
|
|
|
Cypress.Commands.add("NavigateToActiveTab", () => {
|
|
|
|
|
cy.get(explorer.activeTab).click({ force: true });
|
|
|
|
|
|
|
|
|
|
// cy.get(pages.integrationActiveTab)
|
|
|
|
|
// .should("be.visible")
|
|
|
|
|
// .click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
2022-01-29 07:26:19 +00:00
|
|
|
Cypress.Commands.add("selectAction", (option) => {
|
|
|
|
|
cy.get(".single-select")
|
|
|
|
|
.contains(option)
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
|
2022-03-23 05:33:06 +00:00
|
|
|
Cypress.Commands.add("deleteActionAndConfirm", () => {
|
|
|
|
|
cy.selectAction("Delete");
|
|
|
|
|
cy.selectAction("Are you sure?");
|
|
|
|
|
});
|
|
|
|
|
|
2021-10-07 02:29:16 +00:00
|
|
|
Cypress.Commands.add("deleteJSObject", () => {
|
|
|
|
|
cy.hoverAndClick();
|
|
|
|
|
cy.get(jsEditorLocators.delete).click({ force: true });
|
2022-03-23 05:33:06 +00:00
|
|
|
cy.get(jsEditorLocators.deleteConfirm).click({ force: true });
|
2021-10-07 02:29:16 +00:00
|
|
|
cy.wait("@deleteJSCollection").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2020-08-20 05:38:08 +00:00
|
|
|
Cypress.Commands.add("deleteDataSource", () => {
|
|
|
|
|
cy.hoverAndClick();
|
|
|
|
|
cy.get(apiwidget.delete).click({ force: true });
|
2022-03-23 05:33:06 +00:00
|
|
|
cy.get(apiwidget.deleteConfirm).click({ force: true });
|
2020-08-20 05:38:08 +00:00
|
|
|
cy.wait("@deleteDatasource").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2020-12-11 13:48:01 +00:00
|
|
|
Cypress.Commands.add("dragAndDropToCanvas", (widgetType, { x, y }) => {
|
2020-09-08 10:54:55 +00:00
|
|
|
const selector = `.t--widget-card-draggable-${widgetType}`;
|
2021-10-04 15:34:37 +00:00
|
|
|
cy.wait(500);
|
2020-09-08 10:54:55 +00:00
|
|
|
cy.get(selector)
|
2021-08-12 05:45:38 +00:00
|
|
|
.trigger("dragstart", { force: true })
|
2020-12-11 13:48:01 +00:00
|
|
|
.trigger("mousemove", x, y, { force: true });
|
2020-09-08 10:54:55 +00:00
|
|
|
cy.get(explorer.dropHere)
|
2021-08-12 05:45:38 +00:00
|
|
|
.trigger("mousemove", x, y, { eventConstructor: "MouseEvent" })
|
|
|
|
|
.trigger("mousemove", x, y, { eventConstructor: "MouseEvent" })
|
|
|
|
|
.trigger("mouseup", x, y, { eventConstructor: "MouseEvent" });
|
2020-09-08 10:54:55 +00:00
|
|
|
});
|
|
|
|
|
|
2021-08-26 15:24:37 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"dragAndDropToWidget",
|
|
|
|
|
(widgetType, destinationWidget, { x, y }) => {
|
|
|
|
|
const selector = `.t--widget-card-draggable-${widgetType}`;
|
2022-03-02 16:54:43 +00:00
|
|
|
cy.wait(800);
|
2021-08-26 15:24:37 +00:00
|
|
|
cy.get(selector)
|
2022-04-03 16:43:20 +00:00
|
|
|
.scrollIntoView()
|
2021-08-26 15:24:37 +00:00
|
|
|
.trigger("dragstart", { force: true })
|
|
|
|
|
.trigger("mousemove", x, y, { force: true });
|
|
|
|
|
const selector2 = `.t--draggable-${destinationWidget}`;
|
|
|
|
|
cy.get(selector2)
|
2022-04-03 16:43:20 +00:00
|
|
|
.scrollIntoView()
|
2021-08-26 15:24:37 +00:00
|
|
|
.trigger("mousemove", x, y, { eventConstructor: "MouseEvent" })
|
|
|
|
|
.trigger("mousemove", x, y, { eventConstructor: "MouseEvent" })
|
|
|
|
|
.trigger("mouseup", x, y, { eventConstructor: "MouseEvent" });
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2021-09-23 15:14:24 +00:00
|
|
|
Cypress.Commands.add("changeButtonColor", (buttonColor) => {
|
|
|
|
|
cy.get(widgetsPage.buttonColor)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.clear()
|
|
|
|
|
.type(buttonColor);
|
2021-06-15 10:19:30 +00:00
|
|
|
cy.PublishtheApp();
|
|
|
|
|
cy.get(widgetsPage.widgetBtn).should(
|
|
|
|
|
"have.css",
|
|
|
|
|
"background-color",
|
|
|
|
|
buttonColor,
|
|
|
|
|
);
|
|
|
|
|
cy.wait(1000);
|
|
|
|
|
});
|
|
|
|
|
|
2020-06-04 13:49:22 +00:00
|
|
|
Cypress.Commands.add("closePropertyPane", () => {
|
2021-11-23 08:01:46 +00:00
|
|
|
cy.get(commonlocators.canvas).click({ force: true });
|
2020-06-04 13:49:22 +00:00
|
|
|
});
|
|
|
|
|
|
2021-09-07 13:41:36 +00:00
|
|
|
Cypress.Commands.add("onClickActions", (forSuccess, forFailure, endp) => {
|
2021-06-15 10:19:30 +00:00
|
|
|
// Filling the messages for success/failure in the onClickAction of the button widget.
|
|
|
|
|
// For Success
|
2021-08-04 12:50:40 +00:00
|
|
|
cy.get(".code-highlight", { timeout: 10000 })
|
2021-06-15 10:19:30 +00:00
|
|
|
.children()
|
2021-10-11 05:08:08 +00:00
|
|
|
.contains("No action")
|
2021-06-15 10:19:30 +00:00
|
|
|
.first()
|
|
|
|
|
.click({ force: true })
|
2021-10-11 05:08:08 +00:00
|
|
|
.selectOnClickOption("Show message")
|
2021-09-07 13:41:36 +00:00
|
|
|
.get("div.t--property-control-" + endp + " div.CodeMirror-lines")
|
2021-06-15 10:19:30 +00:00
|
|
|
.click()
|
|
|
|
|
.type(forSuccess)
|
|
|
|
|
.get("button.t--open-dropdown-Select-type")
|
2021-08-26 10:52:45 +00:00
|
|
|
.first()
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.selectOnClickOption(forSuccess);
|
2021-06-15 10:19:30 +00:00
|
|
|
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
// For Failure
|
|
|
|
|
cy.get(".code-highlight")
|
|
|
|
|
.children()
|
2021-10-11 05:08:08 +00:00
|
|
|
.contains("No action")
|
2021-06-15 10:19:30 +00:00
|
|
|
.last()
|
|
|
|
|
.click({ force: true })
|
2021-10-11 05:08:08 +00:00
|
|
|
.selectOnClickOption("Show message")
|
2021-09-07 13:41:36 +00:00
|
|
|
.get("div.t--property-control-" + endp + " div.CodeMirror-lines")
|
2021-06-15 10:19:30 +00:00
|
|
|
.last()
|
|
|
|
|
.click()
|
|
|
|
|
.type(forFailure)
|
|
|
|
|
.get("button.t--open-dropdown-Select-type")
|
|
|
|
|
.last()
|
2021-08-26 10:52:45 +00:00
|
|
|
.click({ force: true })
|
|
|
|
|
.selectOnClickOption(forFailure);
|
2021-06-15 10:19:30 +00:00
|
|
|
});
|
2021-06-17 13:47:54 +00:00
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("isSelectRow", (index) => {
|
2021-11-26 10:47:53 +00:00
|
|
|
cy.get('.tbody .td[data-rowindex="' + index + '"][data-colindex="' + 0 + '"]')
|
|
|
|
|
.first()
|
|
|
|
|
.click({ force: true });
|
2022-04-03 16:43:20 +00:00
|
|
|
cy.wait(1000); //for selection to show!
|
2020-05-16 07:28:13 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-18 04:28:41 +00:00
|
|
|
Cypress.Commands.add("getDate", (date, dateFormate) => {
|
2021-08-25 14:01:04 +00:00
|
|
|
const eDate = dayjs()
|
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) => {
|
2021-08-25 14:01:04 +00:00
|
|
|
const expDate = dayjs()
|
2020-05-18 04:28:41 +00:00
|
|
|
.add(date, "days")
|
|
|
|
|
.format(dateFormate);
|
|
|
|
|
const sel = `.DayPicker-Day[aria-label=\"${expDate}\"]`;
|
|
|
|
|
cy.get(sel).click();
|
|
|
|
|
});
|
2020-05-18 05:34:49 +00:00
|
|
|
|
2021-01-04 10:16:08 +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
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("pageNoValidate", (index) => {
|
2020-05-16 07:28:13 +00:00
|
|
|
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");
|
|
|
|
|
});
|
|
|
|
|
|
2021-10-13 12:40:52 +00:00
|
|
|
Cypress.Commands.add("validateToolbarVisible", (widgetCss, toolbarCss) => {
|
2022-04-03 16:43:20 +00:00
|
|
|
cy.get(widgetCss + toolbarCss).should("exist");
|
2021-10-13 12:40:52 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("validateToolbarHidden", (widgetCss, toolbarCss) => {
|
2022-04-03 16:43:20 +00:00
|
|
|
cy.get(widgetCss + toolbarCss).should("not.exist");
|
2021-10-13 12:40:52 +00:00
|
|
|
});
|
|
|
|
|
|
2020-05-28 06:37:47 +00:00
|
|
|
Cypress.Commands.add("validateEnableWidget", (widgetCss, disableCss) => {
|
|
|
|
|
cy.get(widgetCss + disableCss).should("not.exist");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("validateHTMLText", (widgetCss, htmlTag, value) => {
|
2021-01-04 10:16:08 +00:00
|
|
|
cy.get(widgetCss + " iframe").then(($iframe) => {
|
2020-05-28 06:37:47 +00:00
|
|
|
const $body = $iframe.contents().find("body");
|
|
|
|
|
cy.wrap($body)
|
|
|
|
|
.find(htmlTag)
|
|
|
|
|
.should("have.text", value);
|
|
|
|
|
});
|
|
|
|
|
});
|
2022-01-18 18:54:34 +00:00
|
|
|
Cypress.Commands.add("setTinyMceContent", (tinyMceId, content) => {
|
|
|
|
|
cy.window().then((win) => {
|
|
|
|
|
const editor = win.tinymce.editors[tinyMceId];
|
|
|
|
|
editor.setContent(content);
|
|
|
|
|
});
|
|
|
|
|
});
|
2020-05-28 06:37:47 +00:00
|
|
|
|
2021-04-06 13:29:27 +00:00
|
|
|
Cypress.Commands.add("startRoutesForDatasource", () => {
|
|
|
|
|
cy.server();
|
|
|
|
|
cy.route("PUT", "/api/v1/datasources/*").as("saveDatasource");
|
|
|
|
|
cy.route("POST", "/api/v1/datasources/test").as("testDatasource");
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-27 11:21:11 +00:00
|
|
|
Cypress.Commands.add("startServerAndRoutes", () => {
|
2021-01-14 05:44:07 +00:00
|
|
|
//To update route with intercept after working on alias wrt wait and alias
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.server();
|
2022-05-11 06:13:28 +00:00
|
|
|
cy.route("PUT", "/api/v1/themes/applications/*").as("updateTheme");
|
2021-11-18 14:27:51 +00:00
|
|
|
cy.route("POST", "/api/v1/datasources/test").as("testDatasource");
|
2022-03-02 16:54:43 +00:00
|
|
|
cy.route("PUT", "/api/v1/datasources/*").as("saveDatasource");
|
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");
|
|
|
|
|
|
2021-11-02 06:34:43 +00:00
|
|
|
cy.route("GET", "/api/v1/datasources?organizationId=*").as("getDataSources");
|
2022-03-25 10:43:26 +00:00
|
|
|
cy.route("GET", "/api/v1/pages?*mode=EDIT").as("getPagesForCreateApp");
|
|
|
|
|
cy.route("GET", "/api/v1/pages?*mode=PUBLISHED").as("getPagesForViewApp");
|
[API breaking change : Automated Tests Will Fail] Page And Action Refactor (#549)
* Introduced new page which stores the published and unpublished pages as separate.
* Mid level commit to save the state.
* Parity of new page repository with old page repository (custom functions)
* WIP : Delete a page. This requires changes across application structure as well.
* Added publishedPages construct inside application to store the pages in the deployed view as well as isDefault so that the same changes (delete or isDefault) in unpublished view doesn't alter these fields for the published application
* Parity reached with PageService.
* Minor ActionService refactor to remove unnecessary code.
ApplicationPageService, LayoutActionService, LayoutService use the new page service to fetch the pages
Minor corrections in fetching the page from new page service in tests
* New save function which sets the PageDTO for unpublished page and then saves the new page into repository.
* Migration of page service functions to new page service functions across other services/tests/controller
* Finished migrating all the page service functions to the new page service functions
* Application Service Tests have been fixed.
* All the existing test cases are working now.
* Publish application implemented to store published pages as well. Added a basic test case to check that published pages is being set and that page's publishedPageDTO is being set accordingly.
* Minor TODOs added to add test cases for published application.
* A few tests to ascertain that published application page fields (deleted, isDefault) does not get changed when these statuses are changed for a page in edit mode.
* Added a new controller end point to fetch application in view mode.
* Added new endpoint for fetching an application in view mode on the client.
* Bug fix where get application in view mode API was not getting called.
* Fixed the get page names by application & archive pages which have been deleted in edit mode during publishing of application.
* During delete page, if a page was never published and it was deleted during edit, delete the entire page instead of just deleting the unpublished PageDTO
* Minor formatting.
* Non working client side code to fetch page list using view mode.
* revert unnecassary changes and streamlined view and edit actions
* Fix missed import
* Fixed a bug where if a page is not published, it should not be returned in view mode in list of page names api.
* Fixed update for a page which was not working in integration test.
* ActionDTO added.
* Solidified the new action structure.
* Migration added for NewAction index creation and NewAction per Action insertion in the database.
* Basic file structure added the new repository, custom repository, service, etc.
* Delete OldPage.java
* Repo functions added - TODO : Haven;t handled the published/edited views
* Helper functions added to convert Action to NewAction and vice-versa. Removed unused currentUserMono usage.
* Create & update action functionality added.
* Execute Action refactored. Removed dry run specific code.
* Repository migrated to handle new data structure. Execute action refactored to no longer support dry runs of actions.
* TODO added for special handling of change view of application to handle edge cases of pages/actions which either exist in published mode but don't exist in unpublished mode or vice versa.
* Migrated finding on load actions from spring repository to custom repository.
* In view mode, now actions are being fetched by application id directly instead of first fetching application and then using the page ids, fetching the actions. This reduces the db calls from 2 to 1 per fetch actions in view mode api call.
* Delete action and get all actions (used in edit mode on the client side) implemented.
* Updated CollectionService and ActionCollectionService to use the new action service instead of the old one.
* LayoutActionService refactored to now use the new service functions.
* ActionController now no longer used ActionService. The remaining service functions have been migrated to the new action service.
* Refactor across ACL code for addition/removal of policies during addition/removal of users to organization, making app public, refactor for services like policy utils, item service, etc.
* Removed the last of action repository and action service and replaced with new action repo and new action service.
* Compile and run time issues fixed. The server is coming up without any spring dependency errors.
* WIP in fixing fetching actions by page id.
* Finally!!! Fixed the fetch actions (both published and unpublished actions) by page id repository function.
* Fixed create action bug where null datasource in published actiondto (inside newly created action) leads to error.
* Fixed the execute action issues :
1. Removed the dry runs from the tests
2. Fixed the null pointer error in variable substituted action and datasource configurations.
* 1. Fixed the custom action repository field names.
2. Fixed the data structures used in ExamplesOrganizationClonerTests
* Fixed countByDatasourceId repository function which was querying the actions incorrectly.
* Fixed the clone example organization error where the id of the action was not getting updated in the page correctly. Yay!
* Fixed post merge compilation failure.
* Fixed more compilation time failures in ActionServiceTest
* Fixed failing test case for fetching actions in view mode.
* Minor changes to resolve merge changes and incorporate in the new refactored code.
* 1. Fixed compile time errors on Client code.
2. Fixed fetching of actions in view mode by application id. The repository function did not need name parameter. Removed the same.
* [Integration Testing Error Fix] : Added a new test case for refactor action name.
* Instead of fetching actions in the page, mistakenly used the base service which was fetching all the actions in the repository, barring none which led to the name refactor being blocked even though no action in the current page exists with the new proposed name,
* Added delete functionality to action service.
* Minor code cleanup
* Adding viewMode to action execution
* Replacing action with actionId.
* 1. Bug fix for deletion of unpublished action. In case of never published action, the entire action should be deleted. In case an action was published, only the unpublished action should be deleted.
2. In case of DB actions (external datasources), only the bare minimum fields should be stored inside the action (datasource id and datasource plugin id). The other fields should not be duplicated across code.
* Fixed yarn build compilation issues.
* Update app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ActionController.java
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
* Changed the API path for GET applications in view mode. Some minor code formatting.
* Incorporated review comments.
* Some more unnecessary code removed.
* Instead of returning Page, now the interface object between client and server for Pages is PageDTO
* Migrated Page and Action to PageDTO and ActionDTO
Fixed the compilation issues.
TODO : Fix the test compilation issues.
* Fixed compilation time issues with all the tests by migrating Page and Action to PageDTO and ActionDTO respectively
* Action Controller and Page Controller no longer extend Base Controller. All the required functions have now been implemented and no base line API end points are being re-used from the base.
* Test case fixes.
* Bug Fix : Updating an action was not updating execute on load. Fixed the data flow leading to the error.
* Deprecating Page and Action domain objects. This is to ensure no new code is written with these till we remove this old code.
* Cloned example applications are now published before returning. This is to ensure that the applications are in ready to view mode when the new user signs up.
* Added a function comment to expand on the usage of new param introduced.
* When cloning a page, new actions were not being stored. Added that. Also updated the clonePage test to assert that the actions are also cloned when the pages are cloned.
* Updated a Api call
* removed extra slash
Co-authored-by: Hetu Nandu <hetunandu@gmail.com>
Co-authored-by: Satbir Singh <satbir121@gmail.com>
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
Co-authored-by: nandan.anantharamu <nandan@thinkify.io>
2020-10-26 12:34:23 +00:00
|
|
|
|
2020-10-14 10:35:19 +00:00
|
|
|
cy.route("POST");
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.route("GET", "/api/v1/pages/*").as("getPage");
|
2021-11-02 06:34:43 +00:00
|
|
|
cy.route("GET", "/api/v1/applications/*/pages/*/edit").as("getAppPageEdit");
|
2020-05-27 11:21:11 +00:00
|
|
|
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",
|
|
|
|
|
);
|
2022-03-25 10:43:26 +00:00
|
|
|
cy.route("PUT", "/api/v1/pages/*").as("updatePage");
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.route("DELETE", "/api/v1/applications/*").as("deleteApp");
|
|
|
|
|
cy.route("DELETE", "/api/v1/pages/*").as("deletePage");
|
|
|
|
|
cy.route("POST", "/api/v1/datasources").as("createDatasource");
|
|
|
|
|
cy.route("DELETE", "/api/v1/datasources/*").as("deleteDatasource");
|
2020-09-29 04:17:25 +00:00
|
|
|
cy.route("GET", "/api/v1/datasources/*/structure?ignoreCache=*").as(
|
2020-09-21 09:11:42 +00:00
|
|
|
"getDatasourceStructure",
|
|
|
|
|
);
|
2021-08-20 06:57:01 +00:00
|
|
|
cy.route("PUT", "/api/v1/datasources/datasource-query/*").as(
|
|
|
|
|
"datasourceQuery",
|
|
|
|
|
);
|
2020-05-27 11:21:11 +00:00
|
|
|
|
2021-11-02 06:34:43 +00:00
|
|
|
cy.route("PUT", "/api/v1/pages/crud-page/*").as("replaceLayoutWithCRUDPage");
|
2021-07-29 08:13:10 +00:00
|
|
|
cy.route("POST", "/api/v1/pages/crud-page").as("generateCRUDPage");
|
|
|
|
|
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.route("GET", "/api/v1/organizations").as("organizations");
|
2020-08-28 18:51:16 +00:00
|
|
|
cy.route("GET", "/api/v1/organizations/*").as("getOrganisation");
|
|
|
|
|
|
2020-05-27 11:21:11 +00:00
|
|
|
cy.route("POST", "/api/v1/applications/publish/*").as("publishApp");
|
|
|
|
|
cy.route("PUT", "/api/v1/layouts/*/pages/*").as("updateLayout");
|
|
|
|
|
|
|
|
|
|
cy.route("POST", "/track/*").as("postTrack");
|
2020-10-15 11:38:55 +00:00
|
|
|
cy.route("PUT", "/api/v1/actions/executeOnLoad/*").as("setExecuteOnLoad");
|
2020-05-27 11:21:11 +00:00
|
|
|
|
|
|
|
|
cy.route("POST", "/api/v1/actions").as("createNewApi");
|
2021-11-02 06:34:43 +00:00
|
|
|
cy.route("POST", "/api/v1/import?type=CURL&pageId=*&name=*").as("curlImport");
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.route("DELETE", "/api/v1/actions/*").as("deleteAction");
|
2021-11-02 06:34:43 +00:00
|
|
|
cy.route("GET", "/api/v1/marketplace/providers?category=*&page=*&size=*").as(
|
|
|
|
|
"get3PProviders",
|
|
|
|
|
);
|
2020-05-27 11:21:11 +00:00
|
|
|
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("DELETE", "/api/v1/datasources/*").as("deleteDatasource");
|
|
|
|
|
cy.route("DELETE", "/api/v1/applications/*").as("deleteApplication");
|
2022-01-13 17:49:58 +00:00
|
|
|
cy.route("POST", "/api/v1/applications?orgId=*").as("createNewApplication");
|
2020-10-28 12:06:30 +00:00
|
|
|
cy.route("PUT", "/api/v1/applications/*").as("updateApplication");
|
2020-07-06 05:38:39 +00:00
|
|
|
cy.route("PUT", "/api/v1/actions/*").as("saveAction");
|
2020-10-29 13:53:10 +00:00
|
|
|
cy.route("PUT", "/api/v1/actions/move").as("moveAction");
|
2020-07-20 09:38:35 +00:00
|
|
|
|
|
|
|
|
cy.route("POST", "/api/v1/organizations").as("createOrg");
|
2021-11-02 06:34:43 +00:00
|
|
|
cy.route("POST", "api/v1/applications/import/*").as("importNewApplication");
|
2021-06-03 06:18:08 +00:00
|
|
|
cy.route("GET", "api/v1/applications/export/*").as("exportApplication");
|
2020-08-12 11:41:56 +00:00
|
|
|
cy.route("GET", "/api/v1/organizations/roles?organizationId=*").as(
|
|
|
|
|
"getRoles",
|
|
|
|
|
);
|
2022-04-03 16:43:20 +00:00
|
|
|
cy.route("GET", "/api/v1/users/me").as("getMe");
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
cy.route("POST", "/api/v1/pages").as("createPage");
|
2020-08-22 03:10:22 +00:00
|
|
|
cy.route("POST", "/api/v1/pages/clone/*").as("clonePage");
|
2022-03-28 18:30:05 +00:00
|
|
|
cy.route("POST", "/api/v1/applications/clone/*").as("cloneApp");
|
2020-10-12 12:43:35 +00:00
|
|
|
cy.route("PUT", "/api/v1/applications/*/changeAccess").as("changeAccess");
|
2020-10-28 05:39:28 +00:00
|
|
|
|
|
|
|
|
cy.route("PUT", "/api/v1/organizations/*").as("updateOrganization");
|
2020-11-02 14:36:41 +00:00
|
|
|
cy.route("GET", "/api/v1/pages/view/application/*").as("viewApp");
|
2022-05-04 09:45:57 +00:00
|
|
|
cy.route("GET", "/api/v1/pages/*/view?*").as("viewPage");
|
2020-12-14 06:20:44 +00:00
|
|
|
cy.route("POST", "/api/v1/organizations/*/logo").as("updateLogo");
|
|
|
|
|
cy.route("DELETE", "/api/v1/organizations/*/logo").as("deleteLogo");
|
2021-05-04 06:04:23 +00:00
|
|
|
cy.route("POST", "/api/v1/applications/*/fork/*").as("postForkAppOrg");
|
2021-11-02 06:34:43 +00:00
|
|
|
cy.route("PUT", "/api/v1/users/leaveOrganization/*").as("leaveOrgApiCall");
|
2021-12-20 05:58:01 +00:00
|
|
|
cy.route("DELETE", "api/v1/organizations/*").as("deleteOrgApiCall");
|
2021-08-06 09:17:02 +00:00
|
|
|
|
|
|
|
|
cy.route("POST", "/api/v1/comments/threads").as("createNewThread");
|
|
|
|
|
cy.route("POST", "/api/v1/comments?threadId=*").as("createNewComment");
|
2021-10-18 14:03:44 +00:00
|
|
|
|
|
|
|
|
cy.route("POST", "api/v1/git/connect/*").as("connectGitRepo");
|
|
|
|
|
cy.route("POST", "api/v1/git/commit/*").as("commit");
|
2022-04-04 07:57:34 +00:00
|
|
|
cy.route("POST", "/api/v1/git/import/*").as("importFromGit");
|
2022-04-14 03:02:57 +00:00
|
|
|
cy.route("POST", "/api/v1/git/merge/*").as("mergeBranch");
|
2021-11-02 06:34:43 +00:00
|
|
|
cy.route("PUT", "api/v1/collections/actions/refactor").as("renameJsAction");
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2021-11-02 06:34:43 +00:00
|
|
|
cy.route("POST", "/api/v1/collections/actions").as("createNewJSCollection");
|
|
|
|
|
cy.route("DELETE", "/api/v1/collections/actions/*").as("deleteJSCollection");
|
2021-11-18 14:27:51 +00:00
|
|
|
cy.route("POST", "/api/v1/pages/crud-page").as("replaceLayoutWithCRUDPage");
|
2021-12-02 05:20:44 +00:00
|
|
|
|
2021-10-29 09:10:30 +00:00
|
|
|
cy.intercept("POST", "/api/v1/users/super").as("createSuperUser");
|
2021-12-02 05:20:44 +00:00
|
|
|
cy.intercept("POST", "/api/v1/actions/execute").as("postExecute");
|
2021-12-16 14:17:16 +00:00
|
|
|
cy.intercept("GET", "/api/v1/admin/env").as("getEnvVariables");
|
2022-01-25 13:56:52 +00:00
|
|
|
|
|
|
|
|
cy.intercept("PUT", "/api/v1/layouts/refactor").as("updateWidgetName");
|
2022-01-06 15:06:17 +00:00
|
|
|
cy.intercept("GET", "/api/v1/organizations/*/members").as("getMembers");
|
2021-12-02 05:20:44 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("startErrorRoutes", () => {
|
|
|
|
|
cy.intercept("POST", "/api/v1/actions/execute", { statusCode: 500 }).as(
|
|
|
|
|
"postExecuteError",
|
|
|
|
|
);
|
2020-05-27 11:21:11 +00:00
|
|
|
});
|
|
|
|
|
|
2020-06-10 12:25:16 +00:00
|
|
|
Cypress.Commands.add("NavigateToPaginationTab", () => {
|
|
|
|
|
cy.get(ApiEditor.apiTab)
|
|
|
|
|
.contains("Pagination")
|
|
|
|
|
.click();
|
2021-02-11 12:54:00 +00:00
|
|
|
cy.xpath(apiwidget.paginationWithUrl).click({ force: true });
|
2020-06-10 12:25:16 +00:00
|
|
|
});
|
|
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("ValidateTableData", (value) => {
|
2020-09-08 13:04:51 +00:00
|
|
|
// cy.isSelectRow(0);
|
2021-01-04 10:16:08 +00:00
|
|
|
cy.readTabledata("0", "0").then((tabData) => {
|
2020-06-10 12:25:16 +00:00
|
|
|
const tableData = tabData;
|
2020-09-08 13:04:51 +00:00
|
|
|
expect(tableData).to.equal(value.toString());
|
2020-06-10 12:25:16 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("ValidatePublishTableData", (value) => {
|
2020-06-10 12:25:16 +00:00
|
|
|
cy.isSelectRow(0);
|
2021-01-04 10:16:08 +00:00
|
|
|
cy.readTabledataPublish("0", "0").then((tabData) => {
|
2020-06-10 12:25:16 +00:00
|
|
|
const tableData = tabData;
|
2020-08-18 10:30:36 +00:00
|
|
|
expect(tableData).to.equal(value);
|
2020-06-10 12:25:16 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
Cypress.Commands.add("ValidatePaginateResponseUrlData", (runTestCss) => {
|
2022-03-11 15:47:42 +00:00
|
|
|
cy.CheckAndUnfoldEntityItem("QUERIES/JS");
|
2022-01-29 07:26:19 +00:00
|
|
|
cy.get(".t--entity-name")
|
|
|
|
|
.contains("Api2")
|
|
|
|
|
.click({ force: true });
|
2020-06-10 12:25:16 +00:00
|
|
|
cy.NavigateToPaginationTab();
|
|
|
|
|
cy.RunAPI();
|
|
|
|
|
cy.get(ApiEditor.apiPaginationNextTest).click();
|
|
|
|
|
cy.wait("@postExecute");
|
2021-03-31 08:35:19 +00:00
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2021-02-11 12:54:00 +00:00
|
|
|
cy.wait(2000);
|
2020-06-10 12:25:16 +00:00
|
|
|
cy.get(runTestCss).click();
|
|
|
|
|
cy.wait("@postExecute");
|
2021-03-31 08:35:19 +00:00
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2021-02-11 12:54:00 +00:00
|
|
|
cy.wait(2000);
|
2020-06-10 12:25:16 +00:00
|
|
|
cy.get(ApiEditor.formActionButtons).should("be.visible");
|
|
|
|
|
cy.get(ApiEditor.ApiRunBtn).should("not.be.disabled");
|
|
|
|
|
cy.get(ApiEditor.responseBody)
|
2020-08-18 10:30:36 +00:00
|
|
|
.contains("name")
|
2020-06-10 12:25:16 +00:00
|
|
|
.siblings("span")
|
|
|
|
|
.invoke("text")
|
2021-01-04 10:16:08 +00:00
|
|
|
.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);
|
2022-01-29 07:26:19 +00:00
|
|
|
cy.get(".t--entity-name")
|
|
|
|
|
.contains("Table1")
|
|
|
|
|
.click({ force: true });
|
2020-06-10 12:25:16 +00:00
|
|
|
cy.isSelectRow(0);
|
2021-01-04 10:16:08 +00:00
|
|
|
cy.readTabledata("0", "1").then((tabData) => {
|
2020-08-18 10:30:36 +00:00
|
|
|
const tableData = tabData;
|
|
|
|
|
expect(`\"${tableData}\"`).to.equal(respBody);
|
|
|
|
|
});
|
2020-06-10 12:25:16 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("ValidatePaginationInputData", () => {
|
|
|
|
|
cy.isSelectRow(0);
|
2021-01-04 10:16:08 +00:00
|
|
|
cy.readTabledataPublish("0", "1").then((tabData) => {
|
2020-08-18 10:30:36 +00:00
|
|
|
const tableData = tabData;
|
|
|
|
|
expect(`\"${tableData}\"`).to.equal(localStorage.getItem("respBody"));
|
|
|
|
|
});
|
2020-06-10 12:25:16 +00:00
|
|
|
});
|
|
|
|
|
|
2020-08-07 06:56:47 +00:00
|
|
|
Cypress.Commands.add("assertPageSave", () => {
|
2022-01-06 15:06:17 +00:00
|
|
|
cy.get(commonlocators.saveStatusSuccess, { timeout: 40000 }).should("exist");
|
2020-08-07 06:56:47 +00:00
|
|
|
});
|
2021-05-18 11:47:43 +00:00
|
|
|
|
2021-07-08 07:04:47 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"validateCodeEditorContent",
|
|
|
|
|
(selector, contentToValidate) => {
|
|
|
|
|
cy.get(selector).within(() => {
|
|
|
|
|
cy.get(".CodeMirror-code").should("have.text", contentToValidate);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
2021-07-29 08:13:10 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("skipGenerateCRUDPage", () => {
|
|
|
|
|
cy.get(generatePage.buildFromScratchActionCard).click();
|
|
|
|
|
});
|
2021-08-20 06:57:01 +00:00
|
|
|
|
2022-01-07 09:57:45 +00:00
|
|
|
Cypress.Commands.add("updateMapType", (mapType) => {
|
|
|
|
|
// Command to change the map chart type if the property pane of the map chart widget is opened.
|
|
|
|
|
cy.get(viewWidgetsPage.mapType)
|
|
|
|
|
.last()
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.get(commonlocators.dropdownmenu)
|
|
|
|
|
.children()
|
|
|
|
|
.contains(mapType)
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
|
|
|
|
|
cy.get(viewWidgetsPage.mapType + " span.cs-text").should(
|
|
|
|
|
"have.text",
|
|
|
|
|
mapType,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2021-10-07 02:29:16 +00:00
|
|
|
Cypress.Commands.add("createJSObject", (JSCode) => {
|
|
|
|
|
cy.NavigateToJSEditor();
|
|
|
|
|
cy.wait(1000);
|
|
|
|
|
cy.get(".CodeMirror textarea")
|
|
|
|
|
.first()
|
|
|
|
|
.focus()
|
2021-10-26 12:53:58 +00:00
|
|
|
.type("{downarrow}{downarrow}{downarrow}{downarrow} ")
|
2021-10-07 02:29:16 +00:00
|
|
|
.type(JSCode);
|
|
|
|
|
cy.wait(1000);
|
2021-10-26 12:53:58 +00:00
|
|
|
cy.get(jsEditorLocators.runButton)
|
|
|
|
|
.first()
|
|
|
|
|
.click();
|
2021-10-07 02:29:16 +00:00
|
|
|
});
|
2021-10-29 07:02:45 +00:00
|
|
|
|
2021-11-18 14:27:51 +00:00
|
|
|
Cypress.Commands.add("createSuperUser", () => {
|
2021-11-26 10:47:53 +00:00
|
|
|
cy.wait(1000);
|
2021-11-18 14:27:51 +00:00
|
|
|
cy.get(welcomePage.getStarted).should("be.visible");
|
|
|
|
|
cy.get(welcomePage.getStarted).should("not.be.disabled");
|
|
|
|
|
cy.get(welcomePage.getStarted).click();
|
|
|
|
|
cy.get(welcomePage.fullName).should("be.visible");
|
|
|
|
|
cy.get(welcomePage.email).should("be.visible");
|
|
|
|
|
cy.get(welcomePage.password).should("be.visible");
|
|
|
|
|
cy.get(welcomePage.verifyPassword).should("be.visible");
|
|
|
|
|
cy.get(welcomePage.roleDropdown).should("be.visible");
|
|
|
|
|
cy.get(welcomePage.useCaseDropdown).should("be.visible");
|
|
|
|
|
cy.get(welcomePage.nextButton).should("be.disabled");
|
|
|
|
|
|
|
|
|
|
cy.get(welcomePage.fullName).type(Cypress.env("USERNAME"));
|
|
|
|
|
cy.get(welcomePage.nextButton).should("be.disabled");
|
|
|
|
|
cy.get(welcomePage.email).type(Cypress.env("USERNAME"));
|
|
|
|
|
cy.get(welcomePage.nextButton).should("be.disabled");
|
|
|
|
|
cy.get(welcomePage.password).type(Cypress.env("PASSWORD"));
|
|
|
|
|
cy.get(welcomePage.nextButton).should("be.disabled");
|
|
|
|
|
cy.get(welcomePage.verifyPassword).type(Cypress.env("PASSWORD"));
|
|
|
|
|
cy.get(welcomePage.nextButton).should("be.disabled");
|
|
|
|
|
cy.get(welcomePage.roleDropdown).click();
|
|
|
|
|
cy.get(welcomePage.roleDropdownOption)
|
|
|
|
|
.eq(1)
|
|
|
|
|
.click();
|
|
|
|
|
cy.get(welcomePage.nextButton).should("be.disabled");
|
|
|
|
|
cy.get(welcomePage.useCaseDropdown).click();
|
|
|
|
|
cy.get(welcomePage.useCaseDropdownOption)
|
|
|
|
|
.eq(1)
|
|
|
|
|
.click();
|
|
|
|
|
cy.get(welcomePage.nextButton).should("not.be.disabled");
|
|
|
|
|
cy.get(welcomePage.nextButton).click();
|
|
|
|
|
cy.get(welcomePage.newsLetter).should("be.visible");
|
|
|
|
|
cy.get(welcomePage.dataCollection).should("be.visible");
|
2021-12-03 18:29:17 +00:00
|
|
|
cy.get(welcomePage.dataCollection)
|
|
|
|
|
.trigger("mouseover")
|
|
|
|
|
.click();
|
|
|
|
|
cy.get(welcomePage.newsLetter)
|
|
|
|
|
.trigger("mouseover")
|
|
|
|
|
.click();
|
2021-11-18 14:27:51 +00:00
|
|
|
cy.get(welcomePage.createButton).should("be.visible");
|
|
|
|
|
cy.get(welcomePage.createButton).click();
|
2021-12-03 18:29:17 +00:00
|
|
|
cy.wait("@createSuperUser").then((interception) => {
|
|
|
|
|
expect(interception.request.body).not.contains(
|
|
|
|
|
"allowCollectingAnonymousData=true",
|
|
|
|
|
);
|
|
|
|
|
expect(interception.request.body).not.contains("signupForNewsletter=true");
|
|
|
|
|
});
|
2021-11-18 14:27:51 +00:00
|
|
|
cy.LogOut();
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("SignupFromAPI", (uname, pword) => {
|
|
|
|
|
cy.request({
|
|
|
|
|
method: "POST",
|
|
|
|
|
url: "api/v1/users",
|
|
|
|
|
headers: {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
},
|
|
|
|
|
followRedirect: false,
|
|
|
|
|
form: true,
|
|
|
|
|
body: {
|
|
|
|
|
name: uname,
|
|
|
|
|
email: uname,
|
|
|
|
|
password: pword,
|
|
|
|
|
},
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
expect(response.status).equal(302);
|
|
|
|
|
cy.log(response.body);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//Generate CRUD page methods: <Aishwarya>
|
2021-10-29 07:02:45 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("startInterceptRoutesForMySQL", () => {
|
2021-11-18 14:27:51 +00:00
|
|
|
//All stubbing - updating app id to current app id for Delete app by api call to be successfull:
|
|
|
|
|
|
|
|
|
|
cy.replaceApplicationIdForInterceptPages(
|
|
|
|
|
"cypress/fixtures/mySQL_PUT_replaceLayoutWithCRUD.json",
|
|
|
|
|
);
|
|
|
|
|
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("POST", "/api/v1/datasources/test", {
|
|
|
|
|
fixture: "testAction.json",
|
|
|
|
|
}).as("testDatasource");
|
|
|
|
|
cy.intercept("GET", "/api/v1/datasources/*/structure?ignoreCache=*", {
|
|
|
|
|
fixture: "mySQL_GET_selectTableDropdown.json",
|
2021-11-18 14:27:51 +00:00
|
|
|
}).as("getDatasourceStructure");
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("PUT", "/api/v1/pages/crud-page/*", {
|
|
|
|
|
fixture: "mySQL_PUT_replaceLayoutWithCRUD.json",
|
2021-11-18 14:27:51 +00:00
|
|
|
}).as("replaceLayoutWithCRUDPage");
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("GET", "/api/v1/actions*", {
|
|
|
|
|
fixture: "mySQL_GET_Actions.json",
|
2021-11-18 14:27:51 +00:00
|
|
|
}).as("getActions");
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("POST", "/api/v1/actions/execute", {
|
|
|
|
|
fixture: "mySQL_POST_Execute.json",
|
2021-11-18 14:27:51 +00:00
|
|
|
}).as("postExecute");
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("POST", "/api/v1/pages/crud-page", {
|
|
|
|
|
fixture: "mySQL_PUT_replaceLayoutWithCRUD.json",
|
2021-11-18 14:27:51 +00:00
|
|
|
}).as("replaceLayoutWithCRUDPage");
|
2021-10-29 07:02:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("startInterceptRoutesForMongo", () => {
|
|
|
|
|
//All stubbing
|
2021-11-18 14:27:51 +00:00
|
|
|
cy.replaceApplicationIdForInterceptPages(
|
|
|
|
|
"cypress/fixtures/mongo_PUT_replaceLayoutWithCRUD.json",
|
|
|
|
|
);
|
|
|
|
|
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("POST", "/api/v1/datasources/test", {
|
|
|
|
|
fixture: "testAction.json",
|
|
|
|
|
}).as("testDatasource");
|
|
|
|
|
cy.intercept("GET", "/api/v1/datasources/*/structure?ignoreCache=*", {
|
|
|
|
|
fixture: "mongo_GET_selectTableDropdown.json",
|
2021-11-18 14:27:51 +00:00
|
|
|
}).as("getDatasourceStructure");
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("PUT", "/api/v1/pages/crud-page/*", {
|
|
|
|
|
fixture: "mongo_PUT_replaceLayoutWithCRUD.json",
|
2021-11-18 14:27:51 +00:00
|
|
|
}).as("replaceLayoutWithCRUDPage");
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("GET", "/api/v1/actions*", {
|
|
|
|
|
fixture: "mongo_GET_Actions.json",
|
2021-11-18 14:27:51 +00:00
|
|
|
}).as("getActions");
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("POST", "/api/v1/actions/execute", {
|
|
|
|
|
fixture: "mongo_POST_Actions.json",
|
2021-11-18 14:27:51 +00:00
|
|
|
}).as("postExecute");
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("POST", "/api/v1/pages/crud-page", {
|
|
|
|
|
fixture: "mongo_PUT_replaceLayoutWithCRUD.json",
|
|
|
|
|
}).as("post_replaceLayoutCRUDStub");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("startInterceptRoutesForS3", () => {
|
|
|
|
|
cy.intercept("POST", "/api/v1/datasources/test").as("testDatasource");
|
|
|
|
|
cy.intercept("PUT", "/api/v1/datasources/datasource-query/*").as(
|
|
|
|
|
"put_datasources",
|
|
|
|
|
);
|
2022-01-13 06:03:50 +00:00
|
|
|
cy.intercept("GET", "/api/v1/datasources/*/structure?ignoreCache=*").as(
|
|
|
|
|
"getDatasourceStructure",
|
|
|
|
|
);
|
2021-10-29 07:02:45 +00:00
|
|
|
cy.intercept("PUT", "/api/v1/pages/crud-page/*").as("put_replaceLayoutCRUD");
|
|
|
|
|
cy.intercept("POST", "/api/v1/pages/crud-page").as("post_replaceLayoutCRUD");
|
|
|
|
|
cy.intercept("GET", "/api/v1/actions*").as("get_Actions");
|
|
|
|
|
cy.intercept("POST", "/api/v1/actions/execute").as("post_Execute");
|
|
|
|
|
});
|
|
|
|
|
|
2021-11-18 14:27:51 +00:00
|
|
|
Cypress.Commands.add("replaceApplicationIdForInterceptPages", (fixtureFile) => {
|
|
|
|
|
let currentAppId, currentURL;
|
|
|
|
|
cy.readFile(fixtureFile, (err, data) => {
|
|
|
|
|
if (err) {
|
|
|
|
|
return console.error(err);
|
|
|
|
|
}
|
|
|
|
|
}).then((data) => {
|
|
|
|
|
cy.url().then((url) => {
|
|
|
|
|
currentURL = url;
|
|
|
|
|
const myRegexp = /applications(.*)/;
|
|
|
|
|
const match = myRegexp.exec(currentURL);
|
|
|
|
|
cy.log(currentURL + "currentURL from intercept is");
|
|
|
|
|
currentAppId = match ? match[1].split("/")[1] : null;
|
|
|
|
|
data.data.page.applicationId = currentAppId;
|
|
|
|
|
cy.writeFile(fixtureFile, JSON.stringify(data));
|
|
|
|
|
});
|
2021-10-29 09:10:30 +00:00
|
|
|
});
|
|
|
|
|
});
|
2021-11-18 14:27:51 +00:00
|
|
|
|
2022-02-25 06:13:16 +00:00
|
|
|
Cypress.Commands.add("skipCommentsOnboarding", () => {
|
|
|
|
|
cy.get(commonLocators.canvas);
|
|
|
|
|
cy.get(commentsLocators.switchToCommentModeBtn).click({ force: true });
|
|
|
|
|
cy.contains("SKIP").click({ force: true });
|
|
|
|
|
cy.get("input[name='displayName']").type("Skip User");
|
|
|
|
|
cy.get("button[type='submit']").click();
|
|
|
|
|
});
|
|
|
|
|
|
2021-11-18 14:27:51 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"paste",
|
|
|
|
|
{ prevSubject: true },
|
|
|
|
|
(selector, pastePayload) => {
|
|
|
|
|
cy.wrap(selector).then(($destination) => {
|
|
|
|
|
const pasteEvent = Object.assign(
|
|
|
|
|
new Event("paste", { bubbles: true, cancelable: true }),
|
|
|
|
|
{
|
|
|
|
|
clipboardData: {
|
|
|
|
|
getData: () => pastePayload,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
$destination[0].dispatchEvent(pasteEvent);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
2021-11-26 10:47:53 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("typeValueNValidate", (valueToType, fieldName = "") => {
|
|
|
|
|
if (fieldName) {
|
2021-12-27 12:04:45 +00:00
|
|
|
cy.xpath(
|
|
|
|
|
"//p[text()='" + fieldName + "']/parent::label/following-sibling::div",
|
|
|
|
|
).then(($field) => {
|
|
|
|
|
cy.updateCodeInput($field, valueToType);
|
|
|
|
|
});
|
2021-11-26 10:47:53 +00:00
|
|
|
} else {
|
|
|
|
|
cy.xpath("//div[@class='CodeEditorTarget']").then(($field) => {
|
|
|
|
|
cy.updateCodeInput($field, valueToType);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
cy.EvaluateCurrentValue(valueToType);
|
|
|
|
|
// cy.xpath("//p[text()='" + fieldName + "']/following-sibling::div//div[@class='CodeMirror-code']//span/span").should((fieldValue) => {
|
|
|
|
|
// textF = fieldValue.innerText
|
|
|
|
|
// fieldValue.innerText = ""
|
|
|
|
|
// }).then(() => {
|
|
|
|
|
// cy.log("current field value is : '" + textF + "'")
|
|
|
|
|
// })
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("clickButton", (btnVisibleText) => {
|
2021-12-29 05:41:30 +00:00
|
|
|
cy.xpath("//span[text()='" + btnVisibleText + "']/parent::button")
|
2022-01-29 07:26:19 +00:00
|
|
|
.first()
|
2021-12-29 05:41:30 +00:00
|
|
|
.scrollIntoView()
|
|
|
|
|
.click({ force: true });
|
2021-11-26 10:47:53 +00:00
|
|
|
});
|
|
|
|
|
|
2021-12-29 05:41:30 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"actionContextMenuByEntityName",
|
2022-03-23 05:33:06 +00:00
|
|
|
(entityNameinLeftSidebar, action = "Delete", subAction) => {
|
2022-01-06 15:06:17 +00:00
|
|
|
cy.wait(2000);
|
2022-03-13 17:21:04 +00:00
|
|
|
// cy.get(
|
|
|
|
|
// commonlocators.entitySearchResult
|
|
|
|
|
// .concat(entityNameinLeftSidebar)
|
|
|
|
|
// .concat("')"),
|
|
|
|
|
// )
|
|
|
|
|
// .parents(commonlocators.entityItem)
|
|
|
|
|
// .first()
|
|
|
|
|
// .trigger("mouseover")
|
|
|
|
|
// .find(commonlocators.entityContextMenu)
|
|
|
|
|
// .last()
|
|
|
|
|
// .click({ force: true });
|
|
|
|
|
|
|
|
|
|
cy.xpath(
|
|
|
|
|
"//div[text()='" +
|
|
|
|
|
entityNameinLeftSidebar +
|
|
|
|
|
"']/ancestor::div[1]/following-sibling::div//div[contains(@class, 'entity-context-menu-icon')]",
|
2021-12-29 05:41:30 +00:00
|
|
|
)
|
2022-01-29 07:26:19 +00:00
|
|
|
.last()
|
2021-12-29 05:41:30 +00:00
|
|
|
.click({ force: true });
|
2021-11-26 10:47:53 +00:00
|
|
|
|
2021-12-29 05:41:30 +00:00
|
|
|
cy.xpath(
|
|
|
|
|
"//div[text()='" +
|
|
|
|
|
action +
|
2022-03-19 15:56:53 +00:00
|
|
|
"']/ancestor::a[contains(@class, 'single-select')]",
|
2021-12-29 05:41:30 +00:00
|
|
|
)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.wait(500);
|
2021-12-02 05:20:44 +00:00
|
|
|
|
2022-03-23 05:33:06 +00:00
|
|
|
if (subAction) {
|
|
|
|
|
cy.xpath(
|
|
|
|
|
"//div[text()='" +
|
|
|
|
|
subAction +
|
|
|
|
|
"']/parent::a[contains(@class, 'single-select')]",
|
|
|
|
|
)
|
|
|
|
|
.click({ force: true })
|
|
|
|
|
.wait(500);
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-05 05:41:15 +00:00
|
|
|
if (action === "Delete")
|
2021-12-29 05:41:30 +00:00
|
|
|
cy.xpath("//div[text()='" + entityNameinLeftSidebar + "']").should(
|
|
|
|
|
"not.exist",
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
2021-12-02 05:20:44 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("selectEntityByName", (entityNameinLeftSidebar) => {
|
|
|
|
|
cy.xpath(
|
|
|
|
|
"//div[contains(@class, 't--entity-name')][text()='" +
|
2021-12-03 06:24:08 +00:00
|
|
|
entityNameinLeftSidebar +
|
|
|
|
|
"']",
|
2021-12-02 05:20:44 +00:00
|
|
|
)
|
2021-12-21 09:37:30 +00:00
|
|
|
.last()
|
2021-12-02 05:20:44 +00:00
|
|
|
.click({ force: true })
|
|
|
|
|
.wait(2000);
|
2021-11-26 10:47:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"EvaluatFieldValue",
|
|
|
|
|
(fieldName = "", currentValue = "") => {
|
|
|
|
|
let toValidate = false;
|
|
|
|
|
if (currentValue) toValidate = true;
|
|
|
|
|
if (fieldName) {
|
|
|
|
|
cy.xpath(
|
|
|
|
|
"//p[text()='" +
|
2021-12-03 06:24:08 +00:00
|
|
|
fieldName +
|
2021-12-27 12:04:45 +00:00
|
|
|
"']/parent::label/following-sibling::div//div[@class='CodeMirror-code']",
|
2021-11-26 10:47:53 +00:00
|
|
|
).click();
|
|
|
|
|
} else {
|
2022-03-30 13:12:15 +00:00
|
|
|
cy.xpath("//div[@class='CodeMirror-code']")
|
|
|
|
|
.first()
|
|
|
|
|
.click();
|
2021-11-26 10:47:53 +00:00
|
|
|
}
|
2021-12-29 05:41:30 +00:00
|
|
|
cy.wait(3000); //Increasing wait time to evaluate non-undefined values
|
2021-11-26 10:47:53 +00:00
|
|
|
const val = cy
|
|
|
|
|
.get(commonlocators.evaluatedCurrentValue)
|
|
|
|
|
.first()
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.invoke("text");
|
|
|
|
|
if (toValidate) expect(val).to.eq(currentValue);
|
|
|
|
|
return val;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2022-03-19 15:56:53 +00:00
|
|
|
// Cypress >=8.3.x onwards
|
2021-12-03 06:24:08 +00:00
|
|
|
cy.all = function(...commands) {
|
2021-11-26 10:47:53 +00:00
|
|
|
const _ = Cypress._;
|
2022-03-19 15:56:53 +00:00
|
|
|
// eslint-disable-next-line
|
2021-11-26 10:47:53 +00:00
|
|
|
const chain = cy.wrap(null, { log: false });
|
2022-03-19 15:56:53 +00:00
|
|
|
const stopCommand = _.find(cy.queue.get(), {
|
2021-11-26 10:47:53 +00:00
|
|
|
attributes: { chainerId: chain.chainerId },
|
|
|
|
|
});
|
2022-03-19 15:56:53 +00:00
|
|
|
const startCommand = _.find(cy.queue.get(), {
|
2021-11-26 10:47:53 +00:00
|
|
|
attributes: { chainerId: commands[0].chainerId },
|
|
|
|
|
});
|
|
|
|
|
const p = chain.then(() => {
|
|
|
|
|
return _(commands)
|
|
|
|
|
.map((cmd) => {
|
|
|
|
|
return cmd[chainStart]
|
|
|
|
|
? cmd[chainStart].attributes
|
2022-03-19 15:56:53 +00:00
|
|
|
: _.find(cy.queue.get(), {
|
2021-12-03 06:24:08 +00:00
|
|
|
attributes: { chainerId: cmd.chainerId },
|
|
|
|
|
}).attributes;
|
2021-11-26 10:47:53 +00:00
|
|
|
})
|
|
|
|
|
.concat(stopCommand.attributes)
|
|
|
|
|
.slice(1)
|
|
|
|
|
.flatMap((cmd) => {
|
|
|
|
|
return cmd.prev.get("subject");
|
|
|
|
|
})
|
|
|
|
|
.value();
|
|
|
|
|
});
|
|
|
|
|
p[chainStart] = startCommand;
|
|
|
|
|
return p;
|
|
|
|
|
};
|
|
|
|
|
|
2021-12-02 05:20:44 +00:00
|
|
|
Cypress.Commands.add("renameWithInPane", (renameVal) => {
|
|
|
|
|
cy.get(apiwidget.ApiName).click({ force: true });
|
|
|
|
|
cy.get(apiwidget.apiTxt)
|
|
|
|
|
.clear()
|
|
|
|
|
.type(renameVal, { force: true })
|
|
|
|
|
.should("have.value", renameVal)
|
|
|
|
|
.blur();
|
|
|
|
|
});
|
|
|
|
|
|
2021-12-10 07:23:12 +00:00
|
|
|
Cypress.Commands.add("getEntityName", () => {
|
2021-12-13 05:44:01 +00:00
|
|
|
let entityName = cy.get(apiwidget.ApiName).invoke("text");
|
2021-12-10 07:23:12 +00:00
|
|
|
return entityName;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("VerifyErrorMsgAbsence", (errorMsgToVerifyAbsence) => {
|
2021-12-02 05:20:44 +00:00
|
|
|
// Give this element 10 seconds to appear
|
2021-12-21 09:37:30 +00:00
|
|
|
//cy.wait(10000)
|
2021-12-13 05:44:01 +00:00
|
|
|
cy.xpath(
|
|
|
|
|
"//div[@class='Toastify']//span[contains(text(),'" +
|
|
|
|
|
errorMsgToVerifyAbsence +
|
|
|
|
|
"')]",
|
|
|
|
|
{ timeout: 0 },
|
|
|
|
|
).should("not.exist");
|
2021-12-10 07:23:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("setQueryTimeout", (timeout) => {
|
|
|
|
|
cy.get(queryLocators.settings).click();
|
|
|
|
|
cy.xpath(queryLocators.queryTimeout)
|
|
|
|
|
.clear()
|
|
|
|
|
.type(timeout);
|
|
|
|
|
|
|
|
|
|
cy.get(queryLocators.query).click();
|
2021-12-02 05:20:44 +00:00
|
|
|
});
|
|
|
|
|
|
2022-02-24 03:11:35 +00:00
|
|
|
//Usage: If in need to type {enter} {esc} etc then .text('sometext').type('{enter}')
|
|
|
|
|
Cypress.Commands.add("text", { prevSubject: true }, (subject, text) => {
|
|
|
|
|
subject.val(text);
|
|
|
|
|
return cy.wrap(subject);
|
|
|
|
|
});
|
|
|
|
|
|
2021-12-21 09:37:30 +00:00
|
|
|
//Not Used!
|
|
|
|
|
Cypress.Commands.add("VerifyNoDataDisplayAbsence", () => {
|
|
|
|
|
cy.xpath("//div[text()='No data to display']", { timeout: 0 }).should(
|
|
|
|
|
"not.exist",
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Cypress.Commands.add('isNotInViewport', element => {
|
|
|
|
|
// cy.xpath(element).then($el => {
|
|
|
|
|
// const bottom = Cypress.$(cy.state('window')).height()
|
|
|
|
|
// const rect = $el[0].getBoundingClientRect()
|
|
|
|
|
|
|
|
|
|
// expect(rect.top).to.be.greaterThan(bottom)
|
|
|
|
|
// expect(rect.bottom).to.be.greaterThan(bottom)
|
|
|
|
|
// expect(rect.top).to.be.greaterThan(bottom)
|
|
|
|
|
// expect(rect.bottom).to.be.greaterThan(bottom)
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("isNotInViewport", (element) => {
|
|
|
|
|
cy.xpath(element).should(($el) => {
|
|
|
|
|
const bottom = Cypress.$(cy.state("window")).height();
|
|
|
|
|
const right = Cypress.$(cy.state("window")).width();
|
|
|
|
|
const rect = $el[0].getBoundingClientRect();
|
|
|
|
|
|
|
|
|
|
expect(rect).to.satisfy(
|
|
|
|
|
(rect) =>
|
|
|
|
|
rect.top < 0 || rect.top > bottom || rect.left < 0 || rect.left > right,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("isInViewport", (element) => {
|
|
|
|
|
cy.xpath(element).then(($el) => {
|
|
|
|
|
const bottom = Cypress.$(cy.state("window")).height();
|
|
|
|
|
const rect = $el[0].getBoundingClientRect();
|
|
|
|
|
|
|
|
|
|
expect(rect.top).not.to.be.greaterThan(bottom);
|
|
|
|
|
expect(rect.bottom).not.to.be.greaterThan(bottom);
|
|
|
|
|
expect(rect.top).not.to.be.greaterThan(bottom);
|
|
|
|
|
expect(rect.bottom).not.to.be.greaterThan(bottom);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2022-02-10 11:36:18 +00:00
|
|
|
Cypress.Commands.add("validateEvaluatedValue", (value) => {
|
|
|
|
|
cy.get(".t-property-evaluated-value").should("contain", value);
|
|
|
|
|
});
|
|
|
|
|
|
2022-03-11 15:47:42 +00:00
|
|
|
Cypress.Commands.add("CheckAndUnfoldEntityItem", (item) => {
|
|
|
|
|
cy.xpath("//div[contains(@class, 't--entity-name')][text()='" + item + "']")
|
|
|
|
|
.parents(commonlocators.entityItem)
|
|
|
|
|
.first()
|
|
|
|
|
.children(commonlocators.entityCollapseToggle)
|
|
|
|
|
.invoke("attr", "name")
|
|
|
|
|
.then((name) => {
|
|
|
|
|
if (name === "arrow-right") {
|
|
|
|
|
cy.xpath(
|
|
|
|
|
"//div[contains(@class, 't--entity-name')][text()='" + item + "']",
|
|
|
|
|
)
|
|
|
|
|
.parents(commonlocators.entityItem)
|
|
|
|
|
.first()
|
|
|
|
|
.children(commonlocators.entityCollapseToggle)
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2021-11-26 10:47:53 +00:00
|
|
|
// Cypress.Commands.overwrite("type", (originalFn, element, text, options) => {
|
|
|
|
|
// const clearedText = '{selectall}{backspace}'+`${text}`;
|
|
|
|
|
// return originalFn(element, clearedText, options);
|
|
|
|
|
// });
|
2022-04-12 10:01:22 +00:00
|
|
|
|
2021-12-24 12:17:22 +00:00
|
|
|
addMatchImageSnapshotCommand({
|
2022-01-12 04:46:20 +00:00
|
|
|
failureThreshold: 0.1, // threshold for entire image
|
2021-12-24 12:17:22 +00:00
|
|
|
failureThresholdType: "percent",
|
|
|
|
|
});
|
2022-03-11 15:47:42 +00:00
|
|
|
|
|
|
|
|
Cypress.Commands.add("DeleteEntityStateLocalStorage", () => {
|
|
|
|
|
let currentURL;
|
|
|
|
|
let appId;
|
|
|
|
|
cy.url().then((url) => {
|
|
|
|
|
currentURL = url;
|
|
|
|
|
const myRegexp = /applications(.*)/;
|
|
|
|
|
const match = myRegexp.exec(currentURL);
|
|
|
|
|
appId = match ? match[1].split("/")[1] : null;
|
|
|
|
|
|
|
|
|
|
if (appId !== null) {
|
|
|
|
|
window.localStorage.removeItem(`explorerState_${appId}`);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2022-04-12 10:01:22 +00:00
|
|
|
|
feat: Controls for labels in widgets to align the widgets in forms and other places (#10600)
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Create a new property control for a label position
-- Create a new property control for a label alignment
-- Prototype a label section for Input widget
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Add a property, labelWidth in the property pane
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Input widget: Implement all the requirements in case its type is Text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adapt the functionalty on other types of the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into DropdownWidget
-- Clean up for the input widget and DRY
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectWidget
-- Eliminate unnecessary component prop, columns
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalties into Tree Select widget
-- Add styles for alignment between lable and input control over the widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectTreeWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Introduce label functionalities into DatePickerWidget2
-- Use width instead of columns prop in InputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RichTextEditorWidget
-- Eliminate compactMode from StyledLabel
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into CheckboxGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement switch group for the correct meaning of right alignment
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RadioGroupWidget
-- Add new properties, alignment and inline for consistency
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adjust cols and rows for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused StyledRadioProps
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete first MVP of enhanced SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete the first MVP of enhanced RadioGroupWidget
-- Eliminate unused StyledSwitch component for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add min-height, align-self rules for LabelContainer
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Use original label property for RadioGroupWidget
-- Add a migration for adding isInline and alignment properties for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Update version to latest one in DSLMigrationsUtils.test.ts
* fix failing jest test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement label functionalities on BaseInputWidget, InputWidgetV2, CurrencyInputWidget, PhoneInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DSLMigrationsUtils
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the label related test case which is failed in Input_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on #10119: The label text truncates on resizing the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix scroll issue when shrink with MultiSelectWidget and MultiSelectTreeWidget
* fix: Widget Popup test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement width and alginment features on the level of label element
-- Prevent actual inputs from DropdownWidget, MultiSelectWidget, SingleSelectTreeWidget, MultiSelectTreeWidget from overflow when resizing
-- Enable label feature on a RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set label container's default width to 33% when width is not set
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix crash issue when labelWidth is filled by non-numeric value, eliminating passing NaN as its value
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set flex-grow to zero on input types other than TEXT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label features on newly created MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate LabelPositionTypes, directly using enum LabelPosition
-- Add a comment for a constant LABEL_MAX_WIDTH_RATE
-- Directly import React for LabelAlignmentOptionsControl
-- Remove unnecessary constructor for LabelAlignmentOptionsControl
-- Define handleAlign instance method as a higher-order function
-- Only migrate alignment property for RadioGroupWidget
-- Use Object.hasOwnProperty instead of in operator
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Migrate alignment property of RadioGroupWidget in case of currentDSL.version is 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Revert currentDSL.version to 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a Jest test case for RadioGroupWidget's alignment property migration
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Replace all nested ternary operators with if statements
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label feature on new version of SelectWidget
-- Add Cypress tests for widgets' label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor code for BaseInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change CSS selector for step buttons for Numeric BaseInputWidget
-- Directly use migrateRadioGroupAlignmentProperty migration function without using transformDSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on typo about migrateRadioGroupAlignmentProperty
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add data-testid attributes for Cypress selectors
* feat: Deprecate form button widget
-- Assert flex-direction to row in CheckboxGroup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a missing data-testid for SelectWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on failed test cases: CheckboxGroup_spec, DatePicker_2_spec, MultiSelectWidgetV2
* fix: Select popup DSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new property control, NumericInputControl
-- Replace all the label properties with the newly created controls
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new Cypress command, checkLabelWidth and apply to all related test cases
-- Increase width in checkboxgroupDsl.json
-- Rename className for label in MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement the tooltip feature for labels
-- Add missing props for labels in DateField, MultiSelectField, RadioGroupField, SelectField fields for JSONFormWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor property controls, including LabelPositionOptionsControl, LabelAlignmentOptionsControl, NumericInputControl to keep consistency
-- Apply default values into label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract the label related parts from the various widgets as an independent component
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate TypeScript any type from BaseInputComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change labelPosition property type to DROP_DOWN
-- Modify LabelAlignmentOptionsControl to use ButtonTabComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Define getLabelWidth method into BaseWidget
-- Extract the common CSS rules for the widget containers
-- Revert rows and columns for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed test case in DSLMigrationsUtils.test.ts
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on overflow issue on CheckboxGroupWidget
-- Create a distinctive spec file for label feature
-- Eliminate the redundant label specs with the relevant widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Delete unnecessary files, including Select_spec.js, LabelButton.tsx and LabelPositionOptionsControl.tsx
-- Revise wrong comment for checkLabelForWidget Cypress command
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Do not set the label width only if its value is 0
-- Clean up the component for DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Make RadioGroupWidget's layout flexible in all modes
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on Cypress test case for RadioGroupWidget in Widgets_Labels_spec
-- Change Cypress commands, including addAction, addSuccessMessage, enterActionValue to accept parentSelector
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change getLabelWidth method to not have any argument
-- Define some constants for label numbers
-- Extract the common styles for SwitchGroupWidget and RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor some constants
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused width prop from RadioGroupWidget
-- Get labelWidth from getLabelWidth
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate the min-height restriction on a label
-- Eliminate the scroll on the earlier InputWidgetV2 which was not in compact mode
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add one more condition checking if the current input type is text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract common code base for MultiSelectTreeWidget and MultiSelectWidgetV2
-- Apply a few CSS fixes on the scrollbar issue select related widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply some tweaks for earlier widgets with labels so as not to be broken UX
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed Cypress test case in Widget_Popup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add constants, LABEL_DEFAULT_WIDTH_RATE, SELECT_DEFAULT_HEIGHT, LABEL_MARGIN_OLD_SELECT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Increase the widths of CheckboxGroupWidget and SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set the font size to 14px for NumericInputControl
Co-authored-by: ohansFavour <fohanekwu@gmail.com>
Co-authored-by: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com>
2022-04-14 08:47:25 +00:00
|
|
|
Cypress.Commands.add("checkLabelForWidget", (options) => {
|
|
|
|
|
// Variables
|
|
|
|
|
const widgetName = options.widgetName;
|
|
|
|
|
const labelText = options.labelText;
|
|
|
|
|
const parentColumnSpace = options.parentColumnSpace;
|
|
|
|
|
const isCompact = options.isCompact;
|
|
|
|
|
const widgetSelector = `.t--widget-${widgetName}`;
|
|
|
|
|
const labelSelector = `${widgetSelector} label`;
|
|
|
|
|
const containerSelector = `${widgetSelector} ${options.containerSelector}`;
|
|
|
|
|
const labelPositionSelector = ".t--property-control-position";
|
|
|
|
|
const labelAlignmentRightSelector =
|
|
|
|
|
".t--property-control-alignment .t--button-tab-right";
|
|
|
|
|
const labelWidth = options.labelWidth;
|
|
|
|
|
|
|
|
|
|
// Drag a widget
|
|
|
|
|
cy.dragAndDropToCanvas(widgetName, { x: 300, y: 300 });
|
|
|
|
|
cy.get(`.t--widget-${widgetName}`).should("exist");
|
|
|
|
|
|
|
|
|
|
cy.openPropertyPane(widgetName);
|
|
|
|
|
|
|
|
|
|
// Set the label text
|
|
|
|
|
cy.updateCodeInput(".t--property-control-text", labelText);
|
|
|
|
|
// Assert label presence
|
|
|
|
|
cy.get(labelSelector)
|
|
|
|
|
.first()
|
|
|
|
|
.contains(labelText);
|
|
|
|
|
|
|
|
|
|
// Set the label position: Auto
|
|
|
|
|
cy.selectDropdownValue(labelPositionSelector, "Auto");
|
|
|
|
|
// Assert label position: Auto
|
|
|
|
|
cy.get(containerSelector).should(
|
|
|
|
|
"have.css",
|
|
|
|
|
"flex-direction",
|
|
|
|
|
`${isCompact ? "row" : "column"}`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Change the label position to Top
|
|
|
|
|
cy.selectDropdownValue(labelPositionSelector, "Top");
|
|
|
|
|
// Assert label position: Top
|
|
|
|
|
cy.get(containerSelector).should("have.css", "flex-direction", "column");
|
|
|
|
|
|
|
|
|
|
// Change the label position to Left
|
|
|
|
|
cy.selectDropdownValue(labelPositionSelector, "Left");
|
|
|
|
|
// Assert label position: Left
|
|
|
|
|
cy.get(containerSelector).should("have.css", "flex-direction", "row");
|
|
|
|
|
|
|
|
|
|
// Set the label alignment to RIGHT
|
|
|
|
|
cy.get(labelAlignmentRightSelector).click();
|
|
|
|
|
// Assert label alignment
|
|
|
|
|
cy.get(labelSelector)
|
|
|
|
|
.first()
|
|
|
|
|
.should("have.css", "text-align", "right");
|
|
|
|
|
|
|
|
|
|
// Set the label width to labelWidth cols
|
|
|
|
|
cy.get(`[class*='t--property-control-width'] .bp3-input`)
|
|
|
|
|
.first()
|
|
|
|
|
.focus()
|
|
|
|
|
.clear()
|
|
|
|
|
.type(`${labelWidth}`);
|
|
|
|
|
cy.wait(300);
|
|
|
|
|
// Assert the label width
|
|
|
|
|
cy.get(labelSelector)
|
|
|
|
|
.first()
|
|
|
|
|
.should("have.css", "width", `${parentColumnSpace * labelWidth}px`);
|
|
|
|
|
// Increase the label width
|
|
|
|
|
cy.get(`[class*='t--property-control-width'] .bp3-button-group > .bp3-button`)
|
|
|
|
|
.first()
|
|
|
|
|
.click();
|
|
|
|
|
// Assert the increased label width
|
|
|
|
|
cy.wait(300);
|
|
|
|
|
cy.get(labelSelector)
|
|
|
|
|
.first()
|
|
|
|
|
.should("have.css", "width", `${parentColumnSpace * (labelWidth + 1)}px`);
|
|
|
|
|
// Decrease the label width
|
|
|
|
|
cy.get(`[class*='t--property-control-width'] .bp3-button-group > .bp3-button`)
|
|
|
|
|
.last()
|
|
|
|
|
.click();
|
|
|
|
|
cy.wait(300);
|
|
|
|
|
// Assert the decreased label width
|
|
|
|
|
cy.get(labelSelector)
|
|
|
|
|
.first()
|
|
|
|
|
.should("have.css", "width", `${parentColumnSpace * labelWidth}px`);
|
|
|
|
|
|
|
|
|
|
// Clean up the widget
|
|
|
|
|
cy.deleteWidget(widgetSelector);
|
|
|
|
|
});
|
2022-04-12 10:01:22 +00:00
|
|
|
let LOCAL_STORAGE_MEMORY = {};
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("saveLocalStorageCache", () => {
|
|
|
|
|
Object.keys(localStorage).forEach((key) => {
|
|
|
|
|
LOCAL_STORAGE_MEMORY[key] = localStorage[key];
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("restoreLocalStorageCache", () => {
|
|
|
|
|
Object.keys(LOCAL_STORAGE_MEMORY).forEach((key) => {
|
|
|
|
|
localStorage.setItem(key, LOCAL_STORAGE_MEMORY[key]);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add(
|
|
|
|
|
"typeTab",
|
|
|
|
|
{ prevSubject: "element" },
|
|
|
|
|
(subject, shiftKey, ctrlKey) => {
|
|
|
|
|
cy.wrap(subject).trigger("keydown", {
|
|
|
|
|
keyCode: 9,
|
|
|
|
|
which: 9,
|
|
|
|
|
shiftKey: shiftKey,
|
|
|
|
|
ctrlKey: ctrlKey,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|