diff --git a/cypress/e2e/apps.js b/cypress/e2e/apps.js index 86825798f..5d9387732 100644 --- a/cypress/e2e/apps.js +++ b/cypress/e2e/apps.js @@ -7,9 +7,16 @@ import { APP_DETAILS } from "../elements/apps/appDetails"; 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"; +import { + appDetailsUrl, + urlList, +} from "../fixtures/urlList"; import { ONE_PERMISSION_USERS } from "../fixtures/users"; -import { createApp, getApp, updateApp } from "../support/api/requests/Apps"; +import { + createApp, + getApp, + updateApp, +} from "../support/api/requests/Apps"; import { addShippingMethod, createCheckout, @@ -18,7 +25,9 @@ import { import { createVoucher } from "../support/api/requests/Discounts/Vouchers"; import { createGiftCard } from "../support/api/requests/GiftCard"; import { getDefaultChannel } from "../support/api/utils/channelsUtils"; -import { getShippingMethodIdFromCheckout } from "../support/api/utils/ordersUtils"; +import { + getShippingMethodIdFromCheckout, +} from "../support/api/utils/ordersUtils"; import { createProductInChannel, createTypeAttributeAndCategoryForProduct, @@ -41,7 +50,7 @@ describe("As a staff user I want to manage apps", () => { const email = `example@example.com`; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createApp(name, "MANAGE_APPS").then(app => { createdApp = app; @@ -93,7 +102,7 @@ describe("As a staff user I want to manage apps", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest("auth", ONE_PERMISSION_USERS.app); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.app); }); it( diff --git a/cypress/e2e/catalog/categories.js b/cypress/e2e/catalog/categories.js index c5cdef1b5..699c43e7a 100644 --- a/cypress/e2e/catalog/categories.js +++ b/cypress/e2e/catalog/categories.js @@ -3,18 +3,27 @@ import faker from "faker"; -import { CATEGORIES_LIST_SELECTORS } from "../../elements/catalog/categories/categories-list"; -import { CATEGORY_DETAILS_SELECTORS } from "../../elements/catalog/categories/category-details"; +import { + CATEGORIES_LIST_SELECTORS, +} from "../../elements/catalog/categories/categories-list"; +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"; +import { + categoryDetailsUrl, + urlList, +} from "../../fixtures/urlList"; import { createCategory as createCategoryRequest, getCategory, } from "../../support/api/requests/Category"; import * as channelsUtils from "../../support/api/utils/channelsUtils"; import * as productsUtils from "../../support/api/utils/products/productsUtils"; -import { ensureCanvasStatic } from "../../support/customCommands/sharedElementsOperations/canvas"; +import { + ensureCanvasStatic, +} from "../../support/customCommands/sharedElementsOperations/canvas"; import { createCategory, updateCategory, @@ -32,7 +41,7 @@ describe("As an admin I want to manage categories", () => { let defaultChannel; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); channelsUtils .getDefaultChannel() @@ -71,7 +80,7 @@ describe("As an admin I want to manage categories", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/catalog/collections.js b/cypress/e2e/catalog/collections.js index 7b38571cd..8af8d8d1f 100644 --- a/cypress/e2e/catalog/collections.js +++ b/cypress/e2e/catalog/collections.js @@ -4,7 +4,10 @@ import faker from "faker"; import { BUTTON_SELECTORS } from "../../elements"; -import { collectionDetailsUrl, urlList } from "../../fixtures/urlList"; +import { + collectionDetailsUrl, + urlList, +} from "../../fixtures/urlList"; import { createChannel } from "../../support/api/requests/Channels"; import { addChannelToCollection, @@ -12,8 +15,12 @@ import { createCollection as createCollectionRequest, } from "../../support/api/requests/Collections"; import { updateChannelInProduct } from "../../support/api/requests/Product"; -import { getCollection } from "../../support/api/requests/storeFront/Collections"; -import { getProductDetails } from "../../support/api/requests/storeFront/ProductDetails"; +import { + getCollection, +} from "../../support/api/requests/storeFront/Collections"; +import { + getProductDetails, +} from "../../support/api/requests/storeFront/ProductDetails"; import { searchInShop } from "../../support/api/requests/storeFront/Search"; import * as channelsUtils from "../../support/api/utils/channelsUtils"; import * as productsUtils from "../../support/api/utils/products/productsUtils"; @@ -35,7 +42,7 @@ describe("As an admin I want to manage collections.", () => { let defaultChannel; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); channelsUtils .getDefaultChannel() @@ -76,7 +83,7 @@ describe("As an admin I want to manage collections.", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/catalog/giftCards/activateGiftCards.js b/cypress/e2e/catalog/giftCards/activateGiftCards.js index 85db415e6..cab79ab89 100644 --- a/cypress/e2e/catalog/giftCards/activateGiftCards.js +++ b/cypress/e2e/catalog/giftCards/activateGiftCards.js @@ -1,7 +1,9 @@ /// import faker from "faker"; -import { GIFT_CARD_LIST } from "../../../elements/catalog/giftCard/giftCardList"; +import { + GIFT_CARD_LIST, +} from "../../../elements/catalog/giftCard/giftCardList"; import { urlList } from "../../../fixtures/urlList"; import { completeCheckout } from "../../../support/api/requests/Checkout"; import { @@ -17,8 +19,11 @@ import { addPayment, purchaseProductWithPromoCode, } from "../../../support/api/utils/ordersUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; -import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; +import { + updateTaxConfigurationForChannel, +} from "../../../support/api/utils/taxesUtils"; import { giftCardsPage } from "../../../support/pages"; describe("As a admin I want to use enabled gift card in checkout", () => { @@ -38,7 +43,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => { before(() => { const name = `${startsWith}${faker.datatype.number()}`; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); productsUtils .createProductWithShipping({ name, shippingPrice, productPrice }) @@ -59,7 +64,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); updateTaxConfigurationForChannel({ channelSlug: defaultChannel.slug, pricesEnteredWithTax: true, diff --git a/cypress/e2e/catalog/giftCards/createGiftCard.js b/cypress/e2e/catalog/giftCards/createGiftCard.js index 23f9dce0c..c118d8d02 100644 --- a/cypress/e2e/catalog/giftCards/createGiftCard.js +++ b/cypress/e2e/catalog/giftCards/createGiftCard.js @@ -20,11 +20,11 @@ describe("As an admin I want to create gift card", () => { const currency = "USD"; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/catalog/giftCards/exportGiftCards.js b/cypress/e2e/catalog/giftCards/exportGiftCards.js index 3e3709549..29ca4545f 100644 --- a/cypress/e2e/catalog/giftCards/exportGiftCards.js +++ b/cypress/e2e/catalog/giftCards/exportGiftCards.js @@ -10,19 +10,21 @@ import { activatePlugin, updatePlugin, } from "../../../support/api/requests/Plugins"; -import { getMailWithGiftCardExportWithAttachment } from "../../../support/api/utils/users"; +import { + getMailWithGiftCardExportWithAttachment, +} from "../../../support/api/utils/users"; import { giftCardsPage } from "../../../support/pages"; describe("As an admin I want to export gift card", () => { const startsWith = "updateGCard"; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); activatePlugin({ id: "mirumee.notifications.admin_email" }); }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/catalog/giftCards/purchaseGiftCard.js b/cypress/e2e/catalog/giftCards/purchaseGiftCard.js index 0c0bbbe3d..051e1f64e 100644 --- a/cypress/e2e/catalog/giftCards/purchaseGiftCard.js +++ b/cypress/e2e/catalog/giftCards/purchaseGiftCard.js @@ -2,8 +2,11 @@ import faker from "faker"; import * as channelsUtils from "../../../support/api/utils/channelsUtils"; -import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; +import { + createWaitingForCaptureOrder, +} from "../../../support/api/utils/ordersUtils"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; import { createShipping } from "../../../support/api/utils/shippingUtils"; describe("As a customer I should be able to purchase gift card as a product", () => { @@ -25,7 +28,7 @@ describe("As a customer I should be able to purchase gift card as a product", () }; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); const name = `${startsWith}${faker.datatype.number()}`; @@ -84,7 +87,7 @@ describe("As a customer I should be able to purchase gift card as a product", () }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/catalog/giftCards/updatingGiftCards.js b/cypress/e2e/catalog/giftCards/updatingGiftCards.js index 3858f28e6..fadd85b75 100644 --- a/cypress/e2e/catalog/giftCards/updatingGiftCards.js +++ b/cypress/e2e/catalog/giftCards/updatingGiftCards.js @@ -3,10 +3,15 @@ import faker from "faker"; -import { GIFT_CARD_UPDATE } from "../../../elements/catalog/giftCard/giftCardUpdate"; +import { + GIFT_CARD_UPDATE, +} from "../../../elements/catalog/giftCard/giftCardUpdate"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { MESSAGES } from "../../../fixtures"; -import { giftCardDetailsUrl, urlList } from "../../../fixtures/urlList"; +import { + giftCardDetailsUrl, + urlList, +} from "../../../fixtures/urlList"; import { createGiftCard, getGiftCardWithId, @@ -16,13 +21,8 @@ import { giftCardsPage } from "../../../support/pages"; describe("As an admin I want to update gift card", () => { const startsWith = "updateGCard"; - - before(() => { - cy.clearSessionData().loginUserViaRequest(); - }); - beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/checkout/clickAndCollect.js b/cypress/e2e/checkout/clickAndCollect.js index de0336e32..321a9fc7d 100644 --- a/cypress/e2e/checkout/clickAndCollect.js +++ b/cypress/e2e/checkout/clickAndCollect.js @@ -3,7 +3,9 @@ import faker from "faker"; -import { WAREHOUSES_DETAILS } from "../../elements/warehouses/warehouse-details"; +import { + WAREHOUSES_DETAILS, +} from "../../elements/warehouses/warehouse-details"; import { completeCheckout, createCheckout, @@ -39,7 +41,7 @@ describe("Warehouses in checkout", () => { const warehouseSlug = `${faker.lorem.slug()}slug`; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); cy.fixture("addresses") .then(addresses => { usAddress = addresses.usAddress; @@ -101,7 +103,7 @@ describe("Warehouses in checkout", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/checkout/productWithoutShipping.js b/cypress/e2e/checkout/productWithoutShipping.js index ac80db453..cb2f69dfb 100644 --- a/cypress/e2e/checkout/productWithoutShipping.js +++ b/cypress/e2e/checkout/productWithoutShipping.js @@ -28,7 +28,7 @@ describe("Products without shipment option", () => { let productWithoutShipping; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createChannel({ name, diff --git a/cypress/e2e/checkout/purchaseWithProductTypes.js b/cypress/e2e/checkout/purchaseWithProductTypes.js index 72d7494ba..6078109e8 100644 --- a/cypress/e2e/checkout/purchaseWithProductTypes.js +++ b/cypress/e2e/checkout/purchaseWithProductTypes.js @@ -17,7 +17,9 @@ import { getShippingMethodIdFromCheckout, updateShippingInCheckout, } from "../../support/api/utils/ordersUtils"; -import { createDigitalAndPhysicalProductWithNewDataAndDefaultChannel } from "../../support/api/utils/products/productsUtils"; +import { + createDigitalAndPhysicalProductWithNewDataAndDefaultChannel, +} from "../../support/api/utils/products/productsUtils"; describe("As an unlogged customer I want to order physical and digital products", () => { const startsWith = `CyPurchaseByType`; @@ -33,7 +35,7 @@ describe("As an unlogged customer I want to order physical and digital products" let physicalVariants; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({ physicalProductName: physicalName, digitalProductName: digitalName, @@ -54,7 +56,7 @@ describe("As an unlogged customer I want to order physical and digital products" }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/checkout/stocksInCheckout.js b/cypress/e2e/checkout/stocksInCheckout.js index 0b957deff..26ee5b2a1 100644 --- a/cypress/e2e/checkout/stocksInCheckout.js +++ b/cypress/e2e/checkout/stocksInCheckout.js @@ -8,8 +8,12 @@ import { createCheckout, } from "../../support/api/requests/Checkout"; import { getVariants } from "../../support/api/requests/Product"; -import { createWaitingForCaptureOrder } from "../../support/api/utils/ordersUtils"; -import { createNewProductWithSeveralVariants } from "../../support/api/utils/products/productsUtils"; +import { + createWaitingForCaptureOrder, +} from "../../support/api/utils/ordersUtils"; +import { + createNewProductWithSeveralVariants, +} from "../../support/api/utils/products/productsUtils"; describe("Manage products stocks in checkout", () => { const startsWith = "CyStocksCheckout-"; @@ -23,7 +27,7 @@ describe("Manage products stocks in checkout", () => { let lastVariantInStock; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); const variantsData = [ { diff --git a/cypress/e2e/checkout/warehouses.js b/cypress/e2e/checkout/warehouses.js index 24eae14d0..161ca4a30 100644 --- a/cypress/e2e/checkout/warehouses.js +++ b/cypress/e2e/checkout/warehouses.js @@ -21,7 +21,7 @@ describe("Warehouses in checkout", () => { "should not be possible to buy product for country not listed in warehouse", { tags: ["@checkout", "@allEnv", "@stable", "@oldRelease"] }, () => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); const name = `${startsWith}${faker.datatype.number()}`; cy.fixture("addresses") .then(addresses => { diff --git a/cypress/e2e/configuration/attributes/attributeVariantSelection.js b/cypress/e2e/configuration/attributes/attributeVariantSelection.js index b22ff1a5a..ad516eeac 100644 --- a/cypress/e2e/configuration/attributes/attributeVariantSelection.js +++ b/cypress/e2e/configuration/attributes/attributeVariantSelection.js @@ -7,9 +7,15 @@ import { addVariantUrl } from "../../../fixtures/urlList"; import { createCategory } from "../../../support/api/requests/Category"; import { getVariant } from "../../../support/api/requests/Product"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; -import { createProductInChannelWithoutVariants } from "../../../support/api/utils/products/productsUtils"; -import { createProductTypeWithNewVariantSelectionAttribute } from "../../../support/api/utils/productTypeUtils"; -import { fillUpVariantDetails } from "../../../support/pages/catalog/products/VariantsPage"; +import { + createProductInChannelWithoutVariants, +} from "../../../support/api/utils/products/productsUtils"; +import { + createProductTypeWithNewVariantSelectionAttribute, +} from "../../../support/api/utils/productTypeUtils"; +import { + fillUpVariantDetails, +} from "../../../support/pages/catalog/products/VariantsPage"; describe("As an admin I want to use attributes in variant selection", () => { const startsWith = "VarSel" + Date.now(); @@ -24,7 +30,7 @@ describe("As an admin I want to use attributes in variant selection", () => { let category; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel().then(defaultChannel => (channel = defaultChannel)); createCategory({ name: startsWith }).then(categoryResp => { category = categoryResp; @@ -33,7 +39,7 @@ describe("As an admin I want to use attributes in variant selection", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); attributesTypes.forEach(attributeType => { diff --git a/cypress/e2e/configuration/attributes/createContentAttribute.js b/cypress/e2e/configuration/attributes/createContentAttribute.js index 6c20d9c4f..2a3ef165f 100644 --- a/cypress/e2e/configuration/attributes/createContentAttribute.js +++ b/cypress/e2e/configuration/attributes/createContentAttribute.js @@ -3,12 +3,18 @@ import faker from "faker"; -import { ATTRIBUTES_DETAILS } from "../../../elements/attribute/attributes_details"; +import { + ATTRIBUTES_DETAILS, +} from "../../../elements/attribute/attributes_details"; import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list"; import { urlList } from "../../../fixtures/urlList"; import { getAttribute } from "../../../support/api/requests/Attribute"; -import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData"; -import { createAttributeWithInputType } from "../../../support/pages/attributesPage"; +import { + expectCorrectDataInAttribute, +} from "../../../support/api/utils/attributes/checkAttributeData"; +import { + createAttributeWithInputType, +} from "../../../support/pages/attributesPage"; describe("As an admin I want to create content attribute", () => { const startsWith = "AttrCont" + Date.now(); @@ -42,13 +48,8 @@ describe("As an admin I want to create content attribute", () => { { unitSystem: "without selecting unit", testCase: "SALEOR_0521" }, ]; - before(() => { - cy.clearSessionData().loginUserViaRequest(); - }); - beforeEach(() => { - cy.clearSessionData() - .loginUserViaRequest() + cy.loginUserViaRequest() .visit(urlList.attributes) .get(ATTRIBUTES_LIST.createAttributeButton) .click() diff --git a/cypress/e2e/configuration/attributes/createProductAttributes.js b/cypress/e2e/configuration/attributes/createProductAttributes.js index de2bdde7e..518907013 100644 --- a/cypress/e2e/configuration/attributes/createProductAttributes.js +++ b/cypress/e2e/configuration/attributes/createProductAttributes.js @@ -3,15 +3,22 @@ import faker from "faker"; -import { ATTRIBUTES_DETAILS } from "../../../elements/attribute/attributes_details"; +import { + ATTRIBUTES_DETAILS, +} from "../../../elements/attribute/attributes_details"; import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; -import { attributeDetailsUrl, urlList } from "../../../fixtures/urlList"; +import { + attributeDetailsUrl, + urlList, +} from "../../../fixtures/urlList"; import { createAttribute, getAttribute, } from "../../../support/api/requests/Attribute"; -import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData"; +import { + expectCorrectDataInAttribute, +} from "../../../support/api/utils/attributes/checkAttributeData"; import { createAttributeWithInputType, fillUpAttributeNameAndCode, @@ -48,13 +55,8 @@ describe("As an admin I want to create product attribute", () => { { unitSystem: "without selecting unit", testCase: "SALEOR_0510" }, ]; - before(() => { - cy.clearSessionData().loginUserViaRequest(); - }); - beforeEach(() => { - cy.clearSessionData() - .loginUserViaRequest() + cy.loginUserViaRequest() .visit(urlList.attributes) .get(ATTRIBUTES_LIST.createAttributeButton) .click(); diff --git a/cypress/e2e/configuration/attributes/deleteAndUpdateContentAttribute.js b/cypress/e2e/configuration/attributes/deleteAndUpdateContentAttribute.js index 8a56eba5b..0947d061a 100644 --- a/cypress/e2e/configuration/attributes/deleteAndUpdateContentAttribute.js +++ b/cypress/e2e/configuration/attributes/deleteAndUpdateContentAttribute.js @@ -9,18 +9,16 @@ import { createAttribute, getAttribute, } from "../../../support/api/requests/Attribute"; -import { fillUpAttributeNameAndCode } from "../../../support/pages/attributesPage"; +import { + fillUpAttributeNameAndCode, +} from "../../../support/pages/attributesPage"; describe("As an admin I want to delete and update content attribute", () => { const startsWith = "AttrContDel" + Date.now(); let attribute; - before(() => { - cy.clearSessionData().loginUserViaRequest(); - }); - beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createAttribute({ name: `${startsWith}${faker.datatype.number()}`, type: "PAGE_TYPE", diff --git a/cypress/e2e/configuration/attributes/filters.js b/cypress/e2e/configuration/attributes/filters.js index 9ee219f19..5c5fedbf9 100644 --- a/cypress/e2e/configuration/attributes/filters.js +++ b/cypress/e2e/configuration/attributes/filters.js @@ -7,8 +7,12 @@ import { } from "../../../elements/shared/sharedElements"; import { updateAttribute } from "../../../support/api/requests/Attribute"; import { createProduct } from "../../../support/api/requests/Product"; -import { createTypeAttributeAndCategoryForProduct } from "../../../support/api/utils/products/productsUtils"; -import { enterAttributeAndChanegeIsFilterableInDashbord } from "../../../support/pages/attributesPage"; +import { + createTypeAttributeAndCategoryForProduct, +} from "../../../support/api/utils/products/productsUtils"; +import { + enterAttributeAndChanegeIsFilterableInDashbord, +} from "../../../support/pages/attributesPage"; import { enterProductListPage, selectAttributeFilter, @@ -21,7 +25,7 @@ xdescribe("Tests for using attributes in filters", () => { let attribute; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createTypeAttributeAndCategoryForProduct({ name: startsWith, attributeValues: [startsWith], @@ -38,7 +42,7 @@ xdescribe("Tests for using attributes in filters", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/configuration/channels/channels.js b/cypress/e2e/configuration/channels/channels.js index 8d226fcd7..e749f0228 100644 --- a/cypress/e2e/configuration/channels/channels.js +++ b/cypress/e2e/configuration/channels/channels.js @@ -2,14 +2,25 @@ /// import faker from "faker"; -import { ADD_CHANNEL_FORM_SELECTORS } from "../../../elements/channels/add-channel-form-selectors"; -import { AVAILABLE_CHANNELS_FORM } from "../../../elements/channels/available-channels-form"; -import { CHANNELS_SELECTORS } from "../../../elements/channels/channels-selectors"; -import { SELECT_CHANNELS_TO_ASSIGN } from "../../../elements/channels/select-channels-to-assign"; +import { + ADD_CHANNEL_FORM_SELECTORS, +} from "../../../elements/channels/add-channel-form-selectors"; +import { + AVAILABLE_CHANNELS_FORM, +} from "../../../elements/channels/available-channels-form"; +import { + CHANNELS_SELECTORS, +} from "../../../elements/channels/channels-selectors"; +import { + SELECT_CHANNELS_TO_ASSIGN, +} from "../../../elements/channels/select-channels-to-assign"; import { HEADER_SELECTORS } from "../../../elements/header/header-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { MESSAGES } from "../../../fixtures/"; -import { productDetailsUrl, urlList } from "../../../fixtures/urlList"; +import { + productDetailsUrl, + urlList, +} from "../../../fixtures/urlList"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; import { createChannel } from "../../../support/api/requests/Channels"; import { getFirstProducts } from "../../../support/api/requests/Product"; @@ -17,7 +28,9 @@ import { createShippingZoneWithoutWarehouse, getShippingZone, } from "../../../support/api/requests/ShippingMethod"; -import { createWarehouse as createWarehouseViaApi } from "../../../support/api/requests/Warehouse"; +import { + createWarehouse as createWarehouseViaApi, +} from "../../../support/api/requests/Warehouse"; import { createChannelByView, setChannelRequiredFields, @@ -32,7 +45,7 @@ describe("Channels", () => { let usAddress; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createShippingZoneWithoutWarehouse(randomName, "US").then( shippingZoneResp => { shippingZone = shippingZoneResp; @@ -52,10 +65,7 @@ describe("Channels", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest( - "auth", - ONE_PERMISSION_USERS.channel, - ); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.channel); }); it( diff --git a/cypress/e2e/configuration/channels/inactiveChannel.js b/cypress/e2e/configuration/channels/inactiveChannel.js index e8ed13dcc..33f79b4c9 100644 --- a/cypress/e2e/configuration/channels/inactiveChannel.js +++ b/cypress/e2e/configuration/channels/inactiveChannel.js @@ -3,8 +3,12 @@ import faker from "faker"; -import { CHANNEL_FORM_SELECTORS } from "../../../elements/channels/channel-form-selectors"; -import { DRAFT_ORDER_SELECTORS } from "../../../elements/orders/draft-order-selectors"; +import { + CHANNEL_FORM_SELECTORS, +} from "../../../elements/channels/channel-form-selectors"; +import { + DRAFT_ORDER_SELECTORS, +} from "../../../elements/orders/draft-order-selectors"; import { ORDERS_SELECTORS } from "../../../elements/orders/orders-selectors"; import { urlList } from "../../../fixtures/urlList"; import { @@ -12,13 +16,17 @@ import { createChannel, } from "../../../support/api/requests/Channels"; import { createCheckout } from "../../../support/api/requests/Checkout"; -import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails"; +import { + getProductDetails, +} from "../../../support/api/requests/storeFront/ProductDetails"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; import { createProductInChannel, createTypeAttributeAndCategoryForProduct, } from "../../../support/api/utils/products/productsUtils"; -import { isProductVisible } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; +import { + isProductVisible, +} from "../../../support/api/utils/storeFront/storeFrontProductUtils"; describe("Tests on inactive channel", () => { const channelStartsWith = `InactiveChannel`; @@ -30,7 +38,7 @@ describe("Tests on inactive channel", () => { let newChannel; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); cy.fixture("addresses").then(({ plAddress }) => { address = plAddress; }); @@ -47,7 +55,7 @@ describe("Tests on inactive channel", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/configuration/customer.js b/cypress/e2e/configuration/customer.js index 607e5de8b..7530ce9eb 100644 --- a/cypress/e2e/configuration/customer.js +++ b/cypress/e2e/configuration/customer.js @@ -3,11 +3,18 @@ import faker from "faker"; -import { CUSTOMER_DETAILS_SELECTORS } from "../../elements/customer/customer-details"; -import { CUSTOMERS_LIST_SELECTORS } 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"; +import { + customerDetailsUrl, + urlList, +} from "../../fixtures/urlList"; import { addressCreate, createCustomer, @@ -20,7 +27,7 @@ describe("Tests for customer", () => { let secondAddress; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); cy.fixture("addresses").then(({ usAddress, secondUsAddress }) => { address = usAddress; secondAddress = secondUsAddress; @@ -29,7 +36,7 @@ describe("Tests for customer", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/configuration/navigation.js b/cypress/e2e/configuration/navigation.js index 7ef68af57..c4c09290d 100644 --- a/cypress/e2e/configuration/navigation.js +++ b/cypress/e2e/configuration/navigation.js @@ -21,7 +21,7 @@ describe("Tests for menu navigation", () => { let menu; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createMenuViaApi(randomName).then(({ menu: menuResp }) => { menu = menuResp; cy.checkIfDataAreNotNull(menu); @@ -29,7 +29,7 @@ describe("Tests for menu navigation", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/configuration/permissions.js b/cypress/e2e/configuration/permissions.js index 63b26474e..bfbdfca44 100644 --- a/cypress/e2e/configuration/permissions.js +++ b/cypress/e2e/configuration/permissions.js @@ -3,8 +3,12 @@ import faker from "faker"; -import { PERMISSION_GROUP_DETAILS_SELECTORS } from "../../elements/permissionGroup/permissionGroupDetails"; -import { PERMISSION_GROUP_LIST_SELECTORS } 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 { @@ -17,18 +21,16 @@ import { createPermissionGroup, getPermissionGroup, } from "../../support/api/requests/PermissionGroup.js"; -import { getStaffMembersStartsWith } from "../../support/api/requests/StaffMembers"; +import { + getStaffMembersStartsWith, +} from "../../support/api/requests/StaffMembers"; describe("Permissions groups", () => { const startsWith = "CyPermissions-" + Date.now(); const permissionManageProducts = "[MANAGE_PRODUCTS]"; - before(() => { - cy.clearSessionData().loginUserViaRequest(); - }); - beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/configuration/plugins/adyen.js b/cypress/e2e/configuration/plugins/adyen.js index 2d1933682..4422698d1 100644 --- a/cypress/e2e/configuration/plugins/adyen.js +++ b/cypress/e2e/configuration/plugins/adyen.js @@ -36,7 +36,7 @@ describe("Adyen payments", () => { let cardData; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); cy.fixture("cards").then(cardsResp => { paymentCards = cardsResp.adyen; cardData = { @@ -101,7 +101,7 @@ describe("Adyen payments", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createCheckout({ channelSlug: defaultChannel.slug, email, diff --git a/cypress/e2e/configuration/plugins/plugins.js b/cypress/e2e/configuration/plugins/plugins.js index 5072842ea..490a3dba8 100644 --- a/cypress/e2e/configuration/plugins/plugins.js +++ b/cypress/e2e/configuration/plugins/plugins.js @@ -3,7 +3,9 @@ import faker from "faker"; -import { PLUGINS_DETAILS_SELECTORS } from "../../../elements/plugins/pluginDetails"; +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"; @@ -25,7 +27,7 @@ describe("As an admin I want to manage plugins", () => { let defaultChannel; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel().then(channel => { defaultChannel = channel; activatePlugin({ id: "mirumee.notifications.admin_email" }); @@ -37,10 +39,7 @@ describe("As an admin I want to manage plugins", () => { }); beforeEach(() => { - cy.clearSessionData() - .loginUserViaRequest() - .visit(urlList.plugins) - .expectSkeletonIsVisible(); + cy.loginUserViaRequest().visit(urlList.plugins).expectSkeletonIsVisible(); }); it( diff --git a/cypress/e2e/configuration/plugins/stripe.js b/cypress/e2e/configuration/plugins/stripe.js index 0a03fd716..89686c259 100644 --- a/cypress/e2e/configuration/plugins/stripe.js +++ b/cypress/e2e/configuration/plugins/stripe.js @@ -13,7 +13,9 @@ import { addStripePaymentAndGetConfirmationData, getShippingMethodIdFromCheckout, } from "../../../support/api/utils/ordersUtils"; -import { createProductWithShipping } from "../../../support/api/utils/products/productsUtils"; +import { + createProductWithShipping, +} from "../../../support/api/utils/products/productsUtils"; describe("Stripe payments", () => { const startsWith = "Stripe-" + faker.datatype.number(); @@ -28,7 +30,7 @@ describe("Stripe payments", () => { let cardData; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); cy.fixture("cards").then(({ stripe }) => { paymentCards = stripe; cardData = { @@ -56,7 +58,7 @@ describe("Stripe payments", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createCheckout({ channelSlug: defaultChannel.slug, email, diff --git a/cypress/e2e/configuration/productTypes/attributesInProduductTypes.js b/cypress/e2e/configuration/productTypes/attributesInProduductTypes.js index cc400ee26..4e2061ae0 100644 --- a/cypress/e2e/configuration/productTypes/attributesInProduductTypes.js +++ b/cypress/e2e/configuration/productTypes/attributesInProduductTypes.js @@ -3,7 +3,9 @@ import faker from "faker"; -import { PRODUCT_TYPE_DETAILS_SELECTORS } 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"; @@ -18,13 +20,13 @@ describe("As an admin I want to manage attributes in product types", () => { let attribute; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createAttribute({ name: startsWith }).then(resp => (attribute = resp)); cy.checkIfDataAreNotNull(attribute); }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/configuration/productTypes/createProductType.js b/cypress/e2e/configuration/productTypes/createProductType.js index c44c729a4..b4c2fbbb5 100644 --- a/cypress/e2e/configuration/productTypes/createProductType.js +++ b/cypress/e2e/configuration/productTypes/createProductType.js @@ -10,13 +10,8 @@ import { createProductType } from "../../../support/pages/productTypePage"; describe("As an admin I want to create product types", () => { const startsWith = "productType"; - before(() => { - cy.clearSessionData().loginUserViaRequest(); - }); - beforeEach(() => { - cy.clearSessionData() - .loginUserViaRequest() + cy.loginUserViaRequest() .visit(urlList.productTypes) .expectSkeletonIsVisible(); }); diff --git a/cypress/e2e/configuration/productTypes/deleteProductType.js b/cypress/e2e/configuration/productTypes/deleteProductType.js index 47e94eea9..adffc7a1b 100644 --- a/cypress/e2e/configuration/productTypes/deleteProductType.js +++ b/cypress/e2e/configuration/productTypes/deleteProductType.js @@ -11,9 +11,13 @@ import { createTypeProduct, getProductType, } from "../../../support/api/requests/ProductType"; -import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails"; +import { + getProductDetails, +} from "../../../support/api/requests/storeFront/ProductDetails"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; -import { createProductInChannel } from "../../../support/api/utils/products/productsUtils"; +import { + createProductInChannel, +} from "../../../support/api/utils/products/productsUtils"; describe("As an admin I want to manage product types", () => { const startsWith = "delProdType" + faker.datatype.number(); @@ -22,7 +26,7 @@ describe("As an admin I want to manage product types", () => { let attribute; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createAttribute({ name: startsWith }).then(resp => (attribute = resp)); createCategory({ name: startsWith }).then(resp => (category = resp)); getDefaultChannel().then(resp => { @@ -32,7 +36,7 @@ describe("As an admin I want to manage product types", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/configuration/shippingMethods/channelsInShipping.js b/cypress/e2e/configuration/shippingMethods/channelsInShipping.js index 7c7a8806a..012db3e9a 100644 --- a/cypress/e2e/configuration/shippingMethods/channelsInShipping.js +++ b/cypress/e2e/configuration/shippingMethods/channelsInShipping.js @@ -4,7 +4,9 @@ import faker from "faker"; import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements"; -import { SHIPPING_ZONE_DETAILS } from "../../../elements/shipping/shipping-zone-details"; +import { + SHIPPING_ZONE_DETAILS, +} from "../../../elements/shipping/shipping-zone-details"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; import { createChannel } from "../../../support/api/requests/Channels"; import { @@ -22,10 +24,6 @@ describe("As a staff user I want have different shipping method prices for each const startsWith = "ChannelShippingMethod"; let defaultChannel; - before(() => { - cy.clearSessionData().loginUserViaRequest(); - }); - it( "should be able to display different price for each channel. TC: SALEOR_0805", { tags: ["@shipping", "@allEnv", "@stable"] }, diff --git a/cypress/e2e/configuration/shippingMethods/createShippingMethod.js b/cypress/e2e/configuration/shippingMethods/createShippingMethod.js index eeba4a554..4e3fd2699 100644 --- a/cypress/e2e/configuration/shippingMethods/createShippingMethod.js +++ b/cypress/e2e/configuration/shippingMethods/createShippingMethod.js @@ -5,14 +5,21 @@ import faker from "faker"; import { urlList } from "../../../fixtures/urlList"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; -import { updateChannelWarehouses } from "../../../support/api/requests/Channels"; +import { + updateChannelWarehouses, +} from "../../../support/api/requests/Channels"; import { createCheckout } from "../../../support/api/requests/Checkout"; import { createVariant } from "../../../support/api/requests/Product"; import { createWarehouse } from "../../../support/api/requests/Warehouse"; import * as channelsUtils from "../../../support/api/utils/channelsUtils"; -import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; -import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils"; +import { + createWaitingForCaptureOrder, +} from "../../../support/api/utils/ordersUtils"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; +import { + isShippingAvailableInCheckout, +} from "../../../support/api/utils/storeFront/checkoutUtils"; import { createShippingRate, createShippingZone, @@ -37,7 +44,7 @@ describe("As a staff user I want to create shipping zone and rate", () => { const productTypeSlug = `${faker.lorem.slug()}slug`; const productSlug = `${faker.lorem.slug()}slug`; const warehouseSlug = `${faker.lorem.slug()}slug`; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); channelsUtils .getDefaultChannel() .then(channel => { @@ -108,7 +115,7 @@ describe("As a staff user I want to create shipping zone and rate", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/configuration/shippingMethods/editShippingMethod.js b/cypress/e2e/configuration/shippingMethods/editShippingMethod.js index 3552cfaf7..4ee38da0c 100644 --- a/cypress/e2e/configuration/shippingMethods/editShippingMethod.js +++ b/cypress/e2e/configuration/shippingMethods/editShippingMethod.js @@ -4,7 +4,9 @@ import faker from "faker"; import { shippingRateUrl } from "../../../fixtures/urlList"; -import { updateChannelWarehouses } from "../../../support/api/requests/Channels"; +import { + updateChannelWarehouses, +} from "../../../support/api/requests/Channels"; import { addChannelToShippingMethod, createShippingRate, @@ -30,7 +32,7 @@ describe("As a user I should be able to update and delete shipping method", () = let warehouse; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel() .then(channel => { @@ -64,7 +66,7 @@ describe("As a user I should be able to update and delete shipping method", () = beforeEach(() => { const rateName = `${startsWith}${faker.datatype.number()}`; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createShippingRate({ name: rateName, shippingZone: shippingZone.id, diff --git a/cypress/e2e/configuration/shippingMethods/editShippingZone.js b/cypress/e2e/configuration/shippingMethods/editShippingZone.js index 750ed8737..9de564de7 100644 --- a/cypress/e2e/configuration/shippingMethods/editShippingZone.js +++ b/cypress/e2e/configuration/shippingMethods/editShippingZone.js @@ -5,14 +5,18 @@ import faker from "faker"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { shippingZoneDetailsUrl } from "../../../fixtures/urlList"; -import { updateChannelWarehouses } from "../../../support/api/requests/Channels"; +import { + updateChannelWarehouses, +} from "../../../support/api/requests/Channels"; import { createShippingZone, getShippingZone, } from "../../../support/api/requests/ShippingMethod"; import { createWarehouse } from "../../../support/api/requests/Warehouse"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; -import { fillUpShippingZoneData } from "../../../support/pages/shippingMethodPage"; +import { + fillUpShippingZoneData, +} from "../../../support/pages/shippingMethodPage"; import { enterAndSelectShippings } from "../../../support/pages/shippingZones"; describe("As a user I should be able to update and delete shipping zone", () => { @@ -25,7 +29,7 @@ describe("As a user I should be able to update and delete shipping zone", () => let warehouse; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel() .then(channel => { defaultChannel = channel; @@ -48,7 +52,7 @@ describe("As a user I should be able to update and delete shipping zone", () => }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createShippingZone(name, "US", defaultChannel.id, warehouse.id).then( shippingZoneResp => { shippingZone = shippingZoneResp; diff --git a/cypress/e2e/configuration/shippingMethods/postalCodes.js b/cypress/e2e/configuration/shippingMethods/postalCodes.js index 43e1584f0..4d0918f7d 100644 --- a/cypress/e2e/configuration/shippingMethods/postalCodes.js +++ b/cypress/e2e/configuration/shippingMethods/postalCodes.js @@ -5,16 +5,22 @@ import faker from "faker"; import { shippingZoneDetailsUrl } from "../../../fixtures/urlList"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; -import { updateChannelWarehouses } from "../../../support/api/requests/Channels"; +import { + updateChannelWarehouses, +} from "../../../support/api/requests/Channels"; import { createCheckout } from "../../../support/api/requests/Checkout"; -import { createShippingZone } from "../../../support/api/requests/ShippingMethod"; +import { + createShippingZone, +} from "../../../support/api/requests/ShippingMethod"; import { createWarehouse } from "../../../support/api/requests/Warehouse"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; import { createProductInChannel, createTypeAttributeAndCategoryForProduct, } from "../../../support/api/utils/products/productsUtils"; -import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils"; +import { + isShippingAvailableInCheckout, +} from "../../../support/api/utils/storeFront/checkoutUtils"; import { createRateWithPostalCode, postalCodesOptions, @@ -34,7 +40,7 @@ describe("As a user I want to create shipping method with postal codes", () => { let variantsList; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel() .then(channel => { defaultChannel = channel; @@ -90,9 +96,9 @@ describe("As a user I want to create shipping method with postal codes", () => { }); beforeEach(() => { - cy.clearSessionData() - .loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping) - .visit(shippingZoneDetailsUrl(shippingZone.id)); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping).visit( + shippingZoneDetailsUrl(shippingZone.id), + ); }); it( diff --git a/cypress/e2e/configuration/shippingMethods/shippingWeights/shippingWeightsLimits.js b/cypress/e2e/configuration/shippingMethods/shippingWeights/shippingWeightsLimits.js index b5af43ce9..da601b52c 100644 --- a/cypress/e2e/configuration/shippingMethods/shippingWeights/shippingWeightsLimits.js +++ b/cypress/e2e/configuration/shippingMethods/shippingWeights/shippingWeightsLimits.js @@ -5,16 +5,22 @@ import faker from "faker"; import { shippingZoneDetailsUrl } from "../../../../fixtures/urlList"; import { ONE_PERMISSION_USERS } from "../../../../fixtures/users"; -import { updateChannelWarehouses } from "../../../../support/api/requests/Channels"; +import { + updateChannelWarehouses, +} from "../../../../support/api/requests/Channels"; import { createCheckout } from "../../../../support/api/requests/Checkout"; -import { createShippingZone } from "../../../../support/api/requests/ShippingMethod"; +import { + createShippingZone, +} from "../../../../support/api/requests/ShippingMethod"; import { createWarehouse } from "../../../../support/api/requests/Warehouse"; import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils"; import { createProductInChannel, createTypeAttributeAndCategoryForProduct, } from "../../../../support/api/utils/products/productsUtils"; -import { isShippingAvailableInCheckout } from "../../../../support/api/utils/storeFront/checkoutUtils"; +import { + isShippingAvailableInCheckout, +} from "../../../../support/api/utils/storeFront/checkoutUtils"; import { createShippingRate, rateOptions, @@ -33,7 +39,7 @@ describe("As a staff user I want to manage shipping weights", () => { let variantsList; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel() .then(channel => { defaultChannel = channel; @@ -80,9 +86,9 @@ describe("As a staff user I want to manage shipping weights", () => { }); beforeEach(() => { - cy.clearSessionData() - .loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping) - .visit(shippingZoneDetailsUrl(shippingZone.id)); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping).visit( + shippingZoneDetailsUrl(shippingZone.id), + ); }); it( diff --git a/cypress/e2e/configuration/shippingMethods/shippingWeights/weightRecalculate.js b/cypress/e2e/configuration/shippingMethods/shippingWeights/weightRecalculate.js index d827a57cd..36379625a 100644 --- a/cypress/e2e/configuration/shippingMethods/shippingWeights/weightRecalculate.js +++ b/cypress/e2e/configuration/shippingMethods/shippingWeights/weightRecalculate.js @@ -4,14 +4,23 @@ import faker from "faker"; import { SHARED_ELEMENTS } from "../../../../elements/shared/sharedElements"; -import { SHIPPING_RATE_DETAILS } from "../../../../elements/shipping/shipping-rate-details"; -import { shippingRateUrl, urlList } from "../../../../fixtures/urlList"; -import { updateChannelWarehouses } from "../../../../support/api/requests/Channels"; +import { + SHIPPING_RATE_DETAILS, +} from "../../../../elements/shipping/shipping-rate-details"; +import { + shippingRateUrl, + urlList, +} from "../../../../fixtures/urlList"; +import { + updateChannelWarehouses, +} from "../../../../support/api/requests/Channels"; import { createShippingRate as createShippingRateViaApi, createShippingZone, } from "../../../../support/api/requests/ShippingMethod"; -import { updateShopWeightUnit } from "../../../../support/api/requests/ShopSettings"; +import { + updateShopWeightUnit, +} from "../../../../support/api/requests/ShopSettings"; import { createWarehouse } from "../../../../support/api/requests/Warehouse"; import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils"; import { changeWeightUnit } from "../../../../support/pages/shippingMethodPage"; @@ -26,7 +35,7 @@ describe("As a staff user I want to change shop default weight unit", () => { let warehouse; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); updateShopWeightUnit("KG") .then(() => { getDefaultChannel().then(channel => { diff --git a/cypress/e2e/configuration/siteSettings.js b/cypress/e2e/configuration/siteSettings.js index 0a15d6b92..9d4fc5ec0 100644 --- a/cypress/e2e/configuration/siteSettings.js +++ b/cypress/e2e/configuration/siteSettings.js @@ -12,7 +12,7 @@ describe("Tests for site settings", () => { let address; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); cy.fixture("addresses").then(({ usAddress, plAddress }) => { address = usAddress; diff --git a/cypress/e2e/configuration/warehouses/warehouse.js b/cypress/e2e/configuration/warehouses/warehouse.js index 7b13dd5d1..b36348458 100644 --- a/cypress/e2e/configuration/warehouses/warehouse.js +++ b/cypress/e2e/configuration/warehouses/warehouse.js @@ -4,15 +4,21 @@ import faker from "faker"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; -import { SHIPPING_ZONE_DETAILS } from "../../../elements/shipping/shipping-zone-details"; -import { WAREHOUSES_DETAILS } from "../../../elements/warehouses/warehouse-details"; +import { + SHIPPING_ZONE_DETAILS, +} from "../../../elements/shipping/shipping-zone-details"; +import { + WAREHOUSES_DETAILS, +} from "../../../elements/warehouses/warehouse-details"; import { WAREHOUSES_LIST } from "../../../elements/warehouses/warehouses-list"; import { shippingZoneDetailsUrl, urlList, warehouseDetailsUrl, } from "../../../fixtures/urlList"; -import { updateChannelWarehouses } from "../../../support/api/requests/Channels"; +import { + updateChannelWarehouses, +} from "../../../support/api/requests/Channels"; import { createShippingZone, createShippingZoneWithoutWarehouse, @@ -29,7 +35,7 @@ describe("As an admin I want to manage warehouses", () => { let secondUsAddress; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); cy.fixture("addresses").then(addresses => { usAddress = addresses.usAddress; secondUsAddress = addresses.secondUsAddress; @@ -38,7 +44,7 @@ describe("As an admin I want to manage warehouses", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/customerRegistration.js b/cypress/e2e/customerRegistration.js index 05f917b0e..49403e709 100644 --- a/cypress/e2e/customerRegistration.js +++ b/cypress/e2e/customerRegistration.js @@ -3,7 +3,9 @@ import faker from "faker"; -import { CUSTOMER_DETAILS_SELECTORS } 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 { @@ -20,7 +22,7 @@ describe("Tests for customer registration", () => { let defaultChannel; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel().then(channel => { defaultChannel = channel; cy.checkIfDataAreNotNull({ defaultChannel }); diff --git a/cypress/e2e/discounts/sales/createSalesForProducts.js b/cypress/e2e/discounts/sales/createSalesForProducts.js index 392612407..04dc288e9 100644 --- a/cypress/e2e/discounts/sales/createSalesForProducts.js +++ b/cypress/e2e/discounts/sales/createSalesForProducts.js @@ -7,9 +7,12 @@ import { urlList } from "../../../fixtures/urlList"; import { createChannel } from "../../../support/api/requests/Channels"; import { updateChannelInProduct } from "../../../support/api/requests/Product"; import * as channelsUtils from "../../../support/api/utils/channelsUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; import { createShipping } from "../../../support/api/utils/shippingUtils"; -import { getProductPrice } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; +import { + getProductPrice, +} from "../../../support/api/utils/storeFront/storeFrontProductUtils"; import { getDefaultTaxClass, updateTaxConfigurationForChannel, @@ -36,7 +39,7 @@ describe("As an admin I want to create sale for products", () => { before(() => { const name = `${startsWith}${faker.datatype.number()}`; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); productsUtils .createTypeAttributeAndCategoryForProduct({ name }) .then( @@ -82,7 +85,7 @@ describe("As an admin I want to create sale for products", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); updateTaxConfigurationForChannel({ channelSlug: defaultChannel.slug, pricesEnteredWithTax: true, diff --git a/cypress/e2e/discounts/sales/createSalesForVariants.js b/cypress/e2e/discounts/sales/createSalesForVariants.js index e39632834..5454a360d 100644 --- a/cypress/e2e/discounts/sales/createSalesForVariants.js +++ b/cypress/e2e/discounts/sales/createSalesForVariants.js @@ -11,7 +11,8 @@ import { createSaleInChannel, getVariantWithSaleStatus, } from "../../../support/api/utils/discounts/salesUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; import { createShipping } from "../../../support/api/utils/shippingUtils"; import { getDefaultTaxClass, @@ -36,7 +37,7 @@ describe("Sales discounts for variant", () => { before(() => { const name = `${startsWith}${faker.datatype.number()}`; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); channelsUtils .getDefaultChannel() .then(channel => { @@ -86,7 +87,7 @@ describe("Sales discounts for variant", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); updateTaxConfigurationForChannel({ channelSlug: defaultChannel.slug, pricesEnteredWithTax: true, diff --git a/cypress/e2e/discounts/sales/updateSales.js b/cypress/e2e/discounts/sales/updateSales.js index 0401ae648..108a9126a 100644 --- a/cypress/e2e/discounts/sales/updateSales.js +++ b/cypress/e2e/discounts/sales/updateSales.js @@ -46,7 +46,7 @@ describe("As an admin I want to update sales", () => { before(() => { const name = `${startsWith}${faker.datatype.number()}`; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); deleteProductsStartsWith(startsWith); deleteShippingStartsWith(startsWith); deleteSalesStartsWith(startsWith); @@ -104,7 +104,7 @@ describe("As an admin I want to update sales", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); updateTaxConfigurationForChannel({ channelSlug: defaultChannel.slug, pricesEnteredWithTax: true, diff --git a/cypress/e2e/discounts/vouchers/createVouchers.js b/cypress/e2e/discounts/vouchers/createVouchers.js index 42af468d0..f47a5bf99 100644 --- a/cypress/e2e/discounts/vouchers/createVouchers.js +++ b/cypress/e2e/discounts/vouchers/createVouchers.js @@ -10,8 +10,11 @@ import { addPayment, createCheckoutWithVoucher, } from "../../../support/api/utils/ordersUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; -import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; +import { + updateTaxConfigurationForChannel, +} from "../../../support/api/utils/taxesUtils"; import { createVoucher, discountOptions, @@ -30,7 +33,7 @@ describe("As an admin I want to create voucher", () => { let defaultChannel; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); productsUtils .createProductWithShipping({ name, productPrice, shippingPrice }) .then( @@ -63,7 +66,7 @@ describe("As an admin I want to create voucher", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); updateTaxConfigurationForChannel({ channelSlug: defaultChannel.slug, pricesEnteredWithTax: true, diff --git a/cypress/e2e/discounts/vouchers/createVouchersWithLimits.js b/cypress/e2e/discounts/vouchers/createVouchersWithLimits.js index b3284698e..cf4576d7d 100644 --- a/cypress/e2e/discounts/vouchers/createVouchersWithLimits.js +++ b/cypress/e2e/discounts/vouchers/createVouchersWithLimits.js @@ -8,7 +8,8 @@ import { addPayment, createCheckoutWithVoucher, } from "../../../support/api/utils/ordersUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; import { discountOptions, loginAndCreateCheckoutForVoucherWithDiscount, @@ -26,7 +27,7 @@ describe("As an admin I want to create voucher", () => { before(() => { const name = `${startsWith}${faker.datatype.number()}`; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); productsUtils .createProductWithShipping({ name, productPrice, shippingPrice }) .then( diff --git a/cypress/e2e/discounts/vouchers/updateVouchers.js b/cypress/e2e/discounts/vouchers/updateVouchers.js index 8b2808b14..71c1d6977 100644 --- a/cypress/e2e/discounts/vouchers/updateVouchers.js +++ b/cypress/e2e/discounts/vouchers/updateVouchers.js @@ -6,11 +6,21 @@ import faker from "faker"; import { VOUCHERS_SELECTORS } from "../../../elements/discounts/vouchers"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { voucherDetailsUrl } from "../../../fixtures/urlList"; -import { createVoucherInChannel } from "../../../support/api/utils/discounts/vouchersUtils"; -import { createCheckoutWithVoucher } from "../../../support/api/utils/ordersUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; -import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils"; -import { formatDate, formatTime } from "../../../support/formatData/formatDate"; +import { + createVoucherInChannel, +} from "../../../support/api/utils/discounts/vouchersUtils"; +import { + createCheckoutWithVoucher, +} from "../../../support/api/utils/ordersUtils"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; +import { + updateTaxConfigurationForChannel, +} from "../../../support/api/utils/taxesUtils"; +import { + formatDate, + formatTime, +} from "../../../support/formatData/formatDate"; import { setVoucherDate } from "../../../support/pages/discounts/vouchersPage"; describe("As an admin I want to update vouchers", () => { @@ -26,7 +36,7 @@ describe("As an admin I want to update vouchers", () => { before(() => { const name = `${startsWith}${faker.datatype.number()}`; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); productsUtils .createProductWithShipping({ name, productPrice, shippingPrice }) .then( @@ -57,7 +67,7 @@ describe("As an admin I want to update vouchers", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); updateTaxConfigurationForChannel({ channelSlug: defaultChannel.slug, pricesEnteredWithTax: true, diff --git a/cypress/e2e/homePage/homePageAnalitics.js b/cypress/e2e/homePage/homePageAnalitics.js index 28c78ffe8..b45d83ccc 100644 --- a/cypress/e2e/homePage/homePageAnalitics.js +++ b/cypress/e2e/homePage/homePageAnalitics.js @@ -44,7 +44,7 @@ describe("As an admin I want to see correct information on dashboard home page", let ordersRegexp; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); productsUtils .createProductWithShipping({ name: randomName, @@ -140,7 +140,7 @@ describe("As an admin I want to see correct information on dashboard home page", }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/login.js b/cypress/e2e/login.js index ccd4f5fe2..21cfa3879 100644 --- a/cypress/e2e/login.js +++ b/cypress/e2e/login.js @@ -5,10 +5,6 @@ import { LOGIN_SELECTORS } from "../elements/account/login-selectors"; import { urlList } from "../fixtures/urlList"; describe("User authorization", () => { - beforeEach(() => { - cy.clearSessionData(); - }); - it( "should successfully log in an user", { tags: ["@login", "@allEnv", "@stable", "@oldRelease"] }, diff --git a/cypress/e2e/metadata.js b/cypress/e2e/metadata.js index 8a72f55e0..33b6638cd 100644 --- a/cypress/e2e/metadata.js +++ b/cypress/e2e/metadata.js @@ -6,8 +6,13 @@ import { updateMetadata, updatePrivateMetadata, } from "../support/api/requests/Metadata"; -import { createDraftOrder, getOrder } from "../support/api/requests/Order"; -import { getProductMetadata } from "../support/api/requests/storeFront/ProductDetails"; +import { + createDraftOrder, + getOrder, +} from "../support/api/requests/Order"; +import { + getProductMetadata, +} from "../support/api/requests/storeFront/ProductDetails"; import { getDefaultChannel } from "../support/api/utils/channelsUtils"; import { createProductInChannel, @@ -22,7 +27,7 @@ describe("Test for metadata", () => { let product; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel() .then(channelResp => { channel = channelResp; @@ -47,7 +52,7 @@ describe("Test for metadata", () => { "should create metadata for product", { tags: ["@metadata", "@allEnv", "@stable"] }, () => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); updateMetadata(product.id, metadata.key, metadata.value); updatePrivateMetadata(product.id, metadata.key, metadata.value) .then(() => { @@ -90,7 +95,7 @@ describe("Test for metadata", () => { { tags: ["@metadata", "@allEnv", "@stable"] }, () => { let order; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createDraftOrder({ channelId: channel.id }) .then(orderResp => { order = orderResp; diff --git a/cypress/e2e/navigation.js b/cypress/e2e/navigation.js index 0bf5408d1..09d3d4977 100644 --- a/cypress/e2e/navigation.js +++ b/cypress/e2e/navigation.js @@ -35,9 +35,6 @@ import { } from "../support/pages/mainMenuPage"; 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"] }, diff --git a/cypress/e2e/orders/channelsInDraftOrders.js b/cypress/e2e/orders/channelsInDraftOrders.js index 72933a23b..202d500fb 100644 --- a/cypress/e2e/orders/channelsInDraftOrders.js +++ b/cypress/e2e/orders/channelsInDraftOrders.js @@ -3,9 +3,13 @@ import faker from "faker"; -import { CHANNEL_FORM_SELECTORS } from "../../elements/channels/channel-form-selectors"; +import { + CHANNEL_FORM_SELECTORS, +} from "../../elements/channels/channel-form-selectors"; import { HEADER_SELECTORS } from "../../elements/header/header-selectors"; -import { DRAFT_ORDER_SELECTORS } from "../../elements/orders/draft-order-selectors"; +import { + DRAFT_ORDER_SELECTORS, +} from "../../elements/orders/draft-order-selectors"; import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors"; import { urlList } from "../../fixtures/urlList"; import { createChannel } from "../../support/api/requests/Channels"; @@ -23,7 +27,7 @@ xdescribe("Channels in draft orders", () => { let otherChannel; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); channelsUtils .getDefaultChannel() .then(channel => { @@ -37,7 +41,7 @@ xdescribe("Channels in draft orders", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/orders/draftOrders.js b/cypress/e2e/orders/draftOrders.js index c6c002e5e..739ac25f4 100644 --- a/cypress/e2e/orders/draftOrders.js +++ b/cypress/e2e/orders/draftOrders.js @@ -19,7 +19,9 @@ import { getDefaultChannel, } from "../../support/api/utils/"; import * as productsUtils from "../../support/api/utils/products/productsUtils"; -import { ensureCanvasStatic } from "../../support/customCommands/sharedElementsOperations/canvas"; +import { + ensureCanvasStatic, +} from "../../support/customCommands/sharedElementsOperations/canvas"; import { finalizeDraftOrder, selectChannelInPicker, @@ -36,7 +38,7 @@ describe("Draft orders", () => { let shippingMethod; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); updateOrdersSettings(); getDefaultChannel() .then(channel => { @@ -94,7 +96,7 @@ describe("Draft orders", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/orders/manageStockReservation.js b/cypress/e2e/orders/manageStockReservation.js index 04d783c7e..9cb353362 100644 --- a/cypress/e2e/orders/manageStockReservation.js +++ b/cypress/e2e/orders/manageStockReservation.js @@ -4,7 +4,9 @@ import faker from "faker"; import { createCheckout } from "../../support/api/requests/Checkout"; -import { updateStockReservation } from "../../support/api/requests/ShopSettings"; +import { + updateStockReservation, +} from "../../support/api/requests/ShopSettings"; import { getDefaultChannel } from "../../support/api/utils/channelsUtils"; import { createProductInChannel, @@ -34,7 +36,7 @@ describe("As an admin I want to manage stock reservation", () => { let dataForCheckout; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); cy.fixture("addresses").then(addresses => { address = addresses.usAddress; @@ -81,7 +83,7 @@ describe("As an admin I want to manage stock reservation", () => { beforeEach(() => { const productName = `${startsWith}${faker.datatype.number()}`; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createProductInChannel({ attributeId: attribute.id, diff --git a/cypress/e2e/orders/orders.js b/cypress/e2e/orders/orders.js index 532d0e127..58682a01f 100644 --- a/cypress/e2e/orders/orders.js +++ b/cypress/e2e/orders/orders.js @@ -80,7 +80,7 @@ describe("Orders", () => { privateMetadataValue + "- updated private metadata value"; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); updateOrdersSettings(); getDefaultChannel() .then(channel => { @@ -148,10 +148,7 @@ describe("Orders", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest( - "auth", - ONE_PERMISSION_USERS.order, - ); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.order); }); it( diff --git a/cypress/e2e/orders/transactionsForOrders.js b/cypress/e2e/orders/transactionsForOrders.js index abee0a440..94966df9e 100644 --- a/cypress/e2e/orders/transactionsForOrders.js +++ b/cypress/e2e/orders/transactionsForOrders.js @@ -4,7 +4,10 @@ import faker from "faker"; import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors"; -import { ONE_PERMISSION_USERS, urlList } from "../../fixtures"; +import { + ONE_PERMISSION_USERS, + urlList, +} from "../../fixtures"; import { createChannel, createCustomer, @@ -34,7 +37,7 @@ describe("Orders", () => { let taxClass; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createChannel({ name: randomName }) .then(channelResp => { channel = channelResp; @@ -103,12 +106,10 @@ describe("Orders", () => { }); beforeEach(() => { - cy.clearSessionData() - .loginUserViaRequest("auth", ONE_PERMISSION_USERS.order) - .then(() => { - // set notifiedAboutNavigator to make navigator banner gone from the start - banner was covering needed elements during test - window.localStorage.setItem("notifiedAboutNavigator", "true"); - }); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.order).then(() => { + // set notifiedAboutNavigator to make navigator banner gone from the start - banner was covering needed elements during test + window.localStorage.setItem("notifiedAboutNavigator", "true"); + }); }); it( diff --git a/cypress/e2e/pages/pageTypes.js b/cypress/e2e/pages/pageTypes.js index 499df33d1..6558379a3 100644 --- a/cypress/e2e/pages/pageTypes.js +++ b/cypress/e2e/pages/pageTypes.js @@ -3,11 +3,18 @@ import faker from "faker"; -import { PAGE_TYPE_DETAILS_SELECTORS } from "../../elements/pageTypes/pageTypeDetails"; -import { PAGE_TYPES_LIST_SELECTORS } 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"; +import { + pageTypeDetailsUrl, + urlList, +} from "../../fixtures/urlList"; import { createAttribute } from "../../support/api/requests/Attribute"; import { createPageType, @@ -18,7 +25,7 @@ describe("Tests for page types", () => { const startsWith = "PageTypes"; beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/pages/pages.js b/cypress/e2e/pages/pages.js index 47cfeeb97..13e436be9 100644 --- a/cypress/e2e/pages/pages.js +++ b/cypress/e2e/pages/pages.js @@ -37,7 +37,7 @@ describe("Tests for pages", () => { }; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); attributeRequests .createAttribute({ name, type: "PAGE_TYPE" }) .then(attributeResp => { @@ -51,7 +51,7 @@ describe("Tests for pages", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/products/createProduct.js b/cypress/e2e/products/createProduct.js index 8d9ce15da..138857ce7 100644 --- a/cypress/e2e/products/createProduct.js +++ b/cypress/e2e/products/createProduct.js @@ -3,7 +3,9 @@ import faker from "faker"; -import { PRODUCT_DETAILS } from "../../elements/catalog/products/product-details"; +import { + PRODUCT_DETAILS, +} from "../../elements/catalog/products/product-details"; import { PRODUCTS_LIST } from "../../elements/catalog/products/products-list"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { urlList } from "../../fixtures/urlList"; @@ -52,14 +54,14 @@ describe("As an admin I should be able to create product", () => { let attribute; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createAttribute({ name }).then(attributeResp => { attribute = attributeResp; cy.checkIfDataAreNotNull({ attribute }); }); }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/products/images.js b/cypress/e2e/products/images.js index d2214c8dc..09086d749 100644 --- a/cypress/e2e/products/images.js +++ b/cypress/e2e/products/images.js @@ -1,12 +1,16 @@ /// /// -import { PRODUCT_DETAILS } from "../../elements/catalog/products/product-details"; +import { + PRODUCT_DETAILS, +} from "../../elements/catalog/products/product-details"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { demoProductsNames } from "../../fixtures/products"; import { productDetailsUrl } from "../../fixtures/urlList"; import { getFirstProducts } from "../../support/api/requests/Product"; -import { deleteCollectionsStartsWith } from "../../support/api/utils/catalog/collectionsUtils"; +import { + deleteCollectionsStartsWith, +} from "../../support/api/utils/catalog/collectionsUtils"; import { createNewProductWithNewDataAndDefaultChannel, deleteProductsStartsWith, @@ -14,7 +18,7 @@ import { describe("Tests for images", () => { beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/products/manageProducts/availableForPurchaseProducts.js b/cypress/e2e/products/manageProducts/availableForPurchaseProducts.js index 91233341f..7eb133aa9 100644 --- a/cypress/e2e/products/manageProducts/availableForPurchaseProducts.js +++ b/cypress/e2e/products/manageProducts/availableForPurchaseProducts.js @@ -5,12 +5,19 @@ import faker from "faker"; import { productDetailsUrl } from "../../../fixtures/urlList"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; -import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails"; +import { + getProductDetails, +} from "../../../support/api/requests/storeFront/ProductDetails"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; import * as shippingUtils from "../../../support/api/utils/shippingUtils"; -import { isProductAvailableForPurchase } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; -import { updateProductIsAvailableForPurchase } from "../../../support/pages/catalog/products/productDetailsPage"; +import { + isProductAvailableForPurchase, +} from "../../../support/api/utils/storeFront/storeFrontProductUtils"; +import { + updateProductIsAvailableForPurchase, +} from "../../../support/pages/catalog/products/productDetailsPage"; describe("Products available in listings", () => { const startsWith = "CyAvailForPurchase-"; @@ -22,7 +29,7 @@ describe("Products available in listings", () => { let warehouse; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); shippingUtils.deleteShippingStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith); @@ -65,10 +72,7 @@ describe("Products available in listings", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest( - "auth", - ONE_PERMISSION_USERS.product, - ); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product); }); it( diff --git a/cypress/e2e/products/manageProducts/publishedProducts.js b/cypress/e2e/products/manageProducts/publishedProducts.js index ed1cf14d6..39747a653 100644 --- a/cypress/e2e/products/manageProducts/publishedProducts.js +++ b/cypress/e2e/products/manageProducts/publishedProducts.js @@ -5,11 +5,18 @@ import faker from "faker"; import { productDetailsUrl } from "../../../fixtures/urlList"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; -import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails"; +import { + getProductDetails, +} from "../../../support/api/requests/storeFront/ProductDetails"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; -import { isProductVisible } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; -import { updateProductPublish } from "../../../support/pages/catalog/products/productDetailsPage"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; +import { + isProductVisible, +} from "../../../support/api/utils/storeFront/storeFrontProductUtils"; +import { + updateProductPublish, +} from "../../../support/pages/catalog/products/productDetailsPage"; describe("Published products", () => { const startsWith = "CyPublishedProducts-"; @@ -20,7 +27,7 @@ describe("Published products", () => { let defaultChannel; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); productsUtils .createTypeAttributeAndCategoryForProduct({ name }) .then( @@ -47,10 +54,7 @@ describe("Published products", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest( - "auth", - ONE_PERMISSION_USERS.product, - ); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product); }); it( diff --git a/cypress/e2e/products/manageProducts/visibleInListingsProducts.js b/cypress/e2e/products/manageProducts/visibleInListingsProducts.js index 22e7a8589..005f6cb6d 100644 --- a/cypress/e2e/products/manageProducts/visibleInListingsProducts.js +++ b/cypress/e2e/products/manageProducts/visibleInListingsProducts.js @@ -6,9 +6,14 @@ import { productDetailsUrl } from "../../../fixtures/urlList"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; import { searchInShop } from "../../../support/api/requests/storeFront/Search"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; -import * as productsUtils from "../../../support/api/utils/products/productsUtils"; -import { isProductVisibleInSearchResult } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; -import { updateProductVisibleInListings } from "../../../support/pages/catalog/products/productDetailsPage"; +import * as productsUtils + from "../../../support/api/utils/products/productsUtils"; +import { + isProductVisibleInSearchResult, +} from "../../../support/api/utils/storeFront/storeFrontProductUtils"; +import { + updateProductVisibleInListings, +} from "../../../support/pages/catalog/products/productDetailsPage"; describe("Products displayed in listings", () => { const startsWith = "CyVisibleInListings-"; @@ -19,7 +24,7 @@ describe("Products displayed in listings", () => { let defaultChannel; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); productsUtils .createTypeAttributeAndCategoryForProduct({ name }) .then( @@ -46,10 +51,7 @@ describe("Products displayed in listings", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest( - "auth", - ONE_PERMISSION_USERS.product, - ); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product); }); it( diff --git a/cypress/e2e/products/productsList/columnPicker.js b/cypress/e2e/products/productsList/columnPicker.js index ed912e00e..613da6ee6 100644 --- a/cypress/e2e/products/productsList/columnPicker.js +++ b/cypress/e2e/products/productsList/columnPicker.js @@ -2,15 +2,19 @@ /// import { SHARED_ELEMENTS } from "../../../elements"; -import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"; +import { + PRODUCTS_LIST, +} from "../../../elements/catalog/products/products-list"; import { LOCAL_STORAGE_FOR_COLUMN_PICKER } from "../../../fixtures"; import { urlList } from "../../../fixtures/urlList"; -import { ensureCanvasStatic } from "../../../support/customCommands/sharedElementsOperations/canvas"; +import { + ensureCanvasStatic, +} from "../../../support/customCommands/sharedElementsOperations/canvas"; import { columnPickerPage } from "../../../support/pages"; describe("As an admin I should be able to use column picker", () => { beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/products/productsList/deleteProducts.js b/cypress/e2e/products/productsList/deleteProducts.js index ab96eaf87..a0ab39268 100644 --- a/cypress/e2e/products/productsList/deleteProducts.js +++ b/cypress/e2e/products/productsList/deleteProducts.js @@ -2,11 +2,19 @@ /// import faker from "faker"; -import { BUTTON_SELECTORS, PRODUCTS_LIST } from "../../../elements/"; +import { + BUTTON_SELECTORS, + PRODUCTS_LIST, +} from "../../../elements/"; import { MESSAGES } from "../../../fixtures/"; import { urlList } from "../../../fixtures/urlList"; -import { getDefaultChannel, productsUtils } from "../../../support/api/utils/"; -import { ensureCanvasStatic } from "../../../support/customCommands/sharedElementsOperations/canvas"; +import { + getDefaultChannel, + productsUtils, +} from "../../../support/api/utils/"; +import { + ensureCanvasStatic, +} from "../../../support/customCommands/sharedElementsOperations/canvas"; describe("Test for deleting products", () => { const startsWith = "AABulkDeleteCypress"; @@ -16,7 +24,7 @@ describe("Test for deleting products", () => { let product; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel() .then(channelResp => { channel = channelResp; diff --git a/cypress/e2e/products/productsList/filteringProducts.js b/cypress/e2e/products/productsList/filteringProducts.js index 1398f05f5..2a53fed19 100644 --- a/cypress/e2e/products/productsList/filteringProducts.js +++ b/cypress/e2e/products/productsList/filteringProducts.js @@ -32,7 +32,7 @@ describe("As an admin I should be able to filter products", () => { let collection; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createTypeAttributeAndCategoryForProduct({ name }).then( ({ attribute: attributeResp, @@ -86,7 +86,7 @@ describe("As an admin I should be able to filter products", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest().visit(urlList.products); + cy.loginUserViaRequest().visit(urlList.products); }); const filterProductsBy = [ diff --git a/cypress/e2e/products/productsList/pagination.js b/cypress/e2e/products/productsList/pagination.js index 9d8e8e5d4..7505f67ab 100644 --- a/cypress/e2e/products/productsList/pagination.js +++ b/cypress/e2e/products/productsList/pagination.js @@ -2,13 +2,17 @@ /// import { PAGINATION } from "../../../elements"; -import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"; +import { + PRODUCTS_LIST, +} from "../../../elements/catalog/products/products-list"; import { urlList } from "../../../fixtures/urlList"; -import { ensureCanvasStatic } from "../../../support/customCommands/sharedElementsOperations/canvas"; +import { + ensureCanvasStatic, +} from "../../../support/customCommands/sharedElementsOperations/canvas"; describe("As an admin I should be able to manage products table", () => { beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); cy.visit(urlList.products); }); diff --git a/cypress/e2e/products/productsList/productPresets.js b/cypress/e2e/products/productsList/productPresets.js index cd78d4dbf..85ed2e8a0 100644 --- a/cypress/e2e/products/productsList/productPresets.js +++ b/cypress/e2e/products/productsList/productPresets.js @@ -1,20 +1,10 @@ /// /// -import { - PRODUCTS_LIST, -} from "../../../elements/catalog/products/products-list"; -import { - PRESETS, - SEARCH, -} from "../../../elements/shared"; -import { - LOCAL_STORAGE_KEYS, - urlList, -} from "../../../fixtures/"; -import { - ensureCanvasStatic, -} from "../../../support/customCommands/sharedElementsOperations/canvas"; +import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"; +import { PRESETS, SEARCH } from "../../../elements/shared"; +import { LOCAL_STORAGE_KEYS, urlList } from "../../../fixtures/"; +import { ensureCanvasStatic } from "../../../support/customCommands/sharedElementsOperations/canvas"; import { addPresetWithName, clickDeletePresetButton, @@ -29,7 +19,7 @@ import { describe("As a user I should be able to save selected filters with search queries under the given name", () => { beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/products/productsList/productsView.js b/cypress/e2e/products/productsList/productsView.js index 0eaa17777..b0d44e50c 100644 --- a/cypress/e2e/products/productsList/productsView.js +++ b/cypress/e2e/products/productsList/productsView.js @@ -1,6 +1,8 @@ /// -import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"; +import { + PRODUCTS_LIST, +} from "../../../elements/catalog/products/products-list"; import { urlList } from "../../../fixtures/urlList"; import { changeToDatagridView, @@ -9,12 +11,10 @@ import { describe("As an user I should be able switch between product views", () => { beforeEach(() => { - cy.clearSessionData() - .loginUserViaRequest() - .then(() => { - // set notifiedAboutNavigator to make navigator banner gone from the start - banner was covering needed elements during test - window.localStorage.setItem("notifiedAboutNavigator", "true"); - }); + cy.loginUserViaRequest().then(() => { + // set notifiedAboutNavigator to make navigator banner gone from the start - banner was covering needed elements during test + window.localStorage.setItem("notifiedAboutNavigator", "true"); + }); cy.visit(urlList.products); }); diff --git a/cypress/e2e/products/productsList/sortingProducts.js b/cypress/e2e/products/productsList/sortingProducts.js index e8b582d25..6adbd2f84 100644 --- a/cypress/e2e/products/productsList/sortingProducts.js +++ b/cypress/e2e/products/productsList/sortingProducts.js @@ -1,7 +1,9 @@ /// /// -import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"; +import { + PRODUCTS_LIST, +} from "../../../elements/catalog/products/products-list"; import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements"; import { urlList } from "../../../fixtures/urlList"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; @@ -16,15 +18,14 @@ describe.skip("As an admin I should be able to sort products", () => { let defaultChannel; beforeEach(() => { - cy.clearSessionData() - .loginUserViaRequest() + cy.loginUserViaRequest() .visit(urlList.products) .get(SHARED_ELEMENTS.header) .should("be.visible"); }); before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel().then(channel => { defaultChannel = channel; cy.checkIfDataAreNotNull({ defaultChannel }); diff --git a/cypress/e2e/products/productsVariants.js b/cypress/e2e/products/productsVariants.js index 2d2c7ad95..9e25abe21 100644 --- a/cypress/e2e/products/productsVariants.js +++ b/cypress/e2e/products/productsVariants.js @@ -3,7 +3,9 @@ import faker from "faker"; -import { PRODUCT_DETAILS } from "../../elements/catalog/products/product-details"; +import { + PRODUCT_DETAILS, +} from "../../elements/catalog/products/product-details"; import { urlList } from "../../fixtures/urlList"; import { ONE_PERMISSION_USERS } from "../../fixtures/users"; import { createChannel } from "../../support/api/requests/Channels"; @@ -12,7 +14,9 @@ import { updateChannelInProduct, } from "../../support/api/requests/Product"; import * as productUtils from "../../support/api/utils/products/productsUtils"; -import { getProductVariants } from "../../support/api/utils/storeFront/storeFrontProductUtils"; +import { + getProductVariants, +} from "../../support/api/utils/storeFront/storeFrontProductUtils"; import { addVariantToDataGrid, enterVariantEditPage, @@ -36,7 +40,7 @@ describe("As an admin I should be able to create variant", () => { before(() => { const name = `${startsWith}${faker.datatype.number()}`; - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); productUtils .createShippingProductTypeAttributeAndCategory(name, attributeValues) @@ -63,10 +67,7 @@ describe("As an admin I should be able to create variant", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest( - "auth", - ONE_PERMISSION_USERS.product, - ); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product); }); it( diff --git a/cypress/e2e/products/productsWithoutSku/createProductWithoutSku.js b/cypress/e2e/products/productsWithoutSku/createProductWithoutSku.js index bae78bb23..77b0b67ca 100644 --- a/cypress/e2e/products/productsWithoutSku/createProductWithoutSku.js +++ b/cypress/e2e/products/productsWithoutSku/createProductWithoutSku.js @@ -8,7 +8,10 @@ import { PRODUCT_DETAILS, PRODUCTS_LIST, } from "../../../elements/"; -import { ONE_PERMISSION_USERS, urlList } from "../../../fixtures/"; +import { + ONE_PERMISSION_USERS, + urlList, +} from "../../../fixtures/"; import { productsRequests, productsTypeRequests, @@ -41,7 +44,7 @@ describe("Creating variants", () => { let address; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); const name = `${startsWith}${faker.datatype.number()}`; const simpleProductTypeName = `${startsWith}${faker.datatype.number()}`; @@ -97,10 +100,7 @@ describe("Creating variants", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest( - "auth", - ONE_PERMISSION_USERS.product, - ); + cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product); }); it( diff --git a/cypress/e2e/products/productsWithoutSku/updatingProductsWithoutSku.js b/cypress/e2e/products/productsWithoutSku/updatingProductsWithoutSku.js index ef9ad208b..31e940580 100644 --- a/cypress/e2e/products/productsWithoutSku/updatingProductsWithoutSku.js +++ b/cypress/e2e/products/productsWithoutSku/updatingProductsWithoutSku.js @@ -3,7 +3,9 @@ import faker from "faker"; -import { VARIANTS_SELECTORS } from "../../../elements/catalog/products/variants-selectors"; +import { + VARIANTS_SELECTORS, +} from "../../../elements/catalog/products/variants-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements"; import { productVariantDetailUrl } from "../../../fixtures/urlList"; @@ -14,10 +16,15 @@ import { updateChannelPriceInVariant, } from "../../../support/api/requests/Product"; import { createTypeProduct } from "../../../support/api/requests/ProductType"; -import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils"; -import * as productUtils from "../../../support/api/utils/products/productsUtils"; +import { + createWaitingForCaptureOrder, +} from "../../../support/api/utils/ordersUtils"; +import * as productUtils + from "../../../support/api/utils/products/productsUtils"; import * as shippingUtils from "../../../support/api/utils/shippingUtils"; -import { deleteWarehouseStartsWith } from "../../../support/api/utils/warehouseUtils"; +import { + deleteWarehouseStartsWith, +} from "../../../support/api/utils/warehouseUtils"; describe("Updating products without sku", () => { const startsWith = "UpdateProductsSku"; @@ -38,7 +45,7 @@ describe("Updating products without sku", () => { const attributeValues = ["value1", "value2"]; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); productUtils.deleteProductsStartsWith(startsWith); shippingUtils.deleteShippingStartsWith(startsWith); deleteWarehouseStartsWith(startsWith); @@ -90,7 +97,7 @@ describe("Updating products without sku", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( "should be able to add SKU to simple product TC: SALEOR_2802", diff --git a/cypress/e2e/products/updatingProducts.js b/cypress/e2e/products/updatingProducts.js index be8f964c4..19f9434f8 100644 --- a/cypress/e2e/products/updatingProducts.js +++ b/cypress/e2e/products/updatingProducts.js @@ -3,21 +3,29 @@ import faker from "faker"; -import { PRODUCT_DETAILS } from "../../elements/catalog/products/product-details"; +import { + PRODUCT_DETAILS, +} from "../../elements/catalog/products/product-details"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { productDetailsUrl } from "../../fixtures/urlList"; import { ONE_PERMISSION_USERS } from "../../fixtures/users"; import { createCategory } from "../../support/api/requests/Category"; import { createCollection } from "../../support/api/requests/Collections"; -import { getProductDetails } from "../../support/api/requests/storeFront/ProductDetails"; +import { + getProductDetails, +} from "../../support/api/requests/storeFront/ProductDetails"; import { getDefaultChannel } from "../../support/api/utils/channelsUtils"; -import { expectCorrectProductInformation } from "../../support/api/utils/products/checkProductInfo"; +import { + expectCorrectProductInformation, +} from "../../support/api/utils/products/checkProductInfo"; import { createProductInChannel, createTypeAttributeAndCategoryForProduct, } from "../../support/api/utils/products/productsUtils"; import { metadataForms } from "../../support/pages/catalog/metadataComponent"; -import { fillUpCommonFieldsForAllProductTypes } from "../../support/pages/catalog/products/productDetailsPage"; +import { + fillUpCommonFieldsForAllProductTypes, +} from "../../support/pages/catalog/products/productDetailsPage"; describe("Update products", () => { const startsWith = "CyUpdateProducts-"; @@ -30,7 +38,7 @@ describe("Update products", () => { let attribute; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); getDefaultChannel() .then(channel => { defaultChannel = channel; diff --git a/cypress/e2e/staffMembers.js b/cypress/e2e/staffMembers.js index ff0383d9b..20b77a8ca 100644 --- a/cypress/e2e/staffMembers.js +++ b/cypress/e2e/staffMembers.js @@ -12,7 +12,11 @@ import { STAFF_MEMBERS_LIST_SELECTORS, } from "../elements/"; import { LOGIN_SELECTORS } from "../elements/account/login-selectors"; -import { MESSAGES, TEST_ADMIN_USER, urlList } from "../fixtures"; +import { + MESSAGES, + TEST_ADMIN_USER, + urlList, +} from "../fixtures"; import { userDetailsUrl } from "../fixtures/urlList"; import { activatePlugin, @@ -42,7 +46,7 @@ describe("Staff members", () => { let user; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); activatePlugin({ id: "mirumee.notifications.admin_email" }); inviteStaffMemberWithFirstPermission({ email }) .then(({ user: userResp }) => { @@ -58,7 +62,7 @@ describe("Staff members", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/e2e/translations.js b/cypress/e2e/translations.js index 540d38d13..418ca99f9 100644 --- a/cypress/e2e/translations.js +++ b/cypress/e2e/translations.js @@ -18,7 +18,7 @@ describe("As an admin I want to manage translations", () => { let category; before(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); createCategory({ name: startsWith, slug }).then(categoryResp => { category = categoryResp; cy.checkIfDataAreNotNull({ category }); @@ -26,7 +26,7 @@ describe("As an admin I want to manage translations", () => { }); beforeEach(() => { - cy.clearSessionData().loginUserViaRequest(); + cy.loginUserViaRequest(); }); it( diff --git a/cypress/support/customCommands/user/index.js b/cypress/support/customCommands/user/index.js index a31f24b68..0e62fd78c 100644 --- a/cypress/support/customCommands/user/index.js +++ b/cypress/support/customCommands/user/index.js @@ -47,6 +47,7 @@ Cypress.Commands.add( "_saleorRefreshToken", resp.body.data.tokenCreate.refreshToken, ); + window.localStorage.setItem("notifiedAboutNavigator", "true"); window.sessionStorage.setItem( authorization, resp.body.data.tokenCreate.token, diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index d4c4414ce..d2f32b9bc 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -24,7 +24,9 @@ import { SHARED_ELEMENTS, } from "../elements"; import { urlList } from "../fixtures/urlList"; -import { ensureCanvasStatic } from "../support/customCommands/sharedElementsOperations/canvas"; +import { + ensureCanvasStatic, +} from "../support/customCommands/sharedElementsOperations/canvas"; import cypressGrep from "../support/cypress-grep/support"; commandTimings();