fix for translation tests (#2306)
* fix for flaky chane user email tests and refactor of plugins tests * fix for translation tests * adding an option to run plugin tests in pull_request_temple * adding an option to run translation tests
This commit is contained in:
parent
81319a67a6
commit
7a469029fd
3 changed files with 35 additions and 41 deletions
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -49,5 +49,6 @@ Tests will be re-run only when the "run e2e" label is added.
|
|||
17. [ ] products
|
||||
18. [ ] app
|
||||
19. [ ] plugins
|
||||
20. [ ] translations
|
||||
|
||||
CONTAINERS=1
|
|
@ -11,7 +11,7 @@ import {
|
|||
import { deleteCategoriesStartsWith } from "../support/api/utils/catalog/categoryUtils";
|
||||
import { updateTranslationToCategory } from "../support/pages/translationsPage";
|
||||
|
||||
xdescribe("As an admin I want to manage translations", () => {
|
||||
describe("As an admin I want to manage translations", () => {
|
||||
const startsWith = "TestTranslations";
|
||||
const randomNumber = faker.datatype.number();
|
||||
|
||||
|
@ -31,7 +31,7 @@ xdescribe("As an admin I want to manage translations", () => {
|
|||
|
||||
it(
|
||||
"should be able to create new translation. TC:SALEOR_1701",
|
||||
{ tags: ["@translations", "@stagedOnly"] },
|
||||
{ tags: ["@translations", "@stagedOnly", "@stable"] },
|
||||
() => {
|
||||
const translatedName = `TranslatedName${randomNumber}`;
|
||||
const translatedDescription = `TranslatedDescription${randomNumber}`;
|
||||
|
@ -45,24 +45,20 @@ xdescribe("As an admin I want to manage translations", () => {
|
|||
translatedSeoTitle,
|
||||
translatedSeoDescription,
|
||||
});
|
||||
getCategory(category.id, "PL").then(({ translation }) => {
|
||||
expect(translation.name).to.eq(`TranslatedName${randomNumber}`);
|
||||
expect(translation.description).to.includes(
|
||||
`TranslatedDescription${randomNumber}`,
|
||||
);
|
||||
expect(translation.seoTitle).to.eq(`TranslatedSeoTitle${randomNumber}`);
|
||||
expect(translation.seoDescription).to.eq(
|
||||
`TranslatedSeoDescription${randomNumber}`,
|
||||
);
|
||||
});
|
||||
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}"}`);
|
||||
},
|
||||
);
|
||||
|
||||
it(
|
||||
"should be able to update translation. TC:SALEOR_1702",
|
||||
{ tags: ["@translations", "@stagedOnly"] },
|
||||
{ tags: ["@translations", "@stagedOnly", "@stable"] },
|
||||
() => {
|
||||
const randomNumber = faker.datatype.number();
|
||||
const startWithUpdate = `Translations_Update_${randomNumber}`;
|
||||
const seoTitleUpdate = `${startWithUpdate}_seoTitle`;
|
||||
const seoDescriptionUpdate = `${startWithUpdate}_seoDescription`;
|
||||
|
@ -76,23 +72,22 @@ xdescribe("As an admin I want to manage translations", () => {
|
|||
seoDescription: "test",
|
||||
name: "test",
|
||||
description: "test",
|
||||
})
|
||||
.then(() => {
|
||||
updateTranslationToCategory({
|
||||
categoryName: category.name,
|
||||
translatedName: nameUpdate,
|
||||
translatedDescription: descriptionUpdate,
|
||||
translatedSeoTitle: seoTitleUpdate,
|
||||
translatedSeoDescription: seoDescriptionUpdate,
|
||||
});
|
||||
getCategory(category.id, "PL");
|
||||
})
|
||||
.then(({ translation }) => {
|
||||
expect(translation.name).to.eq(nameUpdate);
|
||||
expect(translation.description).to.includes(descriptionUpdate);
|
||||
expect(translation.seoTitle).to.eq(seoTitleUpdate);
|
||||
expect(translation.seoDescription).to.includes(seoDescriptionUpdate);
|
||||
}).then(() => {
|
||||
updateTranslationToCategory({
|
||||
categoryName: category.name,
|
||||
translatedName: nameUpdate,
|
||||
translatedDescription: descriptionUpdate,
|
||||
translatedSeoTitle: seoTitleUpdate,
|
||||
translatedSeoDescription: seoDescriptionUpdate,
|
||||
});
|
||||
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}"}`);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ export function updateTranslationToCategory({
|
|||
translatedName,
|
||||
translatedDescription,
|
||||
translatedSeoTitle,
|
||||
translatedSeoDescription
|
||||
translatedSeoDescription,
|
||||
}) {
|
||||
cy.visit(urlList.translations);
|
||||
enterCategoryTranslation(LANGUAGES_LIST.polishLanguageButton, categoryName);
|
||||
|
@ -28,7 +28,6 @@ export function updateTranslationToCategory({
|
|||
.should("not.exist")
|
||||
.get(ELEMENT_TRANSLATION.translationTextEditor)
|
||||
.clearAndType(translatedDescription)
|
||||
.wait(500)
|
||||
.get(BUTTON_SELECTORS.confirm)
|
||||
.click()
|
||||
.confirmationMessageShouldDisappear()
|
||||
|
@ -50,23 +49,22 @@ export function updateTranslationToCategory({
|
|||
|
||||
export function enterCategoryTranslation(language, categoryName) {
|
||||
cy.addAliasToGraphRequest("CategoryTranslations");
|
||||
cy.get(language).click();
|
||||
cy.get(language)
|
||||
.click()
|
||||
.waitForProgressBarToNotExist();
|
||||
getCategoryFromTable(categoryName);
|
||||
}
|
||||
|
||||
function getCategoryFromTable(categoryName) {
|
||||
cy.wait("@CategoryTranslations")
|
||||
.its("response.body")
|
||||
.then(bodies => {
|
||||
const body = bodies[0];
|
||||
const edges = body.data.translations.edges;
|
||||
.its("response.body.data.translations.edges")
|
||||
.then(edges => {
|
||||
const isCategoryInResp = edges.find(
|
||||
edge => edge.node.category.name === categoryName
|
||||
edge => edge.node.category.name === categoryName,
|
||||
);
|
||||
|
||||
if (isCategoryInResp) {
|
||||
cy.contains(SHARED_ELEMENTS.tableRow, categoryName).click({
|
||||
force: true
|
||||
});
|
||||
cy.contains(SHARED_ELEMENTS.tableRow, categoryName).click();
|
||||
} else {
|
||||
cy.get(BUTTON_SELECTORS.nextPaginationButton).click();
|
||||
getCategoryFromTable(categoryName);
|
||||
|
|
Loading…
Reference in a new issue