saleor-dashboard/cypress/e2e/translations.js
poulch d5ed6fb202
Feature flags (#2961)
* [Feature Flags] Abstraction over flags provider (#2928)

* Remove useFlag hook

* [Feature Flags] GraphQL build multiple schemas (#2937)

* Build script

* Refactor build types script

* Remove old codegen.yml

* Clean feature flags in script

* Refactor schema path

* Restore useAuthProvider

* Update configuration file

* encapsulate details for feature flags provider

* Add proper env to flagsmith provider

* Remove flagsmith mocks

* Vite config define global variables

* Render flagmisth provider only when is used

* Keep name service agnostic

* Test with mocked flagsmith

* Use global FLAGS varaible for env flags

* Fix type issue with FLAGS

* Fix build issue

* Remove duplicate translations

* Fix typo

* Prepare for QA tests

* Remove test feature flag
2023-01-16 14:55:38 +01:00

94 lines
3.2 KiB
JavaScript

/// <reference types="cypress"/>
/// <reference types="../support"/>
import faker from "faker";
import {
createCategory,
getCategory,
updateCategoryTranslation,
} from "../support/api/requests/Category";
import { deleteCategoriesStartsWith } from "../support/api/utils/catalog/categoryUtils";
import { updateTranslationToCategory } from "../support/pages/translationsPage";
describe("As an admin I want to manage translations", () => {
const startsWith = "TestTranslations";
const randomNumber = faker.datatype.number();
let category;
before(() => {
cy.clearSessionData().loginUserViaRequest();
deleteCategoriesStartsWith(startsWith);
createCategory({ name: startsWith }).then(categoryResp => {
category = categoryResp;
cy.checkIfDataAreNotNull({ category });
});
});
beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
});
it(
"should be able to create new translation. TC:SALEOR_1701",
{ tags: ["@translations", "@stagedOnly", "@stable"] },
() => {
const translatedName = `TranslatedName${randomNumber}`;
const translatedDescription = `TranslatedDescription${randomNumber}`;
const translatedSeoTitle = `TranslatedSeoTitle${randomNumber}`;
const translatedSeoDescription = `TranslatedSeoDescription${randomNumber}`;
updateTranslationToCategory({
categoryName: category.name,
translatedName,
translatedDescription,
translatedSeoTitle,
translatedSeoDescription,
});
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", "@stable"] },
() => {
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",
description: "test",
}).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}"}`);
});
},
);
});