diff --git a/cypress/e2e/apps.js b/cypress/e2e/apps.js index 34f2d7141..352ff5c1e 100644 --- a/cypress/e2e/apps.js +++ b/cypress/e2e/apps.js @@ -4,7 +4,7 @@ import faker from "faker"; import { APP_DETAILS } from "../elements/apps/appDetails"; -import { APPS_LIST } from "../elements/apps/appsList"; +import { APPS_LIST_SELECTORS } from "../elements/apps/appsList"; import { WEBHOOK_DETAILS } from "../elements/apps/webhookDetails"; import { BUTTON_SELECTORS } from "../elements/shared/button-selectors"; import { appDetailsUrl, urlList } from "../fixtures/urlList"; @@ -108,8 +108,8 @@ describe("As a staff user I want to manage apps", () => { () => { const randomAppName = `${startsWith}${faker.datatype.number()}`; - cy.visit(urlList.apps) - .get(APPS_LIST.createLocalAppButton) + cy.visit(urlList.webhooksAndEvents) + .get(APPS_LIST_SELECTORS.createLocalAppButton) .click() .get(APP_DETAILS.nameInput) .type(randomAppName) diff --git a/cypress/e2e/catalog/categories.js b/cypress/e2e/catalog/categories.js index 2685ecebb..aebd3718c 100644 --- a/cypress/e2e/catalog/categories.js +++ b/cypress/e2e/catalog/categories.js @@ -4,10 +4,10 @@ import faker from "faker"; import { - CATEGORIES_LIST, + CATEGORIES_LIST_SELECTORS, categoryRow, } from "../../elements/catalog/categories/categories-list"; -import { CATEGORY_DETAILS } from "../../elements/catalog/categories/category-details"; +import { CATEGORY_DETAILS_SELECTORS } from "../../elements/catalog/categories/category-details"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { categoryDetailsUrl, urlList } from "../../fixtures/urlList"; @@ -89,7 +89,7 @@ describe("As an admin I want to manage categories", () => { const categoryName = `${startsWith}${faker.datatype.number()}`; cy.visit(urlList.categories) - .get(CATEGORIES_LIST.addCategoryButton) + .get(CATEGORIES_LIST_SELECTORS.addCategoryButton) .click(); createCategory({ name: categoryName, description: categoryName }) .its("response.body.data.categoryCreate.category") @@ -111,11 +111,11 @@ describe("As an admin I want to manage categories", () => { const categoryName = `${startsWith}${faker.datatype.number()}`; cy.visit(categoryDetailsUrl(category.id)) - .get(CATEGORY_DETAILS.createSubcategoryButton) + .get(CATEGORY_DETAILS_SELECTORS.createSubcategoryButton) .click(); createCategory({ name: categoryName, description: categoryName }) .visit(categoryDetailsUrl(category.id)) - .contains(CATEGORY_DETAILS.categoryChildrenRow, categoryName) + .contains(CATEGORY_DETAILS_SELECTORS.categoryChildrenRow, categoryName) .scrollIntoView() .should("be.visible"); getCategory(category.id).then(categoryResp => { @@ -129,9 +129,9 @@ describe("As an admin I want to manage categories", () => { { tags: ["@category", "@allEnv", "@stable"] }, () => { cy.visit(categoryDetailsUrl(category.id)) - .get(CATEGORY_DETAILS.productsTab) + .get(CATEGORY_DETAILS_SELECTORS.productsTab) .click() - .get(CATEGORY_DETAILS.addProducts) + .get(CATEGORY_DETAILS_SELECTORS.addProducts) .click() .url() .should("include", urlList.addProduct); @@ -143,9 +143,9 @@ describe("As an admin I want to manage categories", () => { { tags: ["@category", "@allEnv", "@stable"] }, () => { cy.visit(categoryDetailsUrl(category.id)) - .get(CATEGORY_DETAILS.productsTab) + .get(CATEGORY_DETAILS_SELECTORS.productsTab) .click(); - cy.contains(CATEGORY_DETAILS.productRow, product.name) + cy.contains(CATEGORY_DETAILS_SELECTORS.productRow, product.name) .find(BUTTON_SELECTORS.checkbox) .click() .get(BUTTON_SELECTORS.deleteIcon) @@ -154,7 +154,7 @@ describe("As an admin I want to manage categories", () => { .get(BUTTON_SELECTORS.submit) .click() .confirmationMessageShouldDisappear(); - cy.contains(CATEGORY_DETAILS.productRow, product.name) + cy.contains(CATEGORY_DETAILS_SELECTORS.productRow, product.name) .should("not.exist") .waitForRequestAndCheckIfNoErrors("@productBulkDelete"); getCategory(category.id).then(categoryResp => { diff --git a/cypress/e2e/configuration/channels/inactiveChannel.js b/cypress/e2e/configuration/channels/inactiveChannel.js index df0a364d6..ced9386c4 100644 --- a/cypress/e2e/configuration/channels/inactiveChannel.js +++ b/cypress/e2e/configuration/channels/inactiveChannel.js @@ -61,7 +61,7 @@ describe("Tests on inactive channel", () => { { tags: ["@channel", "@allEnv", "@stable"] }, () => { cy.visit(urlList.orders) - .get(ORDERS_SELECTORS.createOrder) + .get(ORDERS_SELECTORS.createOrderButton) .click() .get(CHANNEL_FORM_SELECTORS.channelSelect) .click() diff --git a/cypress/e2e/configuration/customer.js b/cypress/e2e/configuration/customer.js index c29d06603..bd7189655 100644 --- a/cypress/e2e/configuration/customer.js +++ b/cypress/e2e/configuration/customer.js @@ -3,8 +3,8 @@ import faker from "faker"; -import { CUSTOMER_DETAILS } from "../../elements/customer/customer-details"; -import { CUSTOMERS_LIST } from "../../elements/customer/customers-list"; +import { CUSTOMER_DETAILS_SELECTORS } from "../../elements/customer/customer-details"; +import { CUSTOMERS_LIST_SELECTORS } from "../../elements/customer/customers-list"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { customerDetailsUrl, urlList } from "../../fixtures/urlList"; @@ -43,18 +43,18 @@ describe("Tests for customer", () => { const note = faker.lorem.paragraph(); cy.visit(urlList.customers) - .get(CUSTOMERS_LIST.createCustomerButton) + .get(CUSTOMERS_LIST_SELECTORS.createCustomerButton) .click() .get(SHARED_ELEMENTS.progressBar) .should("not.be.visible") - .get(CUSTOMER_DETAILS.customerAddressNameInput) + .get(CUSTOMER_DETAILS_SELECTORS.customerAddressNameInput) .type(randomName) - .get(CUSTOMER_DETAILS.customerAddressLastNameInput) + .get(CUSTOMER_DETAILS_SELECTORS.customerAddressLastNameInput) .type(randomName) - .get(CUSTOMER_DETAILS.emailInput) + .get(CUSTOMER_DETAILS_SELECTORS.emailInput) .type(email) .fillUpAddressForm(address) - .get(CUSTOMER_DETAILS.noteInput) + .get(CUSTOMER_DETAILS_SELECTORS.noteInput) .type(note) .addAliasToGraphRequest("CreateCustomer") .get(BUTTON_SELECTORS.confirm) @@ -90,9 +90,9 @@ describe("Tests for customer", () => { createCustomer(email, randomName).then(({ user }) => { cy.visit(customerDetailsUrl(user.id)) - .get(CUSTOMER_DETAILS.manageAddressesButton) + .get(CUSTOMER_DETAILS_SELECTORS.manageAddressesButton) .click() - .get(CUSTOMER_DETAILS.addAddressButton) + .get(CUSTOMER_DETAILS_SELECTORS.addAddressButton) .click() .addAliasToGraphRequest("CreateCustomerAddress") .fillUpAddressFormAndSubmit(secondAddress) @@ -114,14 +114,14 @@ describe("Tests for customer", () => { createCustomer(email, randomName, address).then(({ user }) => { cy.visit(customerDetailsUrl(user.id)) - .get(CUSTOMER_DETAILS.manageAddressesButton) + .get(CUSTOMER_DETAILS_SELECTORS.manageAddressesButton) .click() .waitForProgressBarToNotExist() .get(BUTTON_SELECTORS.showMoreButton) .should("be.enabled") .first() .click() - .get(CUSTOMER_DETAILS.deleteAddressMenuItem) + .get(CUSTOMER_DETAILS_SELECTORS.deleteAddressMenuItem) .click() .addAliasToGraphRequest("RemoveCustomerAddress") .get(BUTTON_SELECTORS.submit) @@ -149,14 +149,14 @@ describe("Tests for customer", () => { }) .then(() => { cy.visit(customerDetailsUrl(user.id)) - .get(CUSTOMER_DETAILS.manageAddressesButton) + .get(CUSTOMER_DETAILS_SELECTORS.manageAddressesButton) .click() .waitForProgressBarToNotExist() .get(BUTTON_SELECTORS.showMoreButton) .should("be.enabled") .click() .addAliasToGraphRequest("SetCustomerDefaultAddress") - .get(CUSTOMER_DETAILS.setAddressAsDefaultShipping) + .get(CUSTOMER_DETAILS_SELECTORS.setAddressAsDefaultShipping) .click() .wait("@SetCustomerDefaultAddress"); getCustomer(user.id); @@ -167,7 +167,7 @@ describe("Tests for customer", () => { .should("be.enabled") .click() .addAliasToGraphRequest("SetCustomerDefaultAddress") - .get(CUSTOMER_DETAILS.setAddressAsDefaultBilling) + .get(CUSTOMER_DETAILS_SELECTORS.setAddressAsDefaultBilling) .click() .wait("@SetCustomerDefaultAddress"); getCustomer(user.id); @@ -187,13 +187,13 @@ describe("Tests for customer", () => { createCustomer(email, randomName, address).then(({ user }) => { cy.visit(customerDetailsUrl(user.id)) - .get(CUSTOMER_DETAILS.manageAddressesButton) + .get(CUSTOMER_DETAILS_SELECTORS.manageAddressesButton) .click() .get(BUTTON_SELECTORS.showMoreButton) .should("be.enabled") .first() .click() - .get(CUSTOMER_DETAILS.editAddressMenuitem) + .get(CUSTOMER_DETAILS_SELECTORS.editAddressMenuitem) .click() .addAliasToGraphRequest("UpdateCustomerAddress") .fillUpAddressFormAndSubmit(secondAddress) @@ -239,7 +239,7 @@ describe("Tests for customer", () => { createCustomer(email, randomName, address, true).then(({ user }) => { cy.visit(customerDetailsUrl(user.id)) - .get(CUSTOMER_DETAILS.activeCheckbox) + .get(CUSTOMER_DETAILS_SELECTORS.activeCheckbox) .click() .addAliasToGraphRequest("UpdateCustomer") .get(BUTTON_SELECTORS.confirm) @@ -262,13 +262,13 @@ describe("Tests for customer", () => { createCustomer(email, randomName, address, true).then(({ user }) => { cy.visit(customerDetailsUrl(user.id)) - .get(CUSTOMER_DETAILS.nameInput) + .get(CUSTOMER_DETAILS_SELECTORS.nameInput) .clearAndType(updatedName) - .get(CUSTOMER_DETAILS.lastNameInput) + .get(CUSTOMER_DETAILS_SELECTORS.lastNameInput) .clearAndType(updatedName) - .get(CUSTOMER_DETAILS.noteInput) + .get(CUSTOMER_DETAILS_SELECTORS.noteInput) .clearAndType(updatedName) - .get(CUSTOMER_DETAILS.emailInput) + .get(CUSTOMER_DETAILS_SELECTORS.emailInput) .clearAndType(`${updatedName}@example.com`) .addAliasToGraphRequest("UpdateCustomer") .get(BUTTON_SELECTORS.confirm) diff --git a/cypress/e2e/configuration/permissions.js b/cypress/e2e/configuration/permissions.js index a838059c7..38250530a 100644 --- a/cypress/e2e/configuration/permissions.js +++ b/cypress/e2e/configuration/permissions.js @@ -3,8 +3,8 @@ import faker from "faker"; -import { PERMISSION_GROUP_DETAILS } from "../../elements/permissionGroup/permissionGroupDetails"; -import { PERMISSION_GROUP_LIST } from "../../elements/permissionGroup/permissionGroupsList"; +import { PERMISSION_GROUP_DETAILS_SELECTORS } from "../../elements/permissionGroup/permissionGroupDetails"; +import { PERMISSION_GROUP_LIST_SELECTORS } from "../../elements/permissionGroup/permissionGroupsList"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { @@ -40,25 +40,25 @@ describe("Permissions groups", () => { const permissionName = `${startsWith}${faker.datatype.number()}`; cy.visit(urlList.permissionsGroups) - .get(PERMISSION_GROUP_LIST.createPermissionButton) + .get(PERMISSION_GROUP_LIST_SELECTORS.createPermissionButton) .click() - .get(PERMISSION_GROUP_DETAILS.nameInput) + .get(PERMISSION_GROUP_DETAILS_SELECTORS.nameInput) .type(permissionName) - .get(PERMISSION_GROUP_DETAILS.productsPermissionCheckbox) + .get(PERMISSION_GROUP_DETAILS_SELECTORS.productsPermissionCheckbox) .check() .get( - PERMISSION_GROUP_DETAILS.productsTypesAndAttributesPermissionCheckbox, + PERMISSION_GROUP_DETAILS_SELECTORS.productsTypesAndAttributesPermissionCheckbox, ) .check() .get(BUTTON_SELECTORS.confirm) .click() - .get(PERMISSION_GROUP_DETAILS.assignMemberButton) + .get(PERMISSION_GROUP_DETAILS_SELECTORS.assignMemberButton) .should("be.visible") .get(BUTTON_SELECTORS.back) .click() .waitForProgressBarToNotExist(); cy.contains( - PERMISSION_GROUP_LIST.permissionGroupRow, + PERMISSION_GROUP_LIST_SELECTORS.permissionGroupRow, permissionName, ).should("be.visible"); }, @@ -82,13 +82,19 @@ describe("Permissions groups", () => { permissionsArray: permissionManageProducts, }); cy.visit(urlList.permissionsGroups); - cy.contains(PERMISSION_GROUP_LIST.permissionGroupRow, permissionName) + cy.contains( + PERMISSION_GROUP_LIST_SELECTORS.permissionGroupRow, + permissionName, + ) .should("be.visible") .find(BUTTON_SELECTORS.deleteIcon) .click() .get(BUTTON_SELECTORS.submit) .click(); - cy.contains(PERMISSION_GROUP_LIST.permissionGroupRow, permissionName) + cy.contains( + PERMISSION_GROUP_LIST_SELECTORS.permissionGroupRow, + permissionName, + ) .should("not.exist") .visit(staffMemberDetailsUrl(staffMember.id)) .get(SHARED_ELEMENTS.header) @@ -110,12 +116,12 @@ describe("Permissions groups", () => { permissionsArray: permissionManageProducts, }).then(({ group }) => { cy.visit(permissionGroupDetails(group.id)) - .get(PERMISSION_GROUP_DETAILS.assignMemberButton) + .get(PERMISSION_GROUP_DETAILS_SELECTORS.assignMemberButton) .click() - .get(PERMISSION_GROUP_DETAILS.searchField) + .get(PERMISSION_GROUP_DETAILS_SELECTORS.searchField) .type(TEST_ADMIN_USER.email); cy.contains( - PERMISSION_GROUP_DETAILS.userRow, + PERMISSION_GROUP_DETAILS_SELECTORS.userRow, `${TEST_ADMIN_USER.name} ${TEST_ADMIN_USER.lastName}`, ) .should("have.length", 1) @@ -156,7 +162,7 @@ describe("Permissions groups", () => { }) .then(({ group }) => { cy.visit(permissionGroupDetails(group.id)) - .get(PERMISSION_GROUP_DETAILS.removeUserButton) + .get(PERMISSION_GROUP_DETAILS_SELECTORS.removeUserButton) .click() .get(BUTTON_SELECTORS.submit) .click() diff --git a/cypress/e2e/configuration/plugins/plugins.js b/cypress/e2e/configuration/plugins/plugins.js index 761b9fa0a..b7b8e0dfb 100644 --- a/cypress/e2e/configuration/plugins/plugins.js +++ b/cypress/e2e/configuration/plugins/plugins.js @@ -3,8 +3,8 @@ import faker from "faker"; -import { PLUGINS_DETAILS } from "../../../elements/plugins/pluginDetails"; -import { PLUGINS_LIST } from "../../../elements/plugins/pluginsList"; +import { PLUGINS_DETAILS_SELECTORS } from "../../../elements/plugins/pluginDetails"; +import { PLUGINS_LIST_SELECTORS } from "../../../elements/plugins/pluginsList"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { urlList } from "../../../fixtures/urlList"; import { @@ -55,12 +55,12 @@ describe("As an admin I want to manage plugins", () => { () => { const customerEmail = `${randomName}@example.com`; - cy.contains(PLUGINS_LIST.pluginRow, "User emails") + cy.contains(PLUGINS_LIST_SELECTORS.pluginRow, "User emails") .click() .waitForProgressBarToNotBeVisible(); - cy.contains(PLUGINS_DETAILS.channel, defaultChannel.name) + cy.contains(PLUGINS_DETAILS_SELECTORS.channel, defaultChannel.name) .click() - .get(PLUGINS_DETAILS.accountConfirmationSubjectInput) + .get(PLUGINS_DETAILS_SELECTORS.accountConfirmationSubjectInput) .clearAndType(randomName) .get(BUTTON_SELECTORS.confirm) .click() @@ -81,9 +81,9 @@ describe("As an admin I want to manage plugins", () => { () => { const adminName = `Admin${randomName}`; - cy.contains(PLUGINS_LIST.pluginRow, "Admin emails") + cy.contains(PLUGINS_LIST_SELECTORS.pluginRow, "Admin emails") .click() - .get(PLUGINS_DETAILS.staffPasswordResetInput) + .get(PLUGINS_DETAILS_SELECTORS.staffPasswordResetInput) .click() .clear() .clearAndType(adminName) diff --git a/cypress/e2e/configuration/productTypes/attributesInProduductTypes.js b/cypress/e2e/configuration/productTypes/attributesInProduductTypes.js index 363b2e351..d8b9123be 100644 --- a/cypress/e2e/configuration/productTypes/attributesInProduductTypes.js +++ b/cypress/e2e/configuration/productTypes/attributesInProduductTypes.js @@ -3,7 +3,7 @@ import faker from "faker"; -import { PRODUCT_TYPE_DETAILS } from "../../../elements/productTypes/productTypeDetails"; +import { PRODUCT_TYPE_DETAILS_SELECTORS } from "../../../elements/productTypes/productTypeDetails"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { productTypeDetailsUrl } from "../../../fixtures/urlList"; import { createAttribute } from "../../../support/api/requests/Attribute"; @@ -40,7 +40,7 @@ describe("As an admin I want to manage attributes in product types", () => { cy.visitAndWaitForProgressBarToDisappear( productTypeDetailsUrl(productType.id), ) - .get(PRODUCT_TYPE_DETAILS.assignProductAttributeButton) + .get(PRODUCT_TYPE_DETAILS_SELECTORS.assignProductAttributeButton) .click() .addAliasToGraphRequest("AssignProductAttribute") .assignElements(startsWith) @@ -65,10 +65,10 @@ describe("As an admin I want to manage attributes in product types", () => { cy.visitAndWaitForProgressBarToDisappear( productTypeDetailsUrl(productType.id), ) - .get(PRODUCT_TYPE_DETAILS.hasVariantsButton) + .get(PRODUCT_TYPE_DETAILS_SELECTORS.hasVariantsButton) .should("be.enabled") .click({ force: true }) - .get(PRODUCT_TYPE_DETAILS.assignVariantAttributeButton) + .get(PRODUCT_TYPE_DETAILS_SELECTORS.assignVariantAttributeButton) .click() .addAliasToGraphRequest("AssignProductAttribute") .assignElements(startsWith) @@ -100,7 +100,7 @@ describe("As an admin I want to manage attributes in product types", () => { cy.visitAndWaitForProgressBarToDisappear( productTypeDetailsUrl(productType.id), ) - .get(PRODUCT_TYPE_DETAILS.nameInput) + .get(PRODUCT_TYPE_DETAILS_SELECTORS.nameInput) .should("be.enabled") .get(BUTTON_SELECTORS.deleteIcon) .should("be.enabled") @@ -133,7 +133,7 @@ describe("As an admin I want to manage attributes in product types", () => { cy.visitAndWaitForProgressBarToDisappear( productTypeDetailsUrl(productType.id), ) - .get(PRODUCT_TYPE_DETAILS.nameInput) + .get(PRODUCT_TYPE_DETAILS_SELECTORS.nameInput) .should("be.enabled") .get(BUTTON_SELECTORS.deleteIcon) .should("be.enabled") @@ -166,7 +166,7 @@ describe("As an admin I want to manage attributes in product types", () => { cy.visitAndWaitForProgressBarToDisappear( productTypeDetailsUrl(productType.id), ) - .get(PRODUCT_TYPE_DETAILS.variantSelectionCheckbox) + .get(PRODUCT_TYPE_DETAILS_SELECTORS.variantSelectionCheckbox) .click() .addAliasToGraphRequest("ProductAttributeAssignmentUpdate") .get(BUTTON_SELECTORS.confirm) diff --git a/cypress/e2e/customerRegistration.js b/cypress/e2e/customerRegistration.js index 5893cfc61..f313a41fe 100644 --- a/cypress/e2e/customerRegistration.js +++ b/cypress/e2e/customerRegistration.js @@ -3,7 +3,7 @@ import faker from "faker"; -import { CUSTOMER_DETAILS } from "../elements/customers/customer-details"; +import { CUSTOMER_DETAILS_SELECTORS } from "../elements/customers/customer-details"; import { BUTTON_SELECTORS } from "../elements/shared/button-selectors"; import { customerDetailsUrl } from "../fixtures/urlList"; import { @@ -76,7 +76,7 @@ describe("Tests for customer registration", () => { cy.clearSessionData() .loginUserViaRequest() .visit(customerDetailsUrl(user.id)) - .get(CUSTOMER_DETAILS.isActiveCheckbox) + .get(CUSTOMER_DETAILS_SELECTORS.isActiveCheckbox) .click() .get(BUTTON_SELECTORS.confirm) .click() diff --git a/cypress/e2e/navigation.js b/cypress/e2e/navigation.js index 39a0a2c8b..0bf5408d1 100644 --- a/cypress/e2e/navigation.js +++ b/cypress/e2e/navigation.js @@ -2,98 +2,460 @@ /// import { - APP_MENU_SELECTORS, - appCommonSelector, - LEFT_MENU_SELECTORS, -} from "../elements/account/left-menu/left-menu-selectors"; + ADDRESS_SELECTORS, + APPS_LIST_SELECTORS, + CATEGORIES_LIST_SELECTORS, + CHANNELS_SELECTORS, + COLLECTION_SELECTORS, + CONFIGURATION_SELECTORS, + CUSTOMERS_LIST_SELECTORS, + DRAFT_ORDERS_LIST_SELECTORS, + LANGUAGES_LIST_SELECTORS, + MENU_SELECTORS, + ORDERS_SELECTORS, + PAGE_TYPES_LIST_SELECTORS, + PAGES_LIST_SELECTORS, + PERMISSION_GROUP_LIST_SELECTORS, + PLUGINS_LIST_SELECTORS, + PRODUCT_TYPES_LIST_SELECTORS, + SALES_SELECTORS, + SHIPPING_ZONES_LIST_SELECTORS, + STAFF_MEMBERS_LIST_SELECTORS, + VOUCHERS_SELECTORS, +} from "../elements/"; import { PERMISSIONS_OPTIONS } from "../fixtures/permissionsUsers"; -import * as permissionsSteps from "../support/pages/permissionsPage"; +import { urlList } from "../fixtures/urlList"; +import { + expectConfigurationAvailableSectionsNumber, + expectConfigurationSectionsToBeVisible, +} from "../support/pages/configurationPage"; +import { + expectMainMenuAvailableSections, + expectMainMenuSectionsToBeVisible, +} from "../support/pages/mainMenuPage"; -// TODO: fix this test after release of new dashboard with sidebar -describe.skip("As a staff user I want to navigate through shop using different permissions", () => { - const permissionsOptions = PERMISSIONS_OPTIONS; - - before(() => { - cy.loginUserViaRequest() - .visit("/") - .get(appCommonSelector) - .should("be.visible") - .get("body") - .then($body => { - // This will be deleted when Marketplace is released - // Consider this solution as temporary - - let appPermissions; - - if ($body.find(LEFT_MENU_SELECTORS.appSection).length) { - appPermissions = { - parent: { - parentMenuSelector: LEFT_MENU_SELECTORS.appSection, - parentSelectors: [APP_MENU_SELECTORS], - }, - permissionSelectors: [APP_MENU_SELECTORS.app], - }; - } else { - appPermissions = { - permissionSelectors: [LEFT_MENU_SELECTORS.app], - }; - } - - permissionsOptions.all.permissions.push(appPermissions); - permissionsOptions.app.permissions = [appPermissions]; - }); - }); - - Object.keys(permissionsOptions).forEach(key => { - if (key !== "all") { - it( - `should be able to navigate through shop as a staff member using ${key} permission. ${permissionsOptions[key].testCase}`, - { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease"] }, - () => { - const permissionOption = permissionsOptions[key]; - const permissions = permissionOption.permissions; - - cy.clearSessionData(); - permissionsSteps.navigateToAllAvailablePageAndCheckIfDisplayed( - permissionOption, - ); - permissionsSteps.getDisplayedSelectors().then(selectors => { - permissionsSteps.expectAllSelectorsPermitted( - permissions, - selectors, - ); - }); - if (!permissions) { - return; - } - permissions.forEach(permission => { - if (permission.parent) { - cy.get(permission.parent.parentMenuSelector).click(); - permissionsSteps - .getDisplayedSelectors(permission.parent.parentSelectors) - .then(parentSelectors => { - permissionsSteps.expectAllSelectorsPermitted( - permissions, - parentSelectors, - ); - }); - } - }); - }, - ); - } +describe("As a staff user I want to navigate through shop using different permissions", () => { + beforeEach(() => { + cy.clearSessionData(); }); + it( + `should be able to navigate through shop as a staff member using DISCOUNTS permission. TC: SALEOR_3405a - sales list`, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.discount.user); + cy.addAliasToGraphRequest("SaleList") + .clickOnElement(MENU_SELECTORS.MENU.discounts) + .waitForRequestAndCheckIfNoErrors("@SaleList"); + cy.checkIfElementIsVisible(SALES_SELECTORS.createSaleButton); + }, + ); + it( + `should be able to navigate through shop as a staff member using DISCOUNTS permission. TC: SALEOR_3405b - voucher list`, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.addAliasToGraphRequest("VoucherList") + .loginUserViaRequest("auth", PERMISSIONS_OPTIONS.discount.user) + .visit(urlList.vouchers) + .waitForRequestAndCheckIfNoErrors("@VoucherList"); + cy.checkIfElementIsVisible(VOUCHERS_SELECTORS.createVoucherButton); + }, + ); it( - `should be able to navigate through shop as a staff member using all permissions. ${permissionsOptions.all.testCase}`, - { tags: ["@critical", "@allEnv", "@navigation", "@stable", "@oldRelease"] }, + `should be able to navigate through shop as a staff member using ORDER permission. TC: SALEOR_3407a - order list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, () => { - const permissionOption = permissionsOptions.all; + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.order.user); + cy.addAliasToGraphRequest("OrderList") + .clickOnElement(MENU_SELECTORS.MENU.orders) + .waitForRequestAndCheckIfNoErrors("@OrderList") + .then(() => { + expectMainMenuAvailableSections(3); + expectMainMenuSectionsToBeVisible( + MENU_SELECTORS.ORDERS.orders, + MENU_SELECTORS.ORDERS.draftOrders, + ); + cy.get(MENU_SELECTORS.ORDERS.orders) + .last() + .click() + .then(() => { + cy.checkIfElementIsVisible(ORDERS_SELECTORS.createOrderButton); + }); + }); + }, + ); - cy.clearSessionData(); - permissionsSteps.navigateToAllAvailablePageAndCheckIfDisplayed( - permissionOption, + it( + `should be able to navigate through shop as a staff member using ORDER permission. TC: SALEOR_3407b - draft list`, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.addAliasToGraphRequest("OrderDraftList") + .loginUserViaRequest("auth", PERMISSIONS_OPTIONS.order.user) + .visit(urlList.draftOrders) + .waitForRequestAndCheckIfNoErrors("@OrderDraftList"); + expectMainMenuAvailableSections(3); + cy.checkIfElementIsVisible( + DRAFT_ORDERS_LIST_SELECTORS.createDraftOrderButton, ); }, ); + + it( + `should be able to navigate through shop as a staff member using APP permission. TC: SALEOR_3402 - app list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.app.user); + expectMainMenuAvailableSections(2); + cy.addAliasToGraphRequest("AppsList") + .clickOnElement(MENU_SELECTORS.MENU.app) + .waitForRequestAndCheckIfNoErrors("@AppsList") + .then(() => { + cy.checkIfElementIsVisible( + APPS_LIST_SELECTORS.createExternalAppButton, + ); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using CHANNEL permission. TC: SALEOR_3403 - channels list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.channel.user); + expectMainMenuAvailableSections(2); + cy.clickOnElement(MENU_SELECTORS.MENU.configuration).then(() => { + expectConfigurationAvailableSectionsNumber(3); + expectConfigurationSectionsToBeVisible( + CONFIGURATION_SELECTORS.taxes, + CONFIGURATION_SELECTORS.webhooks, + CONFIGURATION_SELECTORS.channels, + ); + cy.addAliasToGraphRequest("Channels") + .get(CONFIGURATION_SELECTORS.channels) + .click() + .waitForRequestAndCheckIfNoErrors("@Channels"); + cy.checkIfElementIsVisible(CHANNELS_SELECTORS.createChannelButton); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using CHANNEL permission. TC: SALEOR_3403b - webhooks and events `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.addAliasToGraphRequest("AppsList") + .loginUserViaRequest("auth", PERMISSIONS_OPTIONS.channel.user) + .visit(urlList.webhooksAndEvents) + .waitForRequestAndCheckIfNoErrors("@AppsList"); + expectMainMenuAvailableSections(2); + cy.checkIfElementIsVisible(APPS_LIST_SELECTORS.createLocalAppButton); + }, + ); + + it( + `should be able to navigate through shop as a staff member using CUSTOMER permission. TC: SALEOR_3404 - customer list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.customer.user); + expectMainMenuAvailableSections(2); + cy.addAliasToGraphRequest("ListCustomers") + .clickOnElement(MENU_SELECTORS.MENU.customers) + .waitForRequestAndCheckIfNoErrors("@ListCustomers") + .then(() => { + cy.checkIfElementIsVisible( + CUSTOMERS_LIST_SELECTORS.createCustomerButton, + ); + }); + }, + ); + + // //TODO fix when permissions bug is fixed + it.skip( + `should be able to navigate through shop as a staff member using GIFT CARD permission. TC: SALEOR_3406 - gift cards `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.loginUserViaRequest("auth", PERMISSIONS_OPTIONS.giftCard.user).visit( + urlList.homePage, + ); + expectMainMenuAvailableSections(2); + cy.clickOnElement(MENU_SELECTORS.MENU.products).then(() => { + cy.get(MENU_SELECTORS.CATALOG.giftCards).should("be.visible"); + expectMainMenuAvailableSections(3); + cy.addAliasToGraphRequest("GiftCardList") + .clickOnElement(MENU_SELECTORS.CATALOG.giftCards) + .waitForRequestAndCheckIfNoErrors("@GiftCardList"); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using PAGE permission. TC: SALEOR_3408 - page list`, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.page.user); + expectMainMenuAvailableSections(3); + expectMainMenuSectionsToBeVisible(MENU_SELECTORS.MENU.pages); + cy.addAliasToGraphRequest("SearchPageTypes") + .clickOnElement(MENU_SELECTORS.MENU.pages) + .waitForRequestAndCheckIfNoErrors("@SearchPageTypes") + .then(() => { + cy.checkIfElementIsVisible(PAGES_LIST_SELECTORS.createPageButton); + cy.clickOnElement(MENU_SELECTORS.MENU.configuration).then(() => { + expectConfigurationAvailableSectionsNumber(3); + expectConfigurationSectionsToBeVisible( + CONFIGURATION_SELECTORS.taxes, + CONFIGURATION_SELECTORS.webhooks, + CONFIGURATION_SELECTORS.pageTypes, + ); + }); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using PAGE - permission. TC: SALEOR_3408b - page types list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.addAliasToGraphRequest("PageTypeList") + .loginUserViaRequest("auth", PERMISSIONS_OPTIONS.page.user) + .visit(urlList.pageTypes) + .waitForRequestAndCheckIfNoErrors("@PageTypeList"); + expectMainMenuAvailableSections(3); + cy.checkIfElementIsVisible( + PAGE_TYPES_LIST_SELECTORS.createPageTypeButton, + ); + }, + ); + + it( + `should be able to navigate through shop as a staff member using PLUGIN permission. TC: SALEOR_3409 - plugins list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.plugin.user); + expectMainMenuAvailableSections(2); + cy.clickOnElement(MENU_SELECTORS.MENU.configuration).then(() => { + expectConfigurationAvailableSectionsNumber(3); + expectConfigurationSectionsToBeVisible( + CONFIGURATION_SELECTORS.taxes, + CONFIGURATION_SELECTORS.webhooks, + CONFIGURATION_SELECTORS.plugin, + ); + cy.addAliasToGraphRequest("Plugins") + .clickOnElement(CONFIGURATION_SELECTORS.plugin) + .waitForRequestAndCheckIfNoErrors("@Plugins"); + cy.checkIfElementIsVisible(PLUGINS_LIST_SELECTORS.pluginRow); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using PRODUCT TYPE AND ATTRIBUTE permission. TC: SALEOR_3411 - product type list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi( + PERMISSIONS_OPTIONS.productTypeAndAttribute.user, + ); + expectMainMenuAvailableSections(2); + cy.clickOnElement(MENU_SELECTORS.MENU.configuration).then(() => { + expectConfigurationAvailableSectionsNumber(4); + expectConfigurationSectionsToBeVisible( + CONFIGURATION_SELECTORS.taxes, + CONFIGURATION_SELECTORS.productTypes, + CONFIGURATION_SELECTORS.attributes, + CONFIGURATION_SELECTORS.webhooks, + ); + cy.addAliasToGraphRequest("ProductTypeList") + .clickOnElement(CONFIGURATION_SELECTORS.productTypes) + .waitForRequestAndCheckIfNoErrors("@ProductTypeList"); + cy.checkIfElementIsVisible( + PRODUCT_TYPES_LIST_SELECTORS.addProductTypeButton, + ); + }); + }, + ); + + // //TODO fix when permissions bug is fixed + it.skip( + `should be able to navigate through shop as a staff member using PRODUCT TYPE AND ATTRIBUTE permission. TC: SALEOR_3411b - attribute list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.addAliasToGraphRequest("AttributeList") + .loginUserViaRequest( + "auth", + PERMISSIONS_OPTIONS.productTypeAndAttribute.user, + ) + .visit(urlList.attributes) + .waitForRequestAndCheckIfNoErrors("@AttributeList"); + // expectMainMenuAvailableSections(2); + cy.checkIfElementIsVisible(ATTRIBUTES_LIST.createAttributeButton); + }, + ); + + it( + `should be able to navigate through shop as a staff member using PAGE TYPE AND ATTRIBUTE permission. TC: SALEOR_3412 - page type list`, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi( + PERMISSIONS_OPTIONS.pageTypeAndAttribute.user, + ); + expectMainMenuAvailableSections(2); + cy.clickOnElement(MENU_SELECTORS.MENU.configuration).then(() => { + expectConfigurationAvailableSectionsNumber(4); + expectConfigurationSectionsToBeVisible( + CONFIGURATION_SELECTORS.taxes, + CONFIGURATION_SELECTORS.attributes, + CONFIGURATION_SELECTORS.webhooks, + CONFIGURATION_SELECTORS.pageTypes, + ); + cy.addAliasToGraphRequest("PageTypeList") + .clickOnElement(CONFIGURATION_SELECTORS.pageTypes) + .waitForRequestAndCheckIfNoErrors("@PageTypeList"); + cy.checkIfElementIsVisible( + PAGE_TYPES_LIST_SELECTORS.createPageTypeButton, + ); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using SETTINGS permission. TC: SALEOR_3413 - company settings `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.settings.user); + expectMainMenuAvailableSections(2); + cy.clickOnElement(MENU_SELECTORS.MENU.configuration).then(() => { + expectConfigurationAvailableSectionsNumber(3); + expectConfigurationSectionsToBeVisible( + CONFIGURATION_SELECTORS.taxes, + CONFIGURATION_SELECTORS.settings, + CONFIGURATION_SELECTORS.webhooks, + ); + cy.addAliasToGraphRequest("SiteSettings") + .clickOnElement(CONFIGURATION_SELECTORS.settings) + .waitForRequestAndCheckIfNoErrors("@SiteSettings"); + cy.get(ADDRESS_SELECTORS.companyInfoSection) + .scrollIntoView() + .should("be.visible"); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using STAFF permission. TC: SALEOR_3414 - staff list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.staff.user); + expectMainMenuAvailableSections(2); + cy.clickOnElement(MENU_SELECTORS.MENU.configuration).then(() => { + expectConfigurationAvailableSectionsNumber(4); + expectConfigurationSectionsToBeVisible( + CONFIGURATION_SELECTORS.taxes, + CONFIGURATION_SELECTORS.permissionGroups, + CONFIGURATION_SELECTORS.staffMembers, + CONFIGURATION_SELECTORS.webhooks, + ); + cy.addAliasToGraphRequest("StaffList") + .clickOnElement(CONFIGURATION_SELECTORS.staffMembers) + .waitForRequestAndCheckIfNoErrors("@StaffList"); + cy.checkIfElementIsVisible( + STAFF_MEMBERS_LIST_SELECTORS.inviteStaffMemberButton, + ); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using STAFF permission. TC: SALEOR_3414b - permission group `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.addAliasToGraphRequest("PermissionGroupList") + .loginUserViaRequest("auth", PERMISSIONS_OPTIONS.staff.user) + .visit(urlList.permissionsGroups) + .waitForRequestAndCheckIfNoErrors("@PermissionGroupList"); + expectMainMenuAvailableSections(2); + cy.checkIfElementIsVisible( + PERMISSION_GROUP_LIST_SELECTORS.createPermissionButton, + ); + }, + ); + + it( + `should be able to navigate through shop as a staff member using SHIPPING permission. TC: SALEOR_3415 - shipping zones `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.shipping.user); + expectMainMenuAvailableSections(2); + cy.clickOnElement(MENU_SELECTORS.MENU.configuration).then(() => { + expectConfigurationAvailableSectionsNumber(3); + expectConfigurationSectionsToBeVisible( + CONFIGURATION_SELECTORS.taxes, + CONFIGURATION_SELECTORS.shipping, + CONFIGURATION_SELECTORS.webhooks, + ); + cy.addAliasToGraphRequest("ShippingZones") + .clickOnElement(CONFIGURATION_SELECTORS.shipping) + .waitForRequestAndCheckIfNoErrors("@ShippingZones"); + cy.checkIfElementIsVisible( + SHIPPING_ZONES_LIST_SELECTORS.addShippingZone, + ); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using TRANSLATION permission. TC: SALEOR_3416 - translations list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.translations.user); + expectMainMenuAvailableSections(2); + cy.clickOnElement(MENU_SELECTORS.MENU.translations).then(() => { + cy.checkIfElementIsVisible( + LANGUAGES_LIST_SELECTORS.translationListView, + ); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using PRODUCT permission. TC: SALEOR_3410a - products list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.visitHomePageLoggedViaApi(PERMISSIONS_OPTIONS.product.user); + cy.addAliasToGraphRequest("ProductList") + .clickOnElement(MENU_SELECTORS.MENU.products) + .waitForRequestAndCheckIfNoErrors("@ProductList") + .then(() => { + cy.get(MENU_SELECTORS.CATALOG.products).last().should("be.visible"); + cy.get(MENU_SELECTORS.CATALOG.categories).should("be.visible"); + cy.get(MENU_SELECTORS.CATALOG.collections).should("be.visible"); + expectMainMenuAvailableSections(5); + }); + }, + ); + + it( + `should be able to navigate through shop as a staff member using PRODUCT permission. TC: SALEOR_3410b - categories list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.addAliasToGraphRequest("RootCategories") + .loginUserViaRequest("auth", PERMISSIONS_OPTIONS.product.user) + .visit(urlList.categories) + .waitForRequestAndCheckIfNoErrors("@RootCategories"); + expectMainMenuAvailableSections(5); + cy.checkIfElementIsVisible(CATEGORIES_LIST_SELECTORS.addCategoryButton); + }, + ); + + it( + `should be able to navigate through shop as a staff member using PRODUCT permission. TC: SALEOR_3410c - collections list `, + { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] }, + () => { + cy.addAliasToGraphRequest("CollectionList") + .loginUserViaRequest("auth", PERMISSIONS_OPTIONS.product.user) + .visit(urlList.collections) + .waitForRequestAndCheckIfNoErrors("@CollectionList"); + expectMainMenuAvailableSections(5); + cy.checkIfElementIsVisible(COLLECTION_SELECTORS.createCollectionButton); + }, + ); }); diff --git a/cypress/e2e/orders/channelsInDraftOrders.js b/cypress/e2e/orders/channelsInDraftOrders.js index 8d6db12a3..113f2d596 100644 --- a/cypress/e2e/orders/channelsInDraftOrders.js +++ b/cypress/e2e/orders/channelsInDraftOrders.js @@ -52,9 +52,7 @@ xdescribe("Channels in draft orders", () => { channelName = channelInHeader; }, ); - cy.visit(urlList.orders) - .get(ORDERS_SELECTORS.createOrder) - .click(); + cy.visit(urlList.orders).get(ORDERS_SELECTORS.createOrderButton).click(); cy.getTextFromElement(CHANNEL_FORM_SELECTORS.channelSelect).then( selectedChannelName => { expect(channelName).to.contains(selectedChannelName); @@ -76,7 +74,7 @@ xdescribe("Channels in draft orders", () => { cy.visit(urlList.homePage); selectChannelInHeader(otherChannel.name); cy.visit(urlList.orders); - cy.get(ORDERS_SELECTORS.createOrder).click(); + cy.get(ORDERS_SELECTORS.createOrderButton).click(); cy.getTextFromElement(CHANNEL_FORM_SELECTORS.channelSelect).then( channelInSelect => { expect(channelInSelect).to.be.eq(otherChannel.name); @@ -98,7 +96,7 @@ xdescribe("Channels in draft orders", () => { cy.visit(urlList.homePage); selectChannelInHeader(defaultChannel.name); cy.visit(urlList.orders); - cy.get(ORDERS_SELECTORS.createOrder).click(); + cy.get(ORDERS_SELECTORS.createOrderButton).click(); cy.getTextFromElement(CHANNEL_FORM_SELECTORS.channelSelect).then( channelInSelect => { expect(channelInSelect).to.be.eq(defaultChannel.name); diff --git a/cypress/e2e/orders/draftOrders.js b/cypress/e2e/orders/draftOrders.js index 2d2e3c0ed..d69e3da92 100644 --- a/cypress/e2e/orders/draftOrders.js +++ b/cypress/e2e/orders/draftOrders.js @@ -91,7 +91,7 @@ xdescribe("Draft orders", () => { () => { cy.visit(urlList.orders); cy.expectSkeletonIsVisible(); - cy.get(ORDERS_SELECTORS.createOrder).click(); + cy.get(ORDERS_SELECTORS.createOrderButton).click(); selectChannelInPicker(defaultChannel.name); finalizeDraftOrder(randomName, address).then(draftOrderNumber => { cy.visit(urlList.orders); diff --git a/cypress/e2e/orders/orders.js b/cypress/e2e/orders/orders.js index 874916e6a..0694ffdbf 100644 --- a/cypress/e2e/orders/orders.js +++ b/cypress/e2e/orders/orders.js @@ -127,7 +127,7 @@ describe("Orders", () => { "should create order with selected channel. TC: SALEOR_2104", { tags: ["@orders", "@allEnv", "@stable", "@oldRelease"] }, () => { - cy.visit(urlList.orders).get(ORDERS_SELECTORS.createOrder).click(); + cy.visit(urlList.orders).get(ORDERS_SELECTORS.createOrderButton).click(); selectChannelInPicker(defaultChannel.name); finalizeDraftOrder(randomName, address); }, diff --git a/cypress/e2e/pages/pageTypes.js b/cypress/e2e/pages/pageTypes.js index eeb44bd9e..499df33d1 100644 --- a/cypress/e2e/pages/pageTypes.js +++ b/cypress/e2e/pages/pageTypes.js @@ -3,8 +3,8 @@ import faker from "faker"; -import { PAGE_TYPE_DETAILS } from "../../elements/pageTypes/pageTypeDetails"; -import { PAGE_TYPES_LIST } from "../../elements/pageTypes/pageTypesList"; +import { PAGE_TYPE_DETAILS_SELECTORS } from "../../elements/pageTypes/pageTypeDetails"; +import { PAGE_TYPES_LIST_SELECTORS } from "../../elements/pageTypes/pageTypesList"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { pageTypeDetailsUrl, urlList } from "../../fixtures/urlList"; @@ -28,9 +28,9 @@ describe("Tests for page types", () => { const randomName = startsWith + faker.datatype.number(); cy.visit(urlList.pageTypes) - .get(PAGE_TYPES_LIST.createPageTypeButton) + .get(PAGE_TYPES_LIST_SELECTORS.createPageTypeButton) .click() - .get(PAGE_TYPE_DETAILS.nameInput) + .get(PAGE_TYPE_DETAILS_SELECTORS.nameInput) .type(randomName) .addAliasToGraphRequest("PageTypeCreate") .get(BUTTON_SELECTORS.confirm) @@ -59,7 +59,7 @@ describe("Tests for page types", () => { cy.visit(pageTypeDetailsUrl(pageType.id)) .get(SHARED_ELEMENTS.progressBar) .should("be.not.visible") - .get(PAGE_TYPE_DETAILS.assignAttributesButton) + .get(PAGE_TYPE_DETAILS_SELECTORS.assignAttributesButton) .click() .assignElements(randomName) .confirmationMessageShouldDisappear(); diff --git a/cypress/e2e/pages/pages.js b/cypress/e2e/pages/pages.js index 647891f59..e33992de1 100644 --- a/cypress/e2e/pages/pages.js +++ b/cypress/e2e/pages/pages.js @@ -3,7 +3,7 @@ import faker from "faker"; -import { PAGE_DETAILS } from "../../elements/pages/page-details"; +import { PAGE_DETAILS_SELECTORS } from "../../elements/pages/page-details"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { pageDetailsUrl } from "../../fixtures/urlList"; import { createAttribute } from "../../support/api/requests/Attribute"; @@ -161,9 +161,9 @@ describe("Tests for pages", () => { }) .then(({ page }) => { cy.visit(pageDetailsUrl(page.id)) - .get(PAGE_DETAILS.nameInput) + .get(PAGE_DETAILS_SELECTORS.nameInput) .clearAndType(updatedName) - .get(PAGE_DETAILS.isNotPublishedCheckbox) + .get(PAGE_DETAILS_SELECTORS.isNotPublishedCheckbox) .click() .addAliasToGraphRequest("PageUpdate") .get(BUTTON_SELECTORS.confirm) diff --git a/cypress/e2e/staffMembers.js b/cypress/e2e/staffMembers.js index c2d80fa1f..2678894ec 100644 --- a/cypress/e2e/staffMembers.js +++ b/cypress/e2e/staffMembers.js @@ -7,9 +7,9 @@ import { LEFT_MENU_SELECTORS } from "../elements/account/left-menu/left-menu-sel import { LOGIN_SELECTORS } from "../elements/account/login-selectors"; import { BUTTON_SELECTORS } from "../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../elements/shared/sharedElements"; -import { INVITE_STAFF_MEMBER_FORM } from "../elements/staffMembers/inviteStaffMemberForm"; -import { STAFF_MEMBER_DETAILS } from "../elements/staffMembers/staffMemberDetails"; -import { STAFF_MEMBERS_LIST } from "../elements/staffMembers/staffMembersList"; +import { INVITE_STAFF_MEMBER_FORM_SELECTORS } from "../elements/staffMembers/inviteStaffMemberForm"; +import { STAFF_MEMBER_DETAILS_SELECTORS } from "../elements/staffMembers/staffMemberDetails"; +import { STAFF_MEMBERS_LIST_SELECTORS } from "../elements/staffMembers/staffMembersList"; import { urlList, userDetailsUrl } from "../fixtures/urlList"; import { TEST_ADMIN_USER } from "../fixtures/users"; import { activatePlugin, updatePlugin } from "../support/api/requests/Plugins"; @@ -70,7 +70,7 @@ describe("Staff members", () => { cy.visit(urlList.staffMembers) .expectSkeletonIsVisible() - .get(STAFF_MEMBERS_LIST.inviteStaffMemberButton) + .get(STAFF_MEMBERS_LIST_SELECTORS.inviteStaffMemberButton) .click({ force: true }); fillUpUserDetailsAndAddFirstPermission(firstName, lastName, emailInvite); getMailActivationLinkForUser(emailInvite).then(urlLink => { @@ -122,7 +122,7 @@ describe("Staff members", () => { const serverStoredEmail = email.toLowerCase(); cy.visit(userDetailsUrl(user.id)) - .get(STAFF_MEMBER_DETAILS.removePermissionButton) + .get(STAFF_MEMBER_DETAILS_SELECTORS.removePermissionButton) .click() .addAliasToGraphRequest("StaffMemberUpdate") .get(BUTTON_SELECTORS.confirm) @@ -186,10 +186,10 @@ describe("Staff members", () => { const emailInvite = TEST_ADMIN_USER.email; cy.visit(urlList.staffMembers) .expectSkeletonIsVisible() - .get(STAFF_MEMBERS_LIST.inviteStaffMemberButton) + .get(STAFF_MEMBERS_LIST_SELECTORS.inviteStaffMemberButton) .click({ force: true }); fillUpOnlyUserDetails(firstName, lastName, emailInvite); - cy.get(INVITE_STAFF_MEMBER_FORM.emailValidationMessage).should( + cy.get(INVITE_STAFF_MEMBER_FORM_SELECTORS.emailValidationMessage).should( "be.visible", ); cy.get(BUTTON_SELECTORS.dialogBackButton).click(); @@ -206,13 +206,15 @@ describe("Staff members", () => { .get(SHARED_ELEMENTS.searchInput) .type(`${email} {enter}`); cy.waitForProgressBarToNotExist(); - cy.get(STAFF_MEMBERS_LIST.staffAvatar).first().should("be.visible"); + cy.get(STAFF_MEMBERS_LIST_SELECTORS.staffAvatar) + .first() + .should("be.visible"); cy.waitForProgressBarToNotExist() - .get(STAFF_MEMBERS_LIST.staffStatusText) + .get(STAFF_MEMBERS_LIST_SELECTORS.staffStatusText) .first() .should("be.visible") .click(); - cy.get(STAFF_MEMBER_DETAILS.staffEmail) + cy.get(STAFF_MEMBER_DETAILS_SELECTORS.staffEmail) .click() .clear() .type(`${TEST_ADMIN_USER.email} {enter}`) @@ -250,9 +252,15 @@ describe("Staff members", () => { cy.visit(urlList.staffMembers).get(LOGIN_SELECTORS.userMenu).click(); cy.get(LOGIN_SELECTORS.accountSettings).click(); - cy.get(STAFF_MEMBER_DETAILS.staffFirstName).clear().type("สมชาย"); - cy.get(STAFF_MEMBER_DETAILS.staffLastName).clear().type(newLastName); - cy.get(STAFF_MEMBER_DETAILS.staffEmail).clear().type(changedEmail); + cy.get(STAFF_MEMBER_DETAILS_SELECTORS.staffFirstName) + .clear() + .type("สมชาย"); + cy.get(STAFF_MEMBER_DETAILS_SELECTORS.staffLastName) + .clear() + .type(newLastName); + cy.get(STAFF_MEMBER_DETAILS_SELECTORS.staffEmail) + .clear() + .type(changedEmail); // Test blocked from this point by https://github.com/saleor/saleor-dashboard/issues/2847 cy.get(BUTTON_SELECTORS.confirm).confirmationMessageShouldAppear(); @@ -292,13 +300,13 @@ describe("Staff members", () => { cy.visit(urlList.staffMembers).get(LOGIN_SELECTORS.userMenu).click(); cy.get(LOGIN_SELECTORS.accountSettings).click(); - cy.get(STAFF_MEMBER_DETAILS.changePasswordBtn).click(); - cy.get(STAFF_MEMBER_DETAILS.changePasswordModal.oldPassword).type( - Cypress.env("USER_PASSWORD"), - ); - cy.get(STAFF_MEMBER_DETAILS.changePasswordModal.newPassword).type( - newPass, - ); + cy.get(STAFF_MEMBER_DETAILS_SELECTORS.changePasswordBtn).click(); + cy.get( + STAFF_MEMBER_DETAILS_SELECTORS.changePasswordModal.oldPassword, + ).type(Cypress.env("USER_PASSWORD")); + cy.get( + STAFF_MEMBER_DETAILS_SELECTORS.changePasswordModal.newPassword, + ).type(newPass); cy.get(BUTTON_SELECTORS.submit).click().confirmationMessageShouldAppear(); cy.clearSessionData().loginUserViaRequest("auth", { diff --git a/cypress/elements/account/index.js b/cypress/elements/account/index.js new file mode 100644 index 000000000..ec52952fe --- /dev/null +++ b/cypress/elements/account/index.js @@ -0,0 +1,5 @@ +import * as MENU_SELECTORS from "./left-menu/left-menu-selectors"; +import * as LOGIN_SELECTORS from "./login-selectors"; +import * as SET_PASSWORD_SELECTORS from "./login-selectors"; + +export { MENU_SELECTORS, LOGIN_SELECTORS, SET_PASSWORD_SELECTORS }; diff --git a/cypress/elements/account/left-menu/left-menu-selectors.js b/cypress/elements/account/left-menu/left-menu-selectors.js index d2234faa3..23d44c7d1 100644 --- a/cypress/elements/account/left-menu/left-menu-selectors.js +++ b/cypress/elements/account/left-menu/left-menu-selectors.js @@ -1,4 +1,4 @@ -export const LEFT_MENU_SELECTORS = { +export const MENU = { catalog: "[data-test-id='menu-item-label-catalogue']", pages: "[data-test-id='menu-item-label-pages']", configuration: "[data-test-id='menu-item-label-configure']", @@ -9,8 +9,12 @@ export const LEFT_MENU_SELECTORS = { app: "[data-test-id='menu-item-label-apps']", translations: "[data-test-id='menu-item-label-translations']", customers: "[data-test-id='menu-item-label-customers']", + list: "[data-test-id='menu-list']", + listItem: "[data-test-id='menu-list-item']", + products: "[data-test-id='menu-item-label-products']", + menuItem: "[data-test-id*='menu-item-label-']", }; -export const DISCOUNTS_MENU_SELECTORS = { +export const DISCOUNTS = { sales: "[data-test-id='menu-item-label-sales']", vouchers: "[data-test-id='menu-item-label-vouchers']", }; @@ -22,9 +26,10 @@ export const CATALOG = { products: "[data-test-id='menu-item-label-products']", categories: "[data-test-id='menu-item-label-categories']", collections: "[data-test-id='menu-item-label-collections']", + giftCards: "[data-test-id='menu-item-label-giftCards']", }; -export const APP_MENU_SELECTORS = { +export const APP = { app: "[data-test-id='menu-item-label-apps']", }; diff --git a/cypress/elements/apps/appsList.js b/cypress/elements/apps/appsList.js index e46683d48..65fbc08eb 100644 --- a/cypress/elements/apps/appsList.js +++ b/cypress/elements/apps/appsList.js @@ -1,3 +1,4 @@ -export const APPS_LIST = { +export const APPS_LIST_SELECTORS = { createLocalAppButton: '[data-test-id="create-app"]', + createExternalAppButton: '[data-test-id="add-app-from-manifest"]', }; diff --git a/cypress/elements/apps/index.js b/cypress/elements/apps/index.js new file mode 100644 index 000000000..69b1855d7 --- /dev/null +++ b/cypress/elements/apps/index.js @@ -0,0 +1,3 @@ +import { APPS_LIST_SELECTORS } from "./appsList"; + +export { APPS_LIST_SELECTORS }; diff --git a/cypress/elements/attribute/index.js b/cypress/elements/attribute/index.js new file mode 100644 index 000000000..ce5785c7d --- /dev/null +++ b/cypress/elements/attribute/index.js @@ -0,0 +1,4 @@ +import { ATTRIBUTES_DETAILS } from "./attributes_details"; +import { ATTRIBUTES_LIST } from "./attributes_list"; + +export { ATTRIBUTES_DETAILS, ATTRIBUTES_LIST }; diff --git a/cypress/elements/catalog/categories/categories-list.js b/cypress/elements/catalog/categories/categories-list.js index b28502527..46551ca09 100644 --- a/cypress/elements/catalog/categories/categories-list.js +++ b/cypress/elements/catalog/categories/categories-list.js @@ -1,5 +1,5 @@ -export const CATEGORIES_LIST = { - addCategoryButton: '[data-test-id="create-category"]' +export const CATEGORIES_LIST_SELECTORS = { + addCategoryButton: '[data-test-id="create-category"]', }; export const categoryRow = categoryId => `[data-test-id*="${categoryId}"]`; diff --git a/cypress/elements/catalog/categories/category-details.js b/cypress/elements/catalog/categories/category-details.js index 480060a33..7616f003d 100644 --- a/cypress/elements/catalog/categories/category-details.js +++ b/cypress/elements/catalog/categories/category-details.js @@ -1,4 +1,4 @@ -export const CATEGORY_DETAILS = { +export const CATEGORY_DETAILS_SELECTORS = { nameInput: '[name="name"]', descriptionInput: '[data-test-id="rich-text-editor-description"]', createSubcategoryButton: '[data-test-id="create-subcategory"]', diff --git a/cypress/elements/catalog/categories/index.js b/cypress/elements/catalog/categories/index.js new file mode 100644 index 000000000..76a253bce --- /dev/null +++ b/cypress/elements/catalog/categories/index.js @@ -0,0 +1,4 @@ +import { CATEGORIES_LIST_SELECTORS } from "./categories-list"; +import { CATEGORY_DETAILS_SELECTORS } from "./category-details"; + +export { CATEGORIES_LIST_SELECTORS, CATEGORY_DETAILS_SELECTORS }; diff --git a/cypress/elements/catalog/index.js b/cypress/elements/catalog/index.js new file mode 100644 index 000000000..e66e70522 --- /dev/null +++ b/cypress/elements/catalog/index.js @@ -0,0 +1,11 @@ +import { + CATEGORIES_LIST_SELECTORS, + CATEGORY_DETAILS_SELECTORS, +} from "./categories"; +import { COLLECTION_SELECTORS } from "./collection-selectors"; + +export { + CATEGORIES_LIST_SELECTORS, + CATEGORY_DETAILS_SELECTORS, + COLLECTION_SELECTORS, +}; diff --git a/cypress/elements/channels/index.js b/cypress/elements/channels/index.js new file mode 100644 index 000000000..9928cf9e4 --- /dev/null +++ b/cypress/elements/channels/index.js @@ -0,0 +1,3 @@ +import { CHANNELS_SELECTORS } from "./channels-selectors"; + +export { CHANNELS_SELECTORS }; diff --git a/cypress/elements/configuration/configuration-selectors.js b/cypress/elements/configuration/configuration-selectors.js index f3e9adbcd..6fbc46f31 100644 --- a/cypress/elements/configuration/configuration-selectors.js +++ b/cypress/elements/configuration/configuration-selectors.js @@ -2,6 +2,7 @@ export const CONFIGURATION_SELECTORS = { channels: "[data-test-id*='channels']", shipping: '[data-test-id*="shipping methods"]', taxes: '[data-test-id*="configuration-menu-taxes"]', + webhooks: '[data-test-id*="configuration-menu-webhooks"]', settings: '[data-test-id*="configuration-menu-site-settings"]', pageTypes: '[data-test-id*="configuration-menu-page-types"]', navigation: '[data-test-id*="configuration-menu-navigation"]', @@ -10,5 +11,7 @@ export const CONFIGURATION_SELECTORS = { attributes: '[data-test-id*="configuration-menu-attributes"]', productTypes: '[data-test-id*="configuration-menu-product-types"]', plugin: '[data-test-id*="configuration-plugins-pages"]', - warehouse: '[data-test-id*="configuration-menu-warehouses"]' + warehouse: '[data-test-id*="configuration-menu-warehouses"]', + configurationMenu: "[data-test-id='configuration-menu']", + configurationMenuItem: "[data-test-id='configuration-menu-item']", }; diff --git a/cypress/elements/customer/customer-details.js b/cypress/elements/customer/customer-details.js index 8c8cc4571..f956a61ae 100644 --- a/cypress/elements/customer/customer-details.js +++ b/cypress/elements/customer/customer-details.js @@ -1,4 +1,4 @@ -export const CUSTOMER_DETAILS = { +export const CUSTOMER_DETAILS_SELECTORS = { nameInput: '[name="firstName"]', customerAddressNameInput: '[name="customerFirstName"]', lastNameInput: '[name="lastName"]', diff --git a/cypress/elements/customer/customers-list.js b/cypress/elements/customer/customers-list.js index f75e2f661..01e195bf3 100644 --- a/cypress/elements/customer/customers-list.js +++ b/cypress/elements/customer/customers-list.js @@ -1,3 +1,3 @@ -export const CUSTOMERS_LIST = { - createCustomerButton: '[data-test-id="create-customer"]' +export const CUSTOMERS_LIST_SELECTORS = { + createCustomerButton: '[data-test-id="create-customer"]', }; diff --git a/cypress/elements/customer/index.js b/cypress/elements/customer/index.js new file mode 100644 index 000000000..7856a64c1 --- /dev/null +++ b/cypress/elements/customer/index.js @@ -0,0 +1,4 @@ +import { CUSTOMER_DETAILS_SELECTORS } from "./customer-details"; +import { CUSTOMERS_LIST_SELECTORS } from "./customers-list"; + +export { CUSTOMER_DETAILS_SELECTORS, CUSTOMERS_LIST_SELECTORS }; diff --git a/cypress/elements/customers/customer-details.js b/cypress/elements/customers/customer-details.js index 1c92c0650..f898f8cc8 100644 --- a/cypress/elements/customers/customer-details.js +++ b/cypress/elements/customers/customer-details.js @@ -1,3 +1,3 @@ -export const CUSTOMER_DETAILS = { - isActiveCheckbox: '[name="isActive"]' +export const CUSTOMER_DETAILS_SELECTORS = { + isActiveCheckbox: '[name="isActive"]', }; diff --git a/cypress/elements/discounts/index.js b/cypress/elements/discounts/index.js new file mode 100644 index 000000000..bdc576dae --- /dev/null +++ b/cypress/elements/discounts/index.js @@ -0,0 +1,4 @@ +import { SALES_SELECTORS } from "./sales"; +import { VOUCHERS_SELECTORS } from "./vouchers"; + +export { SALES_SELECTORS, VOUCHERS_SELECTORS }; diff --git a/cypress/elements/index.js b/cypress/elements/index.js new file mode 100644 index 000000000..e5d97e41e --- /dev/null +++ b/cypress/elements/index.js @@ -0,0 +1,79 @@ +import { + LOGIN_SELECTORS, + MENU_SELECTORS, + SET_PASSWORD_SELECTORS, +} from "./account/"; +import { APPS_LIST_SELECTORS } from "./apps"; +import { ATTRIBUTES_DETAILS, ATTRIBUTES_LIST } from "./attribute"; +import { + CATEGORIES_LIST_SELECTORS, + CATEGORY_DETAILS_SELECTORS, + COLLECTION_SELECTORS, +} from "./catalog"; +import { CHANNELS_SELECTORS } from "./channels"; +import { CONFIGURATION_SELECTORS } from "./configuration/configuration-selectors"; +import { + CUSTOMER_DETAILS_SELECTORS, + CUSTOMERS_LIST_SELECTORS, +} from "./customer/"; +import { SALES_SELECTORS, VOUCHERS_SELECTORS } from "./discounts"; +import { DRAFT_ORDERS_LIST_SELECTORS, ORDERS_SELECTORS } from "./orders"; +import { PAGE_DETAILS_SELECTORS, PAGES_LIST_SELECTORS } from "./pages/"; +import { + PAGE_TYPE_DETAILS_SELECTORS, + PAGE_TYPES_LIST_SELECTORS, +} from "./pageTypes"; +import { + PERMISSION_GROUP_DETAILS_SELECTORS, + PERMISSION_GROUP_LIST_SELECTORS, +} from "./permissionGroup"; +import { PLUGINS_DETAILS_SELECTORS, PLUGINS_LIST_SELECTORS } from "./plugins"; +import { + PRODUCT_TYPE_DETAILS_SELECTORS, + PRODUCT_TYPES_LIST_SELECTORS, +} from "./productTypes"; +import { ADDRESS_SELECTORS, SHARED_ELEMENTS } from "./shared"; +import { SHIPPING_ZONES_LIST_SELECTORS } from "./shipping"; +import { + INVITE_STAFF_MEMBER_FORM_SELECTORS, + STAFF_MEMBER_DETAILS_SELECTORS, + STAFF_MEMBERS_LIST_SELECTORS, +} from "./staffMembers"; +import { LANGUAGES_LIST_SELECTORS } from "./translations"; + +export { + ADDRESS_SELECTORS, + APPS_LIST_SELECTORS, + ATTRIBUTES_DETAILS, + ATTRIBUTES_LIST, + CATEGORIES_LIST_SELECTORS, + CATEGORY_DETAILS_SELECTORS, + CHANNELS_SELECTORS, + COLLECTION_SELECTORS, + CONFIGURATION_SELECTORS, + CUSTOMER_DETAILS_SELECTORS, + CUSTOMERS_LIST_SELECTORS, + DRAFT_ORDERS_LIST_SELECTORS, + INVITE_STAFF_MEMBER_FORM_SELECTORS, + LANGUAGES_LIST_SELECTORS, + LOGIN_SELECTORS, + MENU_SELECTORS, + ORDERS_SELECTORS, + PAGE_DETAILS_SELECTORS, + PAGE_TYPE_DETAILS_SELECTORS, + PAGE_TYPES_LIST_SELECTORS, + PAGES_LIST_SELECTORS, + PERMISSION_GROUP_DETAILS_SELECTORS, + PERMISSION_GROUP_LIST_SELECTORS, + PLUGINS_DETAILS_SELECTORS, + PLUGINS_LIST_SELECTORS, + PRODUCT_TYPE_DETAILS_SELECTORS, + PRODUCT_TYPES_LIST_SELECTORS, + SALES_SELECTORS, + SET_PASSWORD_SELECTORS, + SHARED_ELEMENTS, + SHIPPING_ZONES_LIST_SELECTORS, + STAFF_MEMBER_DETAILS_SELECTORS, + STAFF_MEMBERS_LIST_SELECTORS, + VOUCHERS_SELECTORS, +}; diff --git a/cypress/elements/orders/draft-orders-list-selectors.js b/cypress/elements/orders/draft-orders-list-selectors.js index 48f1694ea..08c34bddd 100644 --- a/cypress/elements/orders/draft-orders-list-selectors.js +++ b/cypress/elements/orders/draft-orders-list-selectors.js @@ -1,3 +1,4 @@ export const DRAFT_ORDERS_LIST_SELECTORS = { - draftOrderRow: "[data-test-id='draft-order-table-row']" + draftOrderRow: "[data-test-id='draft-order-table-row']", + createDraftOrderButton: "[data-test-id='create-draft-order-button']", }; diff --git a/cypress/elements/orders/index.js b/cypress/elements/orders/index.js new file mode 100644 index 000000000..7aac0d0c1 --- /dev/null +++ b/cypress/elements/orders/index.js @@ -0,0 +1,4 @@ +import { DRAFT_ORDERS_LIST_SELECTORS } from "./draft-orders-list-selectors"; +import { ORDERS_SELECTORS } from "./orders-selectors"; + +export { DRAFT_ORDERS_LIST_SELECTORS, ORDERS_SELECTORS }; diff --git a/cypress/elements/orders/orders-selectors.js b/cypress/elements/orders/orders-selectors.js index 2cf7ee895..e9309c376 100644 --- a/cypress/elements/orders/orders-selectors.js +++ b/cypress/elements/orders/orders-selectors.js @@ -1,6 +1,6 @@ export const ORDERS_SELECTORS = { orders: "[data-test-id='menu-item-label'][data-test-id='orders']", - createOrder: "[data-test-id='create-order-button']", + createOrderButton: "[data-test-id='create-order-button']", orderRow: "[data-test-id='order-table-row']", salesChannel: "[data-test-id='order-sales-channel']", cancelFulfillment: "[data-test-id='cancel-fulfillment-button']", diff --git a/cypress/elements/pageTypes/index.js b/cypress/elements/pageTypes/index.js new file mode 100644 index 000000000..f816d0951 --- /dev/null +++ b/cypress/elements/pageTypes/index.js @@ -0,0 +1,4 @@ +import { PAGE_TYPE_DETAILS_SELECTORS } from "./pageTypeDetails"; +import { PAGE_TYPES_LIST_SELECTORS } from "./pageTypesList"; + +export { PAGE_TYPE_DETAILS_SELECTORS, PAGE_TYPES_LIST_SELECTORS }; diff --git a/cypress/elements/pageTypes/pageTypeDetails.js b/cypress/elements/pageTypes/pageTypeDetails.js index ddc197d50..7cdeafb05 100644 --- a/cypress/elements/pageTypes/pageTypeDetails.js +++ b/cypress/elements/pageTypes/pageTypeDetails.js @@ -1,4 +1,4 @@ -export const PAGE_TYPE_DETAILS = { +export const PAGE_TYPE_DETAILS_SELECTORS = { nameInput: '[name="name"]', - assignAttributesButton: '[data-test-id="assign-attributes"]' + assignAttributesButton: '[data-test-id="assign-attributes"]', }; diff --git a/cypress/elements/pageTypes/pageTypesList.js b/cypress/elements/pageTypes/pageTypesList.js index 911621802..3bbb09c3b 100644 --- a/cypress/elements/pageTypes/pageTypesList.js +++ b/cypress/elements/pageTypes/pageTypesList.js @@ -1,3 +1,3 @@ -export const PAGE_TYPES_LIST = { - createPageTypeButton: '[data-test-id="create-page-type"]' +export const PAGE_TYPES_LIST_SELECTORS = { + createPageTypeButton: '[data-test-id="create-page-type"]', }; diff --git a/cypress/elements/pages/index.js b/cypress/elements/pages/index.js new file mode 100644 index 000000000..4037f6e8f --- /dev/null +++ b/cypress/elements/pages/index.js @@ -0,0 +1,4 @@ +import { PAGE_DETAILS_SELECTORS } from "./page-details"; +import { PAGES_LIST_SELECTORS } from "./pages-list"; + +export { PAGE_DETAILS_SELECTORS, PAGES_LIST_SELECTORS }; diff --git a/cypress/elements/pages/page-details.js b/cypress/elements/pages/page-details.js index b3c6e9f9e..c2085b0a0 100644 --- a/cypress/elements/pages/page-details.js +++ b/cypress/elements/pages/page-details.js @@ -1,4 +1,4 @@ -export const PAGE_DETAILS = { +export const PAGE_DETAILS_SELECTORS = { nameInput: '[name="title"]', pageTypesAutocompleteSelect: '[data-test-id="page-types-autocomplete-select"]', diff --git a/cypress/elements/pages/pages-list.js b/cypress/elements/pages/pages-list.js index 896194460..267cc68c4 100644 --- a/cypress/elements/pages/pages-list.js +++ b/cypress/elements/pages/pages-list.js @@ -1,4 +1,4 @@ -export const PAGES_LIST = { +export const PAGES_LIST_SELECTORS = { createPageButton: '[data-test-id="create-page"]', dialogPageTypeInput: "[data-test-id='dialog-page-type']", }; diff --git a/cypress/elements/permissionGroup/index.js b/cypress/elements/permissionGroup/index.js new file mode 100644 index 000000000..5161f33ef --- /dev/null +++ b/cypress/elements/permissionGroup/index.js @@ -0,0 +1,4 @@ +import { PERMISSION_GROUP_DETAILS_SELECTORS } from "./permissionGroupDetails"; +import { PERMISSION_GROUP_LIST_SELECTORS } from "./permissionGroupsList"; + +export { PERMISSION_GROUP_DETAILS_SELECTORS, PERMISSION_GROUP_LIST_SELECTORS }; diff --git a/cypress/elements/permissionGroup/permissionGroupDetails.js b/cypress/elements/permissionGroup/permissionGroupDetails.js index 98231f85f..1866cc838 100644 --- a/cypress/elements/permissionGroup/permissionGroupDetails.js +++ b/cypress/elements/permissionGroup/permissionGroupDetails.js @@ -1,4 +1,4 @@ -export const PERMISSION_GROUP_DETAILS = { +export const PERMISSION_GROUP_DETAILS_SELECTORS = { nameInput: '[name="name"]', productsPermissionCheckbox: '[name="MANAGE_PRODUCTS"]', productsTypesAndAttributesPermissionCheckbox: diff --git a/cypress/elements/permissionGroup/permissionGroupsList.js b/cypress/elements/permissionGroup/permissionGroupsList.js index a576d61bf..c2618fff9 100644 --- a/cypress/elements/permissionGroup/permissionGroupsList.js +++ b/cypress/elements/permissionGroup/permissionGroupsList.js @@ -1,4 +1,4 @@ -export const PERMISSION_GROUP_LIST = { +export const PERMISSION_GROUP_LIST_SELECTORS = { createPermissionButton: '[data-test-id="create-permission-group"]', - permissionGroupRow: '[data-test-id*="id-"]' + permissionGroupRow: '[data-test-id*="id-"]', }; diff --git a/cypress/elements/plugins/index.js b/cypress/elements/plugins/index.js new file mode 100644 index 000000000..cd45eb32a --- /dev/null +++ b/cypress/elements/plugins/index.js @@ -0,0 +1,4 @@ +import { PLUGINS_DETAILS_SELECTORS } from "./pluginDetails"; +import { PLUGINS_LIST_SELECTORS } from "./pluginsList"; + +export { PLUGINS_DETAILS_SELECTORS, PLUGINS_LIST_SELECTORS }; diff --git a/cypress/elements/plugins/pluginDetails.js b/cypress/elements/plugins/pluginDetails.js index 5293641a8..6ca7fbb87 100644 --- a/cypress/elements/plugins/pluginDetails.js +++ b/cypress/elements/plugins/pluginDetails.js @@ -1,5 +1,5 @@ -export const PLUGINS_DETAILS = { +export const PLUGINS_DETAILS_SELECTORS = { channel: '[data-test-id="channel"]', accountConfirmationSubjectInput: '[name="account_confirmation_subject"]', - staffPasswordResetInput: '[name="staff_password_reset_subject"]' + staffPasswordResetInput: '[name="staff_password_reset_subject"]', }; diff --git a/cypress/elements/plugins/pluginsList.js b/cypress/elements/plugins/pluginsList.js index 61ec2eafc..f23b19ff5 100644 --- a/cypress/elements/plugins/pluginsList.js +++ b/cypress/elements/plugins/pluginsList.js @@ -1,3 +1,3 @@ -export const PLUGINS_LIST = { - pluginRow: '[data-test-id="plugin"]' +export const PLUGINS_LIST_SELECTORS = { + pluginRow: '[data-test-id="plugin"]', }; diff --git a/cypress/elements/productTypes/index.js b/cypress/elements/productTypes/index.js new file mode 100644 index 000000000..8ef88f30d --- /dev/null +++ b/cypress/elements/productTypes/index.js @@ -0,0 +1,4 @@ +import { PRODUCT_TYPE_DETAILS_SELECTORS } from "./productTypeDetails"; +import { PRODUCT_TYPES_LIST_SELECTORS } from "./productTypesList"; + +export { PRODUCT_TYPE_DETAILS_SELECTORS, PRODUCT_TYPES_LIST_SELECTORS }; diff --git a/cypress/elements/productTypes/productTypeDetails.js b/cypress/elements/productTypes/productTypeDetails.js index 303e57e5e..df3538a41 100644 --- a/cypress/elements/productTypes/productTypeDetails.js +++ b/cypress/elements/productTypes/productTypeDetails.js @@ -1,4 +1,4 @@ -export const PRODUCT_TYPE_DETAILS = { +export const PRODUCT_TYPE_DETAILS_SELECTORS = { nameInput: '[name="name"]', isShippingRequired: '[name="isShippingRequired"]', assignProductAttributeButton: '[data-test-id="assign-products-attributes"]', @@ -6,5 +6,5 @@ export const PRODUCT_TYPE_DETAILS = { hasVariantsButton: '[name="hasVariants"]', shippingWeightInput: '[name="weight"]', giftCardKindCheckbox: '[data-test-id="product-type-kind-option-GIFT_CARD"]', - variantSelectionCheckbox: '[data-test-id = "variant-selection-checkbox"]' + variantSelectionCheckbox: '[data-test-id = "variant-selection-checkbox"]', }; diff --git a/cypress/elements/productTypes/productTypesList.js b/cypress/elements/productTypes/productTypesList.js index 81649d4fb..64e40ba31 100644 --- a/cypress/elements/productTypes/productTypesList.js +++ b/cypress/elements/productTypes/productTypesList.js @@ -1,3 +1,3 @@ -export const PRODUCT_TYPES_LIST = { - addProductTypeButton: '[data-test-id="add-product-type"]' +export const PRODUCT_TYPES_LIST_SELECTORS = { + addProductTypeButton: '[data-test-id="add-product-type"]', }; diff --git a/cypress/elements/shared/addressForm.js b/cypress/elements/shared/addressForm.js index 45ccab343..d18396e47 100644 --- a/cypress/elements/shared/addressForm.js +++ b/cypress/elements/shared/addressForm.js @@ -10,4 +10,5 @@ export const ADDRESS_SELECTORS = { country: '[data-test-id="address-edit-country-select-field"]', countryArea: '[data-test-id="address-edit-country-area-field"]', saveButton: '[data-test-id="order-address-edit-dialog-confirm-button"]', + companyInfoSection: '[data-test-id="company-info"]', }; diff --git a/cypress/elements/shared/index.js b/cypress/elements/shared/index.js new file mode 100644 index 000000000..02e373d2e --- /dev/null +++ b/cypress/elements/shared/index.js @@ -0,0 +1,4 @@ +import { SHARED_ELEMENTS } from "./sharedElements"; +import { ADDRESS_SELECTORS } from "./addressForm"; + +export { SHARED_ELEMENTS, ADDRESS_SELECTORS }; diff --git a/cypress/elements/shipping/index.js b/cypress/elements/shipping/index.js new file mode 100644 index 000000000..3cf0df771 --- /dev/null +++ b/cypress/elements/shipping/index.js @@ -0,0 +1,3 @@ +import { SHIPPING_ZONES_LIST_SELECTORS } from "./shipping-zones-list"; + +export { SHIPPING_ZONES_LIST_SELECTORS }; diff --git a/cypress/elements/shipping/shipping-zones-list.js b/cypress/elements/shipping/shipping-zones-list.js index c7ee511a2..2da9c4a3c 100644 --- a/cypress/elements/shipping/shipping-zones-list.js +++ b/cypress/elements/shipping/shipping-zones-list.js @@ -1,7 +1,7 @@ -export const SHIPPING_ZONES_LIST = { +export const SHIPPING_ZONES_LIST_SELECTORS = { addShippingZone: "[data-test-id='add-shipping-zone']", unitSelect: "[id='mui-component-select-unit']", - saveUnit: '[data-test-id="save-unit"]' + saveUnit: '[data-test-id="save-unit"]', }; export const SHIPPING_ZONE_CHECKBOX = shippingId => diff --git a/cypress/elements/staffMembers/index.js b/cypress/elements/staffMembers/index.js new file mode 100644 index 000000000..69ef6a160 --- /dev/null +++ b/cypress/elements/staffMembers/index.js @@ -0,0 +1,9 @@ +import { INVITE_STAFF_MEMBER_FORM_SELECTORS } from "./inviteStaffMemberForm"; +import { STAFF_MEMBER_DETAILS_SELECTORS } from "./staffMemberDetails"; +import { STAFF_MEMBERS_LIST_SELECTORS } from "./staffMembersList"; + +export { + INVITE_STAFF_MEMBER_FORM_SELECTORS, + STAFF_MEMBER_DETAILS_SELECTORS, + STAFF_MEMBERS_LIST_SELECTORS, +}; diff --git a/cypress/elements/staffMembers/inviteStaffMemberForm.js b/cypress/elements/staffMembers/inviteStaffMemberForm.js index 4497a5b8b..d1ff1deec 100644 --- a/cypress/elements/staffMembers/inviteStaffMemberForm.js +++ b/cypress/elements/staffMembers/inviteStaffMemberForm.js @@ -1,4 +1,4 @@ -export const INVITE_STAFF_MEMBER_FORM = { +export const INVITE_STAFF_MEMBER_FORM_SELECTORS = { firstNameInput: '[name="firstName"]', lastNameInput: '[name="lastName"]', emailInput: '[name="email"]', diff --git a/cypress/elements/staffMembers/staffMemberDetails.js b/cypress/elements/staffMembers/staffMemberDetails.js index 25c1e6acc..6c815db01 100644 --- a/cypress/elements/staffMembers/staffMemberDetails.js +++ b/cypress/elements/staffMembers/staffMemberDetails.js @@ -1,4 +1,4 @@ -export const STAFF_MEMBER_DETAILS = { +export const STAFF_MEMBER_DETAILS_SELECTORS = { permissionsSelect: '[data-test-id="permission-groups"]', isActiveCheckBox: '[name="isActive"]', removePermissionButton: '[data-test-id="remove"]', diff --git a/cypress/elements/staffMembers/staffMembersList.js b/cypress/elements/staffMembers/staffMembersList.js index e418048f3..800766d45 100644 --- a/cypress/elements/staffMembers/staffMembersList.js +++ b/cypress/elements/staffMembers/staffMembersList.js @@ -1,4 +1,4 @@ -export const STAFF_MEMBERS_LIST = { +export const STAFF_MEMBERS_LIST_SELECTORS = { inviteStaffMemberButton: '[data-test-id="invite-staff-member"]', staffStatusText: '[data-test-id="staffStatusText"]', staffAvatar: '[data-test-id="staffAvatar"]', diff --git a/cypress/elements/translations/index.js b/cypress/elements/translations/index.js new file mode 100644 index 000000000..fbf54f3e7 --- /dev/null +++ b/cypress/elements/translations/index.js @@ -0,0 +1,3 @@ +import { LANGUAGES_LIST_SELECTORS } from "./languages-list"; + +export { LANGUAGES_LIST_SELECTORS }; diff --git a/cypress/elements/translations/languages-list.js b/cypress/elements/translations/languages-list.js index daf25e350..af80c8dad 100644 --- a/cypress/elements/translations/languages-list.js +++ b/cypress/elements/translations/languages-list.js @@ -1,3 +1,4 @@ -export const LANGUAGES_LIST = { - polishLanguageButton: '[data-test-id="PL"]' +export const LANGUAGES_LIST_SELECTORS = { + polishLanguageButton: '[data-test-id="PL"]', + translationListView: '[data-test-id="translation-list-view"]', }; diff --git a/cypress/fixtures/permissions.js b/cypress/fixtures/permissions.js index b797fdd97..c227b07c6 100644 --- a/cypress/fixtures/permissions.js +++ b/cypress/fixtures/permissions.js @@ -2,7 +2,7 @@ import * as menuSelectors from "../elements/account/left-menu/left-menu-selector import { CONFIGURATION_SELECTORS } from "../elements/configuration/configuration-selectors"; const configurationAsParent = { - parentMenuSelector: menuSelectors.LEFT_MENU_SELECTORS.configuration, + parentMenuSelector: menuSelectors.MENU.configuration, parentSelectors: CONFIGURATION_SELECTORS, }; @@ -12,21 +12,21 @@ export const PERMISSIONS = { permissionSelectors: [CONFIGURATION_SELECTORS.channels], }, customer: { - permissionSelectors: [menuSelectors.LEFT_MENU_SELECTORS.customers], + permissionSelectors: [menuSelectors.MENU.customers], }, discounts: { parent: { - parentMenuSelector: menuSelectors.LEFT_MENU_SELECTORS.discounts, - parentSelectors: [menuSelectors.DISCOUNTS_MENU_SELECTORS], + parentMenuSelector: menuSelectors.MENU.discounts, + parentSelectors: [menuSelectors.DISCOUNTS], }, permissionSelectors: [ - menuSelectors.DISCOUNTS_MENU_SELECTORS.sales, - menuSelectors.DISCOUNTS_MENU_SELECTORS.vouchers, + menuSelectors.DISCOUNTS.sales, + menuSelectors.DISCOUNTS.vouchers, ], }, order: { parent: { - parentMenuSelector: menuSelectors.LEFT_MENU_SELECTORS.orders, + parentMenuSelector: menuSelectors.MENU.orders, parentSelectors: menuSelectors.ORDERS, }, permissionSelectors: [ @@ -38,7 +38,7 @@ export const PERMISSIONS = { parent: configurationAsParent, permissionSelectors: [ CONFIGURATION_SELECTORS.pageTypes, - menuSelectors.LEFT_MENU_SELECTORS.pages, + menuSelectors.MENU.pages, ], }, plugin: { @@ -47,7 +47,7 @@ export const PERMISSIONS = { }, product: { parent: { - parentMenuSelector: menuSelectors.LEFT_MENU_SELECTORS.catalog, + parentMenuSelector: menuSelectors.MENU.catalog, parentSelectors: menuSelectors.CATALOG, }, permissionSelectors: [ @@ -89,7 +89,7 @@ export const PERMISSIONS = { ], }, translations: { - permissionSelectors: [menuSelectors.LEFT_MENU_SELECTORS.translations], + permissionSelectors: [menuSelectors.MENU.translations], }, warehouse: { parent: configurationAsParent, diff --git a/cypress/fixtures/permissionsUsers.js b/cypress/fixtures/permissionsUsers.js index 9ebe4feb4..75ae49745 100644 --- a/cypress/fixtures/permissionsUsers.js +++ b/cypress/fixtures/permissionsUsers.js @@ -1,12 +1,7 @@ import { PERMISSIONS } from "./permissions"; -import { ONE_PERMISSION_USERS, TEST_ADMIN_USER } from "./users"; +import { ONE_PERMISSION_USERS } from "./users"; export const PERMISSIONS_OPTIONS = { - all: { - user: TEST_ADMIN_USER, - permissions: Object.values(PERMISSIONS), - testCase: "TC: SALEOR_3401", - }, app: { user: ONE_PERMISSION_USERS.app, permissions: [], diff --git a/cypress/fixtures/urlList.js b/cypress/fixtures/urlList.js index 420f1ff5b..54c3b3177 100644 --- a/cypress/fixtures/urlList.js +++ b/cypress/fixtures/urlList.js @@ -30,12 +30,13 @@ export const urlList = { vouchers: "discounts/vouchers/", variant: "variant/", warehouses: "warehouses/", + webhooksAndEvents: "custom-apps/", }; export const addVariantUrl = productId => `${urlList.products}${productId}/${urlList.variants}add`; -export const appDetailsUrl = appId => `${urlList.apps}${appId}`; +export const appDetailsUrl = appId => `${urlList.webhooksAndEvents}${appId}`; export const attributeDetailsUrl = attributeId => `${urlList.attributes}${attributeId}`; diff --git a/cypress/support/customCommands/basicOperations/index.js b/cypress/support/customCommands/basicOperations/index.js index 5e7260170..e9b2efe81 100644 --- a/cypress/support/customCommands/basicOperations/index.js +++ b/cypress/support/customCommands/basicOperations/index.js @@ -11,6 +11,9 @@ Cypress.Commands.add("clearAndType", { prevSubject: true }, (subject, text) => { } }); }); +Cypress.Commands.add("clickOnElement", selector => { + cy.get(selector).click(); +}); Cypress.Commands.add("waitForRequestAndCheckIfNoErrors", alias => { cy.wait(alias).then(resp => { @@ -35,3 +38,6 @@ Cypress.Commands.add("checkIfDataAreNotNull", data => { }); } }); +Cypress.Commands.add("checkIfElementIsVisible", element => { + cy.get(element).should("be.visible"); +}); diff --git a/cypress/support/customCommands/user/index.js b/cypress/support/customCommands/user/index.js index a90957938..4187082f2 100644 --- a/cypress/support/customCommands/user/index.js +++ b/cypress/support/customCommands/user/index.js @@ -1,6 +1,7 @@ import "../../api/requests/utils/index"; import { LOGIN_SELECTORS } from "../../../elements/account/login-selectors"; +import { urlList } from "../../../fixtures/urlList"; import { TEST_ADMIN_USER } from "../../../fixtures/users"; Cypress.Commands.add("loginUser", () => @@ -17,6 +18,13 @@ Cypress.Commands.add("loginInShop", () => { cy.loginUserViaRequest("token"); }); +Cypress.Commands.add("visitHomePageLoggedViaApi", user => { + cy.addAliasToGraphRequest("Home") + .loginUserViaRequest("auth", user) + .visit(urlList.homePage) + .waitForRequestAndCheckIfNoErrors("@Home"); +}); + Cypress.Commands.add( "loginUserViaRequest", (authorization = "auth", user = TEST_ADMIN_USER) => { diff --git a/cypress/support/pages/catalog/categoriesPage.js b/cypress/support/pages/catalog/categoriesPage.js index 6da46d6e1..92920aeb6 100644 --- a/cypress/support/pages/catalog/categoriesPage.js +++ b/cypress/support/pages/catalog/categoriesPage.js @@ -1,4 +1,4 @@ -import { CATEGORY_DETAILS } from "../../../elements/catalog/categories/category-details"; +import { CATEGORY_DETAILS_SELECTORS } from "../../../elements/catalog/categories/category-details"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements"; @@ -14,16 +14,16 @@ export function updateCategory({ name, description }) { export function fillUpCategoryGeneralInfo({ name, description }) { return cy - .get(CATEGORY_DETAILS.descriptionInput) + .get(CATEGORY_DETAILS_SELECTORS.descriptionInput) .find(SHARED_ELEMENTS.contentEditable) .should("be.visible") - .get(CATEGORY_DETAILS.descriptionInput) + .get(CATEGORY_DETAILS_SELECTORS.descriptionInput) .click() - .get(CATEGORY_DETAILS.descriptionInput) + .get(CATEGORY_DETAILS_SELECTORS.descriptionInput) .find(SHARED_ELEMENTS.contentEditable) - .get(CATEGORY_DETAILS.descriptionInput) + .get(CATEGORY_DETAILS_SELECTORS.descriptionInput) .clearAndType(description) - .get(CATEGORY_DETAILS.nameInput) + .get(CATEGORY_DETAILS_SELECTORS.nameInput) .clearAndType(name); } diff --git a/cypress/support/pages/configurationPage.js b/cypress/support/pages/configurationPage.js new file mode 100644 index 000000000..08568287e --- /dev/null +++ b/cypress/support/pages/configurationPage.js @@ -0,0 +1,12 @@ +import { CONFIGURATION_SELECTORS } from "../../elements"; + +export function expectConfigurationAvailableSectionsNumber(sectionsNumber) { + cy.get(CONFIGURATION_SELECTORS.configurationMenu) + .find("[data-test-id*=subsection]") + .should("have.length", sectionsNumber); +} +export function expectConfigurationSectionsToBeVisible(...sections) { + sections.forEach(selector => { + cy.get(selector).scrollIntoView().should("be.visible"); + }); +} diff --git a/cypress/support/pages/mainMenuPage.js b/cypress/support/pages/mainMenuPage.js new file mode 100644 index 000000000..601406c43 --- /dev/null +++ b/cypress/support/pages/mainMenuPage.js @@ -0,0 +1,12 @@ +import { MENU_SELECTORS } from "../../elements"; + +export function expectMainMenuAvailableSections(sectionsNumber) { + cy.get(MENU_SELECTORS.MENU.list) + .find(MENU_SELECTORS.MENU.menuItem) + .should("have.length", sectionsNumber); +} +export function expectMainMenuSectionsToBeVisible(...sections) { + sections.forEach(selector => { + cy.get(selector).should("be.visible"); + }); +} diff --git a/cypress/support/pages/pagesPage.js b/cypress/support/pages/pagesPage.js index 1152948fa..d18506676 100644 --- a/cypress/support/pages/pagesPage.js +++ b/cypress/support/pages/pagesPage.js @@ -1,5 +1,5 @@ -import { PAGE_DETAILS } from "../../elements/pages/page-details"; -import { PAGES_LIST } from "../../elements/pages/pages-list"; +import { PAGE_DETAILS_SELECTORS } from "../../elements/pages/page-details"; +import { PAGES_LIST_SELECTORS } from "../../elements/pages/pages-list"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { urlList } from "../../fixtures/urlList"; @@ -15,7 +15,10 @@ export const attributesTypes = { export function fillUpPageTypeDialog({ pageTypeName }) { const organization = {}; return cy - .fillAutocompleteSelect(PAGES_LIST.dialogPageTypeInput, pageTypeName) + .fillAutocompleteSelect( + PAGES_LIST_SELECTORS.dialogPageTypeInput, + pageTypeName, + ) .then(selected => { organization.pageType = selected; return organization; @@ -35,25 +38,30 @@ export function createPage({ } export function addSelectAttributeValue(attributeValue) { - cy.fillAutocompleteSelect(PAGE_DETAILS.attributeValues, attributeValue); + cy.fillAutocompleteSelect( + PAGE_DETAILS_SELECTORS.attributeValues, + attributeValue, + ); } export function addRichTextAttributeValue(attributeValue) { - cy.get(PAGE_DETAILS.attributeValues) + cy.get(PAGE_DETAILS_SELECTORS.attributeValues) .find(SHARED_ELEMENTS.richTextEditor.empty) .should("exist") - .get(PAGE_DETAILS.attributeValues) - .find(PAGE_DETAILS.richTextEditorAttributeValue) + .get(PAGE_DETAILS_SELECTORS.attributeValues) + .find(PAGE_DETAILS_SELECTORS.richTextEditorAttributeValue) .type(attributeValue) .wait(500); } export function addBooleanAttributeValue() { - cy.get(PAGE_DETAILS.booleanAttributeValueCheckbox).click(); + cy.get(PAGE_DETAILS_SELECTORS.booleanAttributeValueCheckbox).click(); } export function addNumericAttributeValue(attributeValue) { - cy.get(PAGE_DETAILS.numericAttributeValueInput).type(attributeValue); + cy.get(PAGE_DETAILS_SELECTORS.numericAttributeValueInput).type( + attributeValue, + ); } function openCreatePageAndFillUpGeneralFields({ @@ -61,19 +69,17 @@ function openCreatePageAndFillUpGeneralFields({ pageTypeName, isPublished, }) { - cy.visit(urlList.pages) - .get(PAGES_LIST.createPageButton) - .click(); + cy.visit(urlList.pages).get(PAGES_LIST_SELECTORS.createPageButton).click(); fillUpPageTypeDialog({ pageTypeName }); cy.get(BUTTON_SELECTORS.submit) .click() - .get(PAGE_DETAILS.nameInput) + .get(PAGE_DETAILS_SELECTORS.nameInput) .type(pageName); if (!isPublished) { - cy.get(PAGE_DETAILS.isNotPublishedCheckbox).click(); + cy.get(PAGE_DETAILS_SELECTORS.isNotPublishedCheckbox).click(); } cy.fillAutocompleteSelect( - PAGE_DETAILS.pageTypesAutocompleteSelect, + PAGE_DETAILS_SELECTORS.pageTypesAutocompleteSelect, pageTypeName, ); } diff --git a/cypress/support/pages/permissionsPage.js b/cypress/support/pages/permissionsPage.js index 8412c3b73..8a9214f7c 100644 --- a/cypress/support/pages/permissionsPage.js +++ b/cypress/support/pages/permissionsPage.js @@ -1,4 +1,4 @@ -import { LEFT_MENU_SELECTORS } from "../../elements/account/left-menu/left-menu-selectors"; +import { MENU_SELECTORS } from "../../elements/account/left-menu/left-menu-selectors"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { urlList } from "../../fixtures/urlList"; @@ -29,7 +29,7 @@ export function isElementDisplayed(element = SHARED_ELEMENTS.header) { return cy.get("body").then(body => body.find(element).length > 0); } -export function getDisplayedSelectors(selectors = LEFT_MENU_SELECTORS) { +export function getDisplayedSelectors(selectors = MENU_SELECTORS) { const displayedSelectors = {}; cy.wrap(displayedSelectors).as("displayedSelectors"); @@ -58,7 +58,7 @@ export function expectAllSelectorsPermitted(permissions, selectors) { } function isPermitted(permissions, selector) { - let permittedSelectors = [LEFT_MENU_SELECTORS.home]; + let permittedSelectors = [MENU_SELECTORS.home]; permissions.forEach(permission => { if (permission.parent) { diff --git a/cypress/support/pages/productTypePage.js b/cypress/support/pages/productTypePage.js index 2765b7f55..283648045 100644 --- a/cypress/support/pages/productTypePage.js +++ b/cypress/support/pages/productTypePage.js @@ -1,20 +1,20 @@ -import { PRODUCT_TYPE_DETAILS } from "../../elements/productTypes/productTypeDetails"; -import { PRODUCT_TYPES_LIST } from "../../elements/productTypes/productTypesList"; +import { PRODUCT_TYPE_DETAILS_SELECTORS } from "../../elements/productTypes/productTypeDetails"; +import { PRODUCT_TYPES_LIST_SELECTORS } from "../../elements/productTypes/productTypesList"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; export function createProductType({ name, shippingWeight, giftCard = false }) { - cy.get(PRODUCT_TYPES_LIST.addProductTypeButton) + cy.get(PRODUCT_TYPES_LIST_SELECTORS.addProductTypeButton) .click() .waitForProgressBarToNotBeVisible() - .get(PRODUCT_TYPE_DETAILS.nameInput) + .get(PRODUCT_TYPE_DETAILS_SELECTORS.nameInput) .type(name); if (giftCard) { - cy.get(PRODUCT_TYPE_DETAILS.giftCardKindCheckbox).click(); + cy.get(PRODUCT_TYPE_DETAILS_SELECTORS.giftCardKindCheckbox).click(); } if (shippingWeight) { - cy.get(PRODUCT_TYPE_DETAILS.isShippingRequired) + cy.get(PRODUCT_TYPE_DETAILS_SELECTORS.isShippingRequired) .click() - .get(PRODUCT_TYPE_DETAILS.shippingWeightInput) + .get(PRODUCT_TYPE_DETAILS_SELECTORS.shippingWeightInput) .type(shippingWeight); } return cy diff --git a/cypress/support/pages/shippingMethodPage.js b/cypress/support/pages/shippingMethodPage.js index 96d838a29..2bb703e57 100644 --- a/cypress/support/pages/shippingMethodPage.js +++ b/cypress/support/pages/shippingMethodPage.js @@ -2,7 +2,7 @@ import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { SHIPPING_RATE_DETAILS } from "../../elements/shipping/shipping-rate-details"; import { SHIPPING_ZONE_DETAILS } from "../../elements/shipping/shipping-zone-details"; -import { SHIPPING_ZONES_LIST } from "../../elements/shipping/shipping-zones-list"; +import { SHIPPING_ZONES_LIST_SELECTORS } from "../../elements/shipping/shipping-zones-list"; export function createShippingZone( shippingName, @@ -10,7 +10,7 @@ export function createShippingZone( country, channelName, ) { - cy.get(SHIPPING_ZONES_LIST.addShippingZone).click(); + cy.get(SHIPPING_ZONES_LIST_SELECTORS.addShippingZone).click(); fillUpShippingZoneData({ shippingName, warehouseName, @@ -65,9 +65,9 @@ export function fillUpShippingZoneData({ } export function changeWeightUnit(weightUnit) { - cy.fillBaseSelect(SHIPPING_ZONES_LIST.unitSelect, weightUnit) + cy.fillBaseSelect(SHIPPING_ZONES_LIST_SELECTORS.unitSelect, weightUnit) .addAliasToGraphRequest("UpdateDefaultWeightUnit") - .get(SHIPPING_ZONES_LIST.saveUnit) + .get(SHIPPING_ZONES_LIST_SELECTORS.saveUnit) .click() .confirmationMessageShouldAppear() .waitForRequestAndCheckIfNoErrors("@UpdateDefaultWeightUnit") diff --git a/cypress/support/pages/translationsPage.js b/cypress/support/pages/translationsPage.js index 234513607..a5fea7d6d 100644 --- a/cypress/support/pages/translationsPage.js +++ b/cypress/support/pages/translationsPage.js @@ -1,7 +1,7 @@ import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { ELEMENT_TRANSLATION } from "../../elements/translations/element-translation"; -import { LANGUAGES_LIST } from "../../elements/translations/languages-list"; +import { LANGUAGES_LIST_SELECTORS } from "../../elements/translations/languages-list"; import { urlList } from "../../fixtures/urlList"; export function updateTranslationToCategory({ @@ -12,7 +12,10 @@ export function updateTranslationToCategory({ translatedSeoDescription, }) { cy.visit(urlList.translations); - enterCategoryTranslation(LANGUAGES_LIST.polishLanguageButton, categoryName); + enterCategoryTranslation( + LANGUAGES_LIST_SELECTORS.polishLanguageButton, + categoryName, + ); cy.get(ELEMENT_TRANSLATION.editNameButton) .click() .get(SHARED_ELEMENTS.skeleton) @@ -49,9 +52,7 @@ export function updateTranslationToCategory({ export function enterCategoryTranslation(language, categoryName) { cy.addAliasToGraphRequest("CategoryTranslations"); - cy.get(language) - .click() - .waitForProgressBarToNotExist(); + cy.get(language).click().waitForProgressBarToNotExist(); getCategoryFromTable(categoryName); } diff --git a/cypress/support/pages/userPage.js b/cypress/support/pages/userPage.js index 9bf5545e7..42f000687 100644 --- a/cypress/support/pages/userPage.js +++ b/cypress/support/pages/userPage.js @@ -1,7 +1,7 @@ import { SET_PASSWORD } from "../../elements/account/setPassword"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; -import { INVITE_STAFF_MEMBER_FORM } from "../../elements/staffMembers/inviteStaffMemberForm"; -import { STAFF_MEMBER_DETAILS } from "../../elements/staffMembers/staffMemberDetails"; +import { INVITE_STAFF_MEMBER_FORM_SELECTORS } from "../../elements/staffMembers/inviteStaffMemberForm"; +import { STAFF_MEMBER_DETAILS_SELECTORS } from "../../elements/staffMembers/staffMemberDetails"; import { userDetailsUrl } from "../../fixtures/urlList"; export function fillUpSetPassword(password) { @@ -22,8 +22,8 @@ export function fillUpUserDetailsAndAddFirstPermission( ) { fillUpOnlyUserDetails(firstName, lastName, email); cy.confirmationMessageShouldDisappear() - .fillAutocompleteSelect(STAFF_MEMBER_DETAILS.permissionsSelect) - .get(STAFF_MEMBER_DETAILS.permissionsSelect) + .fillAutocompleteSelect(STAFF_MEMBER_DETAILS_SELECTORS.permissionsSelect) + .get(STAFF_MEMBER_DETAILS_SELECTORS.permissionsSelect) .find("input") .first() .type("{esc}", { force: true }) @@ -34,11 +34,11 @@ export function fillUpUserDetailsAndAddFirstPermission( } export function fillUpOnlyUserDetails(firstName, lastName, email) { - cy.get(INVITE_STAFF_MEMBER_FORM.firstNameInput) + cy.get(INVITE_STAFF_MEMBER_FORM_SELECTORS.firstNameInput) .type(firstName) - .get(INVITE_STAFF_MEMBER_FORM.lastNameInput) + .get(INVITE_STAFF_MEMBER_FORM_SELECTORS.lastNameInput) .type(lastName) - .get(INVITE_STAFF_MEMBER_FORM.emailInput) + .get(INVITE_STAFF_MEMBER_FORM_SELECTORS.emailInput) .type(email) .get(BUTTON_SELECTORS.submit) .click(); @@ -46,7 +46,7 @@ export function fillUpOnlyUserDetails(firstName, lastName, email) { export function updateUserActiveFlag(userId) { cy.visitAndWaitForProgressBarToDisappear(userDetailsUrl(userId)) - .get(STAFF_MEMBER_DETAILS.isActiveCheckBox) + .get(STAFF_MEMBER_DETAILS_SELECTORS.isActiveCheckBox) .click() .addAliasToGraphRequest("StaffMemberUpdate") .get(BUTTON_SELECTORS.confirm) diff --git a/src/components/CompanyAddressInput/CompanyAddressForm.tsx b/src/components/CompanyAddressInput/CompanyAddressForm.tsx index f4d105e22..3edea84d9 100644 --- a/src/components/CompanyAddressInput/CompanyAddressForm.tsx +++ b/src/components/CompanyAddressInput/CompanyAddressForm.tsx @@ -84,7 +84,7 @@ const CompanyAddressForm: React.FC = props => { const formErrors = getFormErrors(formFields, errors); return ( -
+
= ({ menuItem }) => { const isExpanded = isActive || hasSubmenuActive; return ( - + { return ( - + {menuStructure.map(menuItem => ( ))} diff --git a/src/configuration/ConfigurationPage.tsx b/src/configuration/ConfigurationPage.tsx index ff464c144..022a77f99 100644 --- a/src/configuration/ConfigurationPage.tsx +++ b/src/configuration/ConfigurationPage.tsx @@ -98,7 +98,7 @@ export const ConfigurationPage: React.FC = props => { {isSmUp && renderVersionInfo} - + {menus .filter(menu => diff --git a/src/orders/components/OrderDraftListPage/OrderDraftListPage.tsx b/src/orders/components/OrderDraftListPage/OrderDraftListPage.tsx index 1b2696c72..93474f168 100644 --- a/src/orders/components/OrderDraftListPage/OrderDraftListPage.tsx +++ b/src/orders/components/OrderDraftListPage/OrderDraftListPage.tsx @@ -64,6 +64,7 @@ const OrderDraftListPage: React.FC = ({ variant="primary" disabled={disabled || limitsReached} onClick={onAdd} + data-test-id="create-draft-order-button" > - + {renderCollection( languages, language => ( diff --git a/src/translations/views/EntityLists/TranslationsProductList.tsx b/src/translations/views/EntityLists/TranslationsProductList.tsx index 7f2677d1f..04de675a4 100644 --- a/src/translations/views/EntityLists/TranslationsProductList.tsx +++ b/src/translations/views/EntityLists/TranslationsProductList.tsx @@ -29,6 +29,7 @@ const TranslationsProductList: React.FC = ({ return (