DocSpace-buildtools/products/ASC.People/Client/steps_file.js

114 lines
3.5 KiB
JavaScript
Raw Normal View History

2022-02-08 15:05:45 +00:00
const Endpoints = require("./tests/mocking/endpoints.js");
2021-12-21 07:59:11 +00:00
// in this file you can append custom step methods to 'I' object
module.exports = function () {
return actor({
// Define custom steps here, use 'this' to access default methods of I.
// It is recommended to place a general 'login' function here.
mockData: function () {
2022-02-08 15:05:45 +00:00
this.mockEndpoint(Endpoints.settings, "settings");
this.mockEndpoint(Endpoints.build, "build");
this.mockEndpoint(Endpoints.common, "common");
this.mockEndpoint(Endpoints.password, "password");
this.mockEndpoint(Endpoints.info, "info");
this.mockEndpoint(Endpoints.self, "self");
this.mockEndpoint(Endpoints.cultures, "cultures");
2021-12-21 07:59:11 +00:00
},
openPage: function () {
2022-02-08 15:05:45 +00:00
this.amOnPage("/products/people");
2021-12-21 07:59:11 +00:00
this.refreshPage();
this.wait(5);
},
openArticle: function () {
this.seeElement({
2022-02-08 15:05:45 +00:00
react: "styled.div",
props: { className: "not-selectable", visible: true },
});
this.click({
react: "styled.div",
props: { className: "not-selectable", visible: true },
2021-12-21 07:59:11 +00:00
});
},
openProfileMenu: function () {
2022-02-08 15:05:45 +00:00
this.seeElement({
react: "Avatar",
props: { className: "icon-profile-menu" },
});
this.click({
react: "Avatar",
props: { className: "icon-profile-menu" },
});
2021-12-21 07:59:11 +00:00
},
openContextMenu: function () {
2022-02-08 15:05:45 +00:00
this.seeElement({
react: "ContextMenuButton",
props: { className: "expandButton" },
});
this.click({
react: "ContextMenuButton",
props: { className: "expandButton" },
});
2021-12-21 07:59:11 +00:00
},
clickArticleMainButton: function () {
2022-02-08 15:05:45 +00:00
this.seeElement({ react: "ArticleMainButton" });
this.click({ react: "ArticleMainButton" });
2021-12-21 07:59:11 +00:00
this.wait(3);
},
addHeadInNewGroup: function () {
2022-02-08 15:05:45 +00:00
this.click("Select");
this.click("Administrator1");
2021-12-21 07:59:11 +00:00
},
addUserInNewGroup: function () {
2022-02-08 15:05:45 +00:00
this.click("#users-selector_button");
this.click({ react: "Checkbox", props: { value: "2" } });
this.click("Add members");
2021-12-21 07:59:11 +00:00
},
fillForm: function (form) {
2022-02-08 15:05:45 +00:00
this.click({
react: "RadioButton",
props: { name: "passwordType", isChecked: false },
});
this.fillField("firstName", form.firstName);
this.fillField("lastName", form.lastName);
this.fillField("email", form.email);
this.fillField("password", form.password);
// Not working on Calendar component on React portal
this.click({ react: "div", props: { className: "append" } });
this.seeElement({ react: "Calendar" });
this.click({ react: "ComboBox", props: { name: "month-button" } });
this.click({ react: "DropDownItem", props: { label: "January" } });
this.click({ react: "ComboBox", props: { name: "year-button" } });
this.click({ react: "DropDownItem", props: { label: "2020" } });
this.click(".calendar-month_weekend");
this.seeElement({ react: "InputBlock", props: { value: "01/04/2020" } });
this.fillField("location", form.location);
this.fillField("title", "Test title");
this.fillField("notes", form.notes);
this.click({ react: "Button", props: { label: "Save" } });
2021-12-21 07:59:11 +00:00
},
checkText: function (form, type) {
this.wait(10);
this.see(`${form.firstName} ${form.lastName}`);
2022-02-08 15:05:45 +00:00
this.see("Edit profile");
2021-12-21 07:59:11 +00:00
this.see(type);
this.see(form.email);
2022-02-08 15:05:45 +00:00
this.see("Male");
this.see("1/16/2020");
this.see("1/15/2021");
2021-12-21 07:59:11 +00:00
},
});
};