diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 20f3c51c0..d3a7ed932 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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 \ No newline at end of file diff --git a/cypress/e2e/translations.js b/cypress/e2e/translations.js index 559e49ede..28437548a 100644 --- a/cypress/e2e/translations.js +++ b/cypress/e2e/translations.js @@ -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}"}`); + }); }, ); }); diff --git a/cypress/support/pages/translationsPage.js b/cypress/support/pages/translationsPage.js index 6c2b8a3b1..e8f8196ef 100644 --- a/cypress/support/pages/translationsPage.js +++ b/cypress/support/pages/translationsPage.js @@ -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);