DocSpace-buildtools/web/ASC.Web.Login/tests/render_tests.js

198 lines
4.3 KiB
JavaScript
Raw Normal View History

2022-02-09 12:57:19 +00:00
const Endpoints = require("./mocking/endpoints.js");
2021-12-21 07:59:11 +00:00
2022-02-09 12:57:19 +00:00
const browser = process.env.profile || "chromium";
const deviceType = process.env.DEVICE_TYPE || "desktop";
2021-12-21 07:59:11 +00:00
const isModel = !!process.env.MODEL;
const featureName = isModel
? `Login render on '${browser}' with '${deviceType}' dimension (model)`
: `Login render on '${browser}' with '${deviceType}' dimension`;
Feature(featureName);
// doing it before others scenario
Before(async ({ I }) => {
2022-02-09 12:57:19 +00:00
I.mockEndpoint(Endpoints.settings, "settings");
I.mockEndpoint(Endpoints.build, "build");
I.mockEndpoint(Endpoints.providers, "providers");
I.mockEndpoint(Endpoints.capabilities, "capabilities");
I.mockEndpoint(Endpoints.people, "");
I.amOnPage("/login");
2021-12-21 07:59:11 +00:00
I.wait(2);
});
2022-02-09 12:57:19 +00:00
Scenario("Login page components render test", async ({ I }) => {
I.see("Web Office");
2021-12-21 07:59:11 +00:00
I.seeElement({
2022-02-09 12:57:19 +00:00
react: "TextInput",
2021-12-21 07:59:11 +00:00
props: {
2022-02-09 12:57:19 +00:00
id: "login",
name: "login",
type: "email",
autoComplete: "username",
2021-12-21 07:59:11 +00:00
},
});
I.seeElement({
2022-02-09 12:57:19 +00:00
react: "PasswordInput",
2021-12-21 07:59:11 +00:00
props: {
2022-02-09 12:57:19 +00:00
id: "password",
inputName: "password",
type: "password",
autoComplete: "current-password",
2021-12-21 07:59:11 +00:00
},
});
I.seeElement({
2022-02-09 12:57:19 +00:00
react: "Checkbox",
2021-12-21 07:59:11 +00:00
props: {
2022-02-09 12:57:19 +00:00
className: "login-checkbox",
2021-12-21 07:59:11 +00:00
isChecked: false,
},
});
I.seeElement({
2022-02-09 12:57:19 +00:00
react: "HelpButton",
2021-12-21 07:59:11 +00:00
props: {
2022-02-09 12:57:19 +00:00
className: "login-tooltip",
2021-12-21 07:59:11 +00:00
},
});
I.seeElement({
2022-02-09 12:57:19 +00:00
react: "Link",
2021-12-21 07:59:11 +00:00
props: {
2022-02-09 12:57:19 +00:00
className: "login-link",
type: "page",
2021-12-21 07:59:11 +00:00
},
});
I.seeElement({
2022-02-09 12:57:19 +00:00
react: "Button",
2021-12-21 07:59:11 +00:00
props: {
2022-02-09 12:57:19 +00:00
className: "login-button",
type: "page",
2021-12-21 07:59:11 +00:00
},
});
2022-02-09 12:57:19 +00:00
I.see("Sign in with Facebook");
I.see("Sign in with Google");
I.see("Sign in with LinkedIn");
2021-12-21 07:59:11 +00:00
2022-02-09 12:57:19 +00:00
I.see("Register");
2021-12-21 07:59:11 +00:00
I.saveScreenshot(`1.login-page-render.png`);
if (!isModel) {
I.seeVisualDiff(`1.login-page-render.png`, {
tolerance: 1,
prepareBaseImage: false,
});
}
});
2022-02-09 12:57:19 +00:00
Scenario("Reset mail tab render test", async ({ I }) => {
2021-12-21 07:59:11 +00:00
I.seeElement({
2022-02-09 12:57:19 +00:00
react: "Link",
2021-12-21 07:59:11 +00:00
props: {
2022-02-09 12:57:19 +00:00
className: "login-link",
type: "page",
2021-12-21 07:59:11 +00:00
},
});
2022-02-09 12:57:19 +00:00
I.click("Forgot your password?");
2021-12-21 07:59:11 +00:00
2022-02-09 12:57:19 +00:00
I.see("Password recovery");
2021-12-21 07:59:11 +00:00
I.see(
2022-02-09 12:57:19 +00:00
"Please, enter the email you used for registration. The password recovery instructions will be sent to it."
2021-12-21 07:59:11 +00:00
);
I.seeElement({
2022-02-09 12:57:19 +00:00
react: "TextInput",
2021-12-21 07:59:11 +00:00
});
2022-02-09 12:57:19 +00:00
I.see("Send");
2021-12-21 07:59:11 +00:00
I.saveScreenshot(`2.reset-mail-tab.png`);
if (!isModel) {
I.seeVisualDiff(`2.reset-mail-tab.png`, {
tolerance: 1,
prepareBaseImage: false,
});
}
});
2022-02-09 12:57:19 +00:00
Scenario("Registration tab render test", async ({ I }) => {
I.click({ react: "Register" });
2021-12-21 07:59:11 +00:00
2022-02-09 12:57:19 +00:00
I.see("Registration request");
2021-12-21 07:59:11 +00:00
I.see(
2022-02-09 12:57:19 +00:00
"To register, enter your email and click Send request. An activation link will be sent to you."
2021-12-21 07:59:11 +00:00
);
I.seeElement({
2022-02-09 12:57:19 +00:00
react: "TextInput",
2021-12-21 07:59:11 +00:00
});
2022-02-09 12:57:19 +00:00
I.see("Send request");
2021-12-21 07:59:11 +00:00
I.saveScreenshot(`3.registration-mail-tab.png`);
if (!isModel) {
I.seeVisualDiff(`3.registration-mail-tab.png`, {
tolerance: 1,
prepareBaseImage: false,
});
}
});
2022-02-10 14:17:13 +00:00
//TODO: check help button test on mobile chromium/ff
if (browser === "webkit" || deviceType === "desktop") {
Scenario("Help button modal render test", async ({ I }) => {
I.seeElement({
react: "HelpButton",
props: {
className: "login-tooltip",
},
});
2021-12-21 07:59:11 +00:00
2022-02-10 14:17:13 +00:00
I.click({
react: "HelpButton",
props: {
className: "login-tooltip",
},
2021-12-21 07:59:11 +00:00
});
2022-02-10 14:17:13 +00:00
I.see(
"The default session lifetime is 20 minutes. Check this option to set it to 1 year. To set your own value, go to Settings."
);
I.saveScreenshot(`4.help-button-modal.png`);
if (!isModel) {
I.seeVisualDiff(`4.help-button-modal.png`, {
tolerance: 1,
prepareBaseImage: false,
});
}
});
}
2022-02-09 12:57:19 +00:00
Scenario("More login modal render test", async ({ I }) => {
I.seeElement({
react: "Link",
props: {
className: "more-label",
},
});
I.click({
react: "Link",
props: {
className: "more-label",
},
});
2022-02-28 13:16:30 +00:00
I.wait(2);
2022-02-09 12:57:19 +00:00
I.see("Authorization");
I.see("Sign in with SSO");
I.see("Sign in with Google");
I.see("Sign in with Facebook");
I.see("Sign in with LinkedIn");
I.saveScreenshot(`5.more-login-modal.png`);
if (!isModel) {
I.seeVisualDiff(`5.more-login-modal.png`, {
tolerance: 1,
prepareBaseImage: false,
});
}
});