2022-02-21 11:31:50 +00:00
|
|
|
/// <reference types="cypress"/>
|
|
|
|
/// <reference types="../support"/>
|
|
|
|
|
|
|
|
import faker from "faker";
|
|
|
|
|
|
|
|
import {
|
|
|
|
createCategory,
|
|
|
|
getCategory,
|
2022-06-27 16:49:35 +00:00
|
|
|
updateCategoryTranslation,
|
2022-02-21 11:31:50 +00:00
|
|
|
} from "../support/api/requests/Category";
|
|
|
|
import { updateTranslationToCategory } from "../support/pages/translationsPage";
|
|
|
|
|
2022-09-15 08:28:46 +00:00
|
|
|
describe("As an admin I want to manage translations", () => {
|
2023-05-29 07:15:07 +00:00
|
|
|
const startsWith = "TestTranslations - " + Date.now();
|
2022-06-27 09:30:51 +00:00
|
|
|
const randomNumber = faker.datatype.number();
|
2023-05-29 07:15:07 +00:00
|
|
|
const slug = `${faker.lorem.slug()}slug`;
|
2022-02-21 11:31:50 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
let category;
|
2022-02-21 11:31:50 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
before(() => {
|
2023-07-28 07:48:41 +00:00
|
|
|
cy.loginUserViaRequest();
|
2023-05-29 07:15:07 +00:00
|
|
|
createCategory({ name: startsWith, slug }).then(categoryResp => {
|
2023-01-16 13:55:38 +00:00
|
|
|
category = categoryResp;
|
|
|
|
cy.checkIfDataAreNotNull({ category });
|
|
|
|
});
|
2022-06-27 09:30:51 +00:00
|
|
|
});
|
2022-02-21 11:31:50 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
beforeEach(() => {
|
2023-07-28 07:48:41 +00:00
|
|
|
cy.loginUserViaRequest();
|
2022-06-27 09:30:51 +00:00
|
|
|
});
|
2022-02-21 11:31:50 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
it(
|
|
|
|
"should be able to create new translation. TC:SALEOR_1701",
|
2023-01-16 14:05:07 +00:00
|
|
|
{ tags: ["@translations", "@allEnv", "@stable"] },
|
2022-06-27 09:30:51 +00:00
|
|
|
() => {
|
2022-02-21 11:31:50 +00:00
|
|
|
const translatedName = `TranslatedName${randomNumber}`;
|
|
|
|
const translatedDescription = `TranslatedDescription${randomNumber}`;
|
|
|
|
const translatedSeoTitle = `TranslatedSeoTitle${randomNumber}`;
|
|
|
|
const translatedSeoDescription = `TranslatedSeoDescription${randomNumber}`;
|
|
|
|
|
|
|
|
updateTranslationToCategory({
|
|
|
|
categoryName: category.name,
|
|
|
|
translatedName,
|
|
|
|
translatedDescription,
|
|
|
|
translatedSeoTitle,
|
2022-06-27 16:49:35 +00:00
|
|
|
translatedSeoDescription,
|
2022-02-21 11:31:50 +00:00
|
|
|
});
|
2022-09-15 08:28:46 +00:00
|
|
|
getCategory(category.id, "PL")
|
|
|
|
.its("translation")
|
|
|
|
.should("include", { name: `${translatedName}` })
|
|
|
|
.and("include", { seoDescription: `${translatedSeoDescription}` })
|
|
|
|
.and("include", { seoTitle: `${translatedSeoTitle}` })
|
|
|
|
.its("description")
|
|
|
|
.should("have.string", `{"text": "${translatedDescription}"}`);
|
2022-06-27 16:49:35 +00:00
|
|
|
},
|
2022-06-27 09:30:51 +00:00
|
|
|
);
|
2022-02-21 11:31:50 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
it(
|
|
|
|
"should be able to update translation. TC:SALEOR_1702",
|
2023-01-16 14:05:07 +00:00
|
|
|
{ tags: ["@translations", "@allEnv", "@stable"] },
|
2022-06-27 09:30:51 +00:00
|
|
|
() => {
|
2022-02-21 11:31:50 +00:00
|
|
|
const startWithUpdate = `Translations_Update_${randomNumber}`;
|
|
|
|
const seoTitleUpdate = `${startWithUpdate}_seoTitle`;
|
|
|
|
const seoDescriptionUpdate = `${startWithUpdate}_seoDescription`;
|
|
|
|
const nameUpdate = `${startWithUpdate}_nameUpdate`;
|
|
|
|
const descriptionUpdate = `${startWithUpdate}_descryptionUpdate`;
|
|
|
|
|
|
|
|
updateCategoryTranslation({
|
|
|
|
categoryTranslateId: category.id,
|
|
|
|
languageCode: "PL",
|
|
|
|
seoTitle: "test",
|
|
|
|
seoDescription: "test",
|
|
|
|
name: "test",
|
2022-06-27 16:49:35 +00:00
|
|
|
description: "test",
|
2022-09-15 08:28:46 +00:00
|
|
|
}).then(() => {
|
|
|
|
updateTranslationToCategory({
|
|
|
|
categoryName: category.name,
|
|
|
|
translatedName: nameUpdate,
|
|
|
|
translatedDescription: descriptionUpdate,
|
|
|
|
translatedSeoTitle: seoTitleUpdate,
|
|
|
|
translatedSeoDescription: seoDescriptionUpdate,
|
2022-02-21 11:31:50 +00:00
|
|
|
});
|
2022-09-15 08:28:46 +00:00
|
|
|
getCategory(category.id, "PL")
|
|
|
|
.its("translation")
|
|
|
|
.should("include", { name: `${nameUpdate}` })
|
|
|
|
.and("include", { seoDescription: `${seoDescriptionUpdate}` })
|
|
|
|
.and("include", { seoTitle: `${seoTitleUpdate}` })
|
|
|
|
.its("description")
|
|
|
|
.should("have.string", `{"text": "${descriptionUpdate}"}`);
|
|
|
|
});
|
2022-06-27 16:49:35 +00:00
|
|
|
},
|
2022-06-27 09:30:51 +00:00
|
|
|
);
|
2022-02-21 11:31:50 +00:00
|
|
|
});
|