Web:Files/People:Tests: update translation tests for personal

This commit is contained in:
Timofey Boyko 2022-05-19 15:09:26 +03:00
parent 00fcb61aa7
commit d7898d3bf1
2 changed files with 90 additions and 63 deletions

View File

@ -7,6 +7,14 @@ const isModel = !!process.env.MODEL;
const cultures = isModel ? ["en"] : config.web.cultures.split(",");
const isPersonal = !!process.env.PERSONAL;
const settingsFile = isPersonal ? `settingsPersonal` : `settings`;
const settingsTranslationFile = isPersonal
? `settingsTranslationPersonal`
: `settingsTranslation`;
const featureName = isModel
? `Files translation(model) `
: `Files translation tests`;
@ -15,6 +23,10 @@ Feature(featureName, { timeout: 90 });
Before(async ({ I }) => {
I.mockData();
if (isPersonal) {
I.mockEndpoint(Endpoints.settings, settingsFile);
I.mockEndpoint(Endpoints.root, "personal");
}
});
for (const culture of cultures) {
@ -23,12 +35,11 @@ for (const culture of cultures) {
const isException = ignoringCultures.mainPage.indexOf(culture) != -1;
I.mockEndpoint(Endpoints.root, "empty");
I.mockEndpoint(Endpoints.my, "default");
if (!isException) {
I.mockEndpoint(Endpoints.self, `selfTranslation`);
I.mockEndpoint(Endpoints.settings, `settingsTranslation`);
I.mockEndpoint(Endpoints.settings, settingsTranslationFile);
}
I.amOnPage("/products/files");
@ -48,12 +59,11 @@ for (const culture of cultures) {
changeCulture(culture);
const isException = ignoringCultures.profileMenu.indexOf(culture) != -1;
I.mockEndpoint(Endpoints.root, "empty");
I.mockEndpoint(Endpoints.my, "default");
if (!isException) {
I.mockEndpoint(Endpoints.self, `selfTranslation`);
I.mockEndpoint(Endpoints.settings, `settingsTranslation`);
I.mockEndpoint(Endpoints.settings, settingsTranslationFile);
}
I.amOnPage("/products/files");
@ -74,12 +84,11 @@ for (const culture of cultures) {
changeCulture(culture);
const isException = ignoringCultures.mainButton.indexOf(culture) != -1;
I.mockEndpoint(Endpoints.root, "empty");
I.mockEndpoint(Endpoints.my, "default");
if (!isException) {
I.mockEndpoint(Endpoints.self, `selfTranslation`);
I.mockEndpoint(Endpoints.settings, `settingsTranslation`);
I.mockEndpoint(Endpoints.settings, settingsTranslationFile);
}
I.amOnPage("/products/files");
@ -101,12 +110,11 @@ for (const culture of cultures) {
Scenario(`Table settings test ${culture}`, { timeout: 30 }, ({ I }) => {
const isException = ignoringCultures.tableSettings.indexOf(culture) != -1;
I.mockEndpoint(Endpoints.root, "empty");
I.mockEndpoint(Endpoints.my, "default");
if (!isException) {
I.mockEndpoint(Endpoints.self, `selfTranslation`);
I.mockEndpoint(Endpoints.settings, `settingsTranslation`);
I.mockEndpoint(Endpoints.settings, settingsTranslationFile);
}
I.amOnPage("/products/files");

View File

@ -7,6 +7,16 @@ const isModel = !!process.env.MODEL;
const cultures = isModel ? ["en"] : config.web.cultures.split(",");
const isPersonal = !!process.env.PERSONAL;
console.log(process.env.PERSONAL);
const settingsFile = isPersonal ? `settingsPersonal` : `settings`;
const settingsTranslationFile = isPersonal
? `settingsTranslationPersonal`
: `settingsTranslation`;
const featureName = isModel
? `People translation(model) `
: `People translation tests`;
@ -15,81 +25,90 @@ Feature(featureName, { timeout: 90 });
Before(async ({ I }) => {
I.mockData();
I.mockEndpoint(Endpoints.settings, settingsFile);
});
for (const culture of cultures) {
Scenario(`Main page test ${culture}`, { timeout: 30 }, ({ I }) => {
changeCulture(culture);
const isException = ignoringCultures.mainPage.indexOf(culture) != -1;
if (!isPersonal) {
Scenario(`Main page test ${culture}`, { timeout: 30 }, ({ I }) => {
changeCulture(culture);
const isException = ignoringCultures.mainPage.indexOf(culture) != -1;
I.mockEndpoint(Endpoints.filter, "many");
I.mockEndpoint(Endpoints.group, "many");
I.mockEndpoint(Endpoints.filter, "many");
I.mockEndpoint(Endpoints.group, "many");
if (!isException) {
I.mockEndpoint(Endpoints.self, `selfTranslation`);
I.mockEndpoint(Endpoints.settings, `settingsTranslation`);
}
if (!isException) {
I.mockEndpoint(Endpoints.self, `selfTranslation`);
I.mockEndpoint(Endpoints.settings, settingsTranslationFile);
}
I.openPage();
I.openPage();
I.saveScreenshot(`${culture}-main-page.png`);
I.seeVisualDiff(`${culture}-main-page.png`, {
tolerance: 0.04,
prepareBaseImage: false,
// ignoredBox: { top: 0, left: 0, bottom: 0, right: 1720 },
I.saveScreenshot(`${culture}-main-page.png`);
I.seeVisualDiff(`${culture}-main-page.png`, {
tolerance: 0.04,
prepareBaseImage: false,
// ignoredBox: { top: 0, left: 0, bottom: 0, right: 1720 },
});
});
});
Scenario(`Main button test ${culture}`, { timeout: 30 }, ({ I }) => {
changeCulture(culture);
const isException = ignoringCultures.mainButton.indexOf(culture) != -1;
Scenario(`Main button test ${culture}`, { timeout: 30 }, ({ I }) => {
changeCulture(culture);
const isException = ignoringCultures.mainButton.indexOf(culture) != -1;
I.mockEndpoint(Endpoints.filter, "many");
I.mockEndpoint(Endpoints.group, "many");
I.mockEndpoint(Endpoints.filter, "many");
I.mockEndpoint(Endpoints.group, "many");
if (!isException) {
I.mockEndpoint(Endpoints.self, `selfTranslation`);
I.mockEndpoint(Endpoints.settings, `settingsTranslation`);
}
if (!isException) {
I.mockEndpoint(Endpoints.self, `selfTranslation`);
I.mockEndpoint(Endpoints.settings, settingsTranslationFile);
}
I.openPage();
I.openPage();
I.seeElement({ react: "MainButton" });
I.click({ react: "MainButton" });
I.seeElement({ react: "MainButton" });
I.click({ react: "MainButton" });
I.wait(3);
I.wait(3);
I.saveScreenshot(`${culture}-main-button.png`);
I.seeVisualDiff(`${culture}-main-button.png`, {
tolerance: 0.32,
prepareBaseImage: false,
ignoredBox: { top: 0, left: 256, bottom: 0, right: 0 },
I.saveScreenshot(`${culture}-main-button.png`);
I.seeVisualDiff(`${culture}-main-button.png`, {
tolerance: 0.32,
prepareBaseImage: false,
ignoredBox: { top: 0, left: 256, bottom: 0, right: 0 },
});
});
});
Scenario(`Table settings test ${culture}`, { timeout: 30 }, async ({ I }) => {
changeCulture(culture);
const isException = ignoringCultures.tableSettings.indexOf(culture) != -1;
Scenario(
`Table settings test ${culture}`,
{ timeout: 30 },
async ({ I }) => {
changeCulture(culture);
const isException =
ignoringCultures.tableSettings.indexOf(culture) != -1;
await I.mockEndpoint(Endpoints.filter, "many");
await I.mockEndpoint(Endpoints.group, "many");
await I.mockEndpoint(Endpoints.filter, "many");
await I.mockEndpoint(Endpoints.group, "many");
if (!isException) {
await I.mockEndpoint(Endpoints.self, `selfTranslation`);
await I.mockEndpoint(Endpoints.settings, `settingsTranslation`);
}
if (!isException) {
await I.mockEndpoint(Endpoints.self, `selfTranslation`);
await I.mockEndpoint(Endpoints.settings, settingsTranslationFile);
}
I.openPage();
I.openPage();
I.seeElement({ react: "TableSettings" });
I.click({ react: "TableSettings" });
I.seeElement({ react: "TableSettings" });
I.click({ react: "TableSettings" });
I.wait(3);
I.wait(3);
I.saveScreenshot(`${culture}-table-settings.png`);
await I.seeVisualDiff(`${culture}-table-settings.png`, {
tolerance: 0.07,
prepareBaseImage: false,
ignoredBox: { top: 0, left: 0, bottom: 0, right: 1770 },
});
});
I.saveScreenshot(`${culture}-table-settings.png`);
await I.seeVisualDiff(`${culture}-table-settings.png`, {
tolerance: 0.07,
prepareBaseImage: false,
ignoredBox: { top: 0, left: 0, bottom: 0, right: 1770 },
});
}
);
}
}