tests - removing redundant session cleanup, navigator confirmation added (#4023)

* set notifiedAboutNavigator: true in local storage when logging in
This commit is contained in:
wojteknowacki 2023-07-28 09:48:41 +02:00 committed by GitHub
parent 922c9fb4ce
commit 1bd4aeadf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 546 additions and 348 deletions

View file

@ -7,9 +7,16 @@ import { APP_DETAILS } from "../elements/apps/appDetails";
import { APPS_LIST_SELECTORS } from "../elements/apps/appsList"; import { APPS_LIST_SELECTORS } from "../elements/apps/appsList";
import { WEBHOOK_DETAILS } from "../elements/apps/webhookDetails"; import { WEBHOOK_DETAILS } from "../elements/apps/webhookDetails";
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors"; 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 { 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 { import {
addShippingMethod, addShippingMethod,
createCheckout, createCheckout,
@ -18,7 +25,9 @@ import {
import { createVoucher } from "../support/api/requests/Discounts/Vouchers"; import { createVoucher } from "../support/api/requests/Discounts/Vouchers";
import { createGiftCard } from "../support/api/requests/GiftCard"; import { createGiftCard } from "../support/api/requests/GiftCard";
import { getDefaultChannel } from "../support/api/utils/channelsUtils"; import { getDefaultChannel } from "../support/api/utils/channelsUtils";
import { getShippingMethodIdFromCheckout } from "../support/api/utils/ordersUtils"; import {
getShippingMethodIdFromCheckout,
} from "../support/api/utils/ordersUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
@ -41,7 +50,7 @@ describe("As a staff user I want to manage apps", () => {
const email = `example@example.com`; const email = `example@example.com`;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createApp(name, "MANAGE_APPS").then(app => { createApp(name, "MANAGE_APPS").then(app => {
createdApp = app; createdApp = app;
@ -93,7 +102,7 @@ describe("As a staff user I want to manage apps", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest("auth", ONE_PERMISSION_USERS.app); cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.app);
}); });
it( it(

View file

@ -3,18 +3,27 @@
import faker from "faker"; import faker from "faker";
import { CATEGORIES_LIST_SELECTORS } from "../../elements/catalog/categories/categories-list"; import {
import { CATEGORY_DETAILS_SELECTORS } from "../../elements/catalog/categories/category-details"; 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 { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { categoryDetailsUrl, urlList } from "../../fixtures/urlList"; import {
categoryDetailsUrl,
urlList,
} from "../../fixtures/urlList";
import { import {
createCategory as createCategoryRequest, createCategory as createCategoryRequest,
getCategory, getCategory,
} from "../../support/api/requests/Category"; } from "../../support/api/requests/Category";
import * as channelsUtils from "../../support/api/utils/channelsUtils"; 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 { ensureCanvasStatic } from "../../support/customCommands/sharedElementsOperations/canvas"; import {
ensureCanvasStatic,
} from "../../support/customCommands/sharedElementsOperations/canvas";
import { import {
createCategory, createCategory,
updateCategory, updateCategory,
@ -32,7 +41,7 @@ describe("As an admin I want to manage categories", () => {
let defaultChannel; let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
channelsUtils channelsUtils
.getDefaultChannel() .getDefaultChannel()
@ -71,7 +80,7 @@ describe("As an admin I want to manage categories", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -4,7 +4,10 @@
import faker from "faker"; import faker from "faker";
import { BUTTON_SELECTORS } from "../../elements"; 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 { createChannel } from "../../support/api/requests/Channels";
import { import {
addChannelToCollection, addChannelToCollection,
@ -12,8 +15,12 @@ import {
createCollection as createCollectionRequest, createCollection as createCollectionRequest,
} from "../../support/api/requests/Collections"; } from "../../support/api/requests/Collections";
import { updateChannelInProduct } from "../../support/api/requests/Product"; import { updateChannelInProduct } from "../../support/api/requests/Product";
import { getCollection } from "../../support/api/requests/storeFront/Collections"; import {
import { getProductDetails } from "../../support/api/requests/storeFront/ProductDetails"; getCollection,
} from "../../support/api/requests/storeFront/Collections";
import {
getProductDetails,
} from "../../support/api/requests/storeFront/ProductDetails";
import { searchInShop } from "../../support/api/requests/storeFront/Search"; import { searchInShop } from "../../support/api/requests/storeFront/Search";
import * as channelsUtils from "../../support/api/utils/channelsUtils"; 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";
@ -35,7 +42,7 @@ describe("As an admin I want to manage collections.", () => {
let defaultChannel; let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
channelsUtils channelsUtils
.getDefaultChannel() .getDefaultChannel()
@ -76,7 +83,7 @@ describe("As an admin I want to manage collections.", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -1,7 +1,9 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
import faker from "faker"; 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 { urlList } from "../../../fixtures/urlList";
import { completeCheckout } from "../../../support/api/requests/Checkout"; import { completeCheckout } from "../../../support/api/requests/Checkout";
import { import {
@ -17,8 +19,11 @@ import {
addPayment, addPayment,
purchaseProductWithPromoCode, purchaseProductWithPromoCode,
} from "../../../support/api/utils/ordersUtils"; } from "../../../support/api/utils/ordersUtils";
import * as productsUtils from "../../../support/api/utils/products/productsUtils"; import * as productsUtils
import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils"; from "../../../support/api/utils/products/productsUtils";
import {
updateTaxConfigurationForChannel,
} from "../../../support/api/utils/taxesUtils";
import { giftCardsPage } from "../../../support/pages"; import { giftCardsPage } from "../../../support/pages";
describe("As a admin I want to use enabled gift card in checkout", () => { 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(() => { before(() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
productsUtils productsUtils
.createProductWithShipping({ name, shippingPrice, productPrice }) .createProductWithShipping({ name, shippingPrice, productPrice })
@ -59,7 +64,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
updateTaxConfigurationForChannel({ updateTaxConfigurationForChannel({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
pricesEnteredWithTax: true, pricesEnteredWithTax: true,

View file

@ -20,11 +20,11 @@ describe("As an admin I want to create gift card", () => {
const currency = "USD"; const currency = "USD";
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -10,19 +10,21 @@ import {
activatePlugin, activatePlugin,
updatePlugin, updatePlugin,
} from "../../../support/api/requests/Plugins"; } from "../../../support/api/requests/Plugins";
import { getMailWithGiftCardExportWithAttachment } from "../../../support/api/utils/users"; import {
getMailWithGiftCardExportWithAttachment,
} from "../../../support/api/utils/users";
import { giftCardsPage } from "../../../support/pages"; import { giftCardsPage } from "../../../support/pages";
describe("As an admin I want to export gift card", () => { describe("As an admin I want to export gift card", () => {
const startsWith = "updateGCard"; const startsWith = "updateGCard";
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
activatePlugin({ id: "mirumee.notifications.admin_email" }); activatePlugin({ id: "mirumee.notifications.admin_email" });
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -2,8 +2,11 @@
import faker from "faker"; import faker from "faker";
import * as channelsUtils from "../../../support/api/utils/channelsUtils"; import * as channelsUtils from "../../../support/api/utils/channelsUtils";
import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils"; import {
import * as productsUtils from "../../../support/api/utils/products/productsUtils"; createWaitingForCaptureOrder,
} from "../../../support/api/utils/ordersUtils";
import * as productsUtils
from "../../../support/api/utils/products/productsUtils";
import { createShipping } from "../../../support/api/utils/shippingUtils"; import { createShipping } from "../../../support/api/utils/shippingUtils";
describe("As a customer I should be able to purchase gift card as a product", () => { 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(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
const name = `${startsWith}${faker.datatype.number()}`; 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(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -3,10 +3,15 @@
import faker from "faker"; 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 { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { MESSAGES } from "../../../fixtures"; import { MESSAGES } from "../../../fixtures";
import { giftCardDetailsUrl, urlList } from "../../../fixtures/urlList"; import {
giftCardDetailsUrl,
urlList,
} from "../../../fixtures/urlList";
import { import {
createGiftCard, createGiftCard,
getGiftCardWithId, getGiftCardWithId,
@ -16,13 +21,8 @@ import { giftCardsPage } from "../../../support/pages";
describe("As an admin I want to update gift card", () => { describe("As an admin I want to update gift card", () => {
const startsWith = "updateGCard"; const startsWith = "updateGCard";
before(() => {
cy.clearSessionData().loginUserViaRequest();
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -3,7 +3,9 @@
import faker from "faker"; import faker from "faker";
import { WAREHOUSES_DETAILS } from "../../elements/warehouses/warehouse-details"; import {
WAREHOUSES_DETAILS,
} from "../../elements/warehouses/warehouse-details";
import { import {
completeCheckout, completeCheckout,
createCheckout, createCheckout,
@ -39,7 +41,7 @@ describe("Warehouses in checkout", () => {
const warehouseSlug = `${faker.lorem.slug()}slug`; const warehouseSlug = `${faker.lorem.slug()}slug`;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
cy.fixture("addresses") cy.fixture("addresses")
.then(addresses => { .then(addresses => {
usAddress = addresses.usAddress; usAddress = addresses.usAddress;
@ -101,7 +103,7 @@ describe("Warehouses in checkout", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -28,7 +28,7 @@ describe("Products without shipment option", () => {
let productWithoutShipping; let productWithoutShipping;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createChannel({ createChannel({
name, name,

View file

@ -17,7 +17,9 @@ import {
getShippingMethodIdFromCheckout, getShippingMethodIdFromCheckout,
updateShippingInCheckout, updateShippingInCheckout,
} from "../../support/api/utils/ordersUtils"; } 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", () => { describe("As an unlogged customer I want to order physical and digital products", () => {
const startsWith = `CyPurchaseByType`; const startsWith = `CyPurchaseByType`;
@ -33,7 +35,7 @@ describe("As an unlogged customer I want to order physical and digital products"
let physicalVariants; let physicalVariants;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({ createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
physicalProductName: physicalName, physicalProductName: physicalName,
digitalProductName: digitalName, digitalProductName: digitalName,
@ -54,7 +56,7 @@ describe("As an unlogged customer I want to order physical and digital products"
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -8,8 +8,12 @@ import {
createCheckout, createCheckout,
} from "../../support/api/requests/Checkout"; } from "../../support/api/requests/Checkout";
import { getVariants } from "../../support/api/requests/Product"; import { getVariants } from "../../support/api/requests/Product";
import { createWaitingForCaptureOrder } from "../../support/api/utils/ordersUtils"; import {
import { createNewProductWithSeveralVariants } from "../../support/api/utils/products/productsUtils"; createWaitingForCaptureOrder,
} from "../../support/api/utils/ordersUtils";
import {
createNewProductWithSeveralVariants,
} from "../../support/api/utils/products/productsUtils";
describe("Manage products stocks in checkout", () => { describe("Manage products stocks in checkout", () => {
const startsWith = "CyStocksCheckout-"; const startsWith = "CyStocksCheckout-";
@ -23,7 +27,7 @@ describe("Manage products stocks in checkout", () => {
let lastVariantInStock; let lastVariantInStock;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
const variantsData = [ const variantsData = [
{ {

View file

@ -21,7 +21,7 @@ describe("Warehouses in checkout", () => {
"should not be possible to buy product for country not listed in warehouse", "should not be possible to buy product for country not listed in warehouse",
{ tags: ["@checkout", "@allEnv", "@stable", "@oldRelease"] }, { tags: ["@checkout", "@allEnv", "@stable", "@oldRelease"] },
() => { () => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.fixture("addresses") cy.fixture("addresses")
.then(addresses => { .then(addresses => {

View file

@ -7,9 +7,15 @@ import { addVariantUrl } from "../../../fixtures/urlList";
import { createCategory } from "../../../support/api/requests/Category"; import { createCategory } from "../../../support/api/requests/Category";
import { getVariant } from "../../../support/api/requests/Product"; import { getVariant } from "../../../support/api/requests/Product";
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
import { createProductInChannelWithoutVariants } from "../../../support/api/utils/products/productsUtils"; import {
import { createProductTypeWithNewVariantSelectionAttribute } from "../../../support/api/utils/productTypeUtils"; createProductInChannelWithoutVariants,
import { fillUpVariantDetails } from "../../../support/pages/catalog/products/VariantsPage"; } 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", () => { describe("As an admin I want to use attributes in variant selection", () => {
const startsWith = "VarSel" + Date.now(); const startsWith = "VarSel" + Date.now();
@ -24,7 +30,7 @@ describe("As an admin I want to use attributes in variant selection", () => {
let category; let category;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel().then(defaultChannel => (channel = defaultChannel)); getDefaultChannel().then(defaultChannel => (channel = defaultChannel));
createCategory({ name: startsWith }).then(categoryResp => { createCategory({ name: startsWith }).then(categoryResp => {
category = categoryResp; category = categoryResp;
@ -33,7 +39,7 @@ describe("As an admin I want to use attributes in variant selection", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
attributesTypes.forEach(attributeType => { attributesTypes.forEach(attributeType => {

View file

@ -3,12 +3,18 @@
import faker from "faker"; 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 { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import { getAttribute } from "../../../support/api/requests/Attribute"; import { getAttribute } from "../../../support/api/requests/Attribute";
import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData"; import {
import { createAttributeWithInputType } from "../../../support/pages/attributesPage"; expectCorrectDataInAttribute,
} from "../../../support/api/utils/attributes/checkAttributeData";
import {
createAttributeWithInputType,
} from "../../../support/pages/attributesPage";
describe("As an admin I want to create content attribute", () => { describe("As an admin I want to create content attribute", () => {
const startsWith = "AttrCont" + Date.now(); 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" }, { unitSystem: "without selecting unit", testCase: "SALEOR_0521" },
]; ];
before(() => {
cy.clearSessionData().loginUserViaRequest();
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.loginUserViaRequest()
.loginUserViaRequest()
.visit(urlList.attributes) .visit(urlList.attributes)
.get(ATTRIBUTES_LIST.createAttributeButton) .get(ATTRIBUTES_LIST.createAttributeButton)
.click() .click()

View file

@ -3,15 +3,22 @@
import faker from "faker"; 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 { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { attributeDetailsUrl, urlList } from "../../../fixtures/urlList"; import {
attributeDetailsUrl,
urlList,
} from "../../../fixtures/urlList";
import { import {
createAttribute, createAttribute,
getAttribute, getAttribute,
} from "../../../support/api/requests/Attribute"; } from "../../../support/api/requests/Attribute";
import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData"; import {
expectCorrectDataInAttribute,
} from "../../../support/api/utils/attributes/checkAttributeData";
import { import {
createAttributeWithInputType, createAttributeWithInputType,
fillUpAttributeNameAndCode, fillUpAttributeNameAndCode,
@ -48,13 +55,8 @@ describe("As an admin I want to create product attribute", () => {
{ unitSystem: "without selecting unit", testCase: "SALEOR_0510" }, { unitSystem: "without selecting unit", testCase: "SALEOR_0510" },
]; ];
before(() => {
cy.clearSessionData().loginUserViaRequest();
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.loginUserViaRequest()
.loginUserViaRequest()
.visit(urlList.attributes) .visit(urlList.attributes)
.get(ATTRIBUTES_LIST.createAttributeButton) .get(ATTRIBUTES_LIST.createAttributeButton)
.click(); .click();

View file

@ -9,18 +9,16 @@ import {
createAttribute, createAttribute,
getAttribute, getAttribute,
} from "../../../support/api/requests/Attribute"; } 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", () => { describe("As an admin I want to delete and update content attribute", () => {
const startsWith = "AttrContDel" + Date.now(); const startsWith = "AttrContDel" + Date.now();
let attribute; let attribute;
before(() => {
cy.clearSessionData().loginUserViaRequest();
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createAttribute({ createAttribute({
name: `${startsWith}${faker.datatype.number()}`, name: `${startsWith}${faker.datatype.number()}`,
type: "PAGE_TYPE", type: "PAGE_TYPE",

View file

@ -7,8 +7,12 @@ import {
} from "../../../elements/shared/sharedElements"; } from "../../../elements/shared/sharedElements";
import { updateAttribute } from "../../../support/api/requests/Attribute"; import { updateAttribute } from "../../../support/api/requests/Attribute";
import { createProduct } from "../../../support/api/requests/Product"; import { createProduct } from "../../../support/api/requests/Product";
import { createTypeAttributeAndCategoryForProduct } from "../../../support/api/utils/products/productsUtils"; import {
import { enterAttributeAndChanegeIsFilterableInDashbord } from "../../../support/pages/attributesPage"; createTypeAttributeAndCategoryForProduct,
} from "../../../support/api/utils/products/productsUtils";
import {
enterAttributeAndChanegeIsFilterableInDashbord,
} from "../../../support/pages/attributesPage";
import { import {
enterProductListPage, enterProductListPage,
selectAttributeFilter, selectAttributeFilter,
@ -21,7 +25,7 @@ xdescribe("Tests for using attributes in filters", () => {
let attribute; let attribute;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createTypeAttributeAndCategoryForProduct({ createTypeAttributeAndCategoryForProduct({
name: startsWith, name: startsWith,
attributeValues: [startsWith], attributeValues: [startsWith],
@ -38,7 +42,7 @@ xdescribe("Tests for using attributes in filters", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -2,14 +2,25 @@
/// <reference types="../../../support"/> /// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { ADD_CHANNEL_FORM_SELECTORS } from "../../../elements/channels/add-channel-form-selectors"; import {
import { AVAILABLE_CHANNELS_FORM } from "../../../elements/channels/available-channels-form"; ADD_CHANNEL_FORM_SELECTORS,
import { CHANNELS_SELECTORS } from "../../../elements/channels/channels-selectors"; } from "../../../elements/channels/add-channel-form-selectors";
import { SELECT_CHANNELS_TO_ASSIGN } from "../../../elements/channels/select-channels-to-assign"; 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 { HEADER_SELECTORS } from "../../../elements/header/header-selectors";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { MESSAGES } from "../../../fixtures/"; import { MESSAGES } from "../../../fixtures/";
import { productDetailsUrl, urlList } from "../../../fixtures/urlList"; import {
productDetailsUrl,
urlList,
} from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { createChannel } from "../../../support/api/requests/Channels"; import { createChannel } from "../../../support/api/requests/Channels";
import { getFirstProducts } from "../../../support/api/requests/Product"; import { getFirstProducts } from "../../../support/api/requests/Product";
@ -17,7 +28,9 @@ import {
createShippingZoneWithoutWarehouse, createShippingZoneWithoutWarehouse,
getShippingZone, getShippingZone,
} from "../../../support/api/requests/ShippingMethod"; } from "../../../support/api/requests/ShippingMethod";
import { createWarehouse as createWarehouseViaApi } from "../../../support/api/requests/Warehouse"; import {
createWarehouse as createWarehouseViaApi,
} from "../../../support/api/requests/Warehouse";
import { import {
createChannelByView, createChannelByView,
setChannelRequiredFields, setChannelRequiredFields,
@ -32,7 +45,7 @@ describe("Channels", () => {
let usAddress; let usAddress;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createShippingZoneWithoutWarehouse(randomName, "US").then( createShippingZoneWithoutWarehouse(randomName, "US").then(
shippingZoneResp => { shippingZoneResp => {
shippingZone = shippingZoneResp; shippingZone = shippingZoneResp;
@ -52,10 +65,7 @@ describe("Channels", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.channel);
"auth",
ONE_PERMISSION_USERS.channel,
);
}); });
it( it(

View file

@ -3,8 +3,12 @@
import faker from "faker"; import faker from "faker";
import { CHANNEL_FORM_SELECTORS } from "../../../elements/channels/channel-form-selectors"; import {
import { DRAFT_ORDER_SELECTORS } from "../../../elements/orders/draft-order-selectors"; 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 { ORDERS_SELECTORS } from "../../../elements/orders/orders-selectors";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import { import {
@ -12,13 +16,17 @@ import {
createChannel, createChannel,
} from "../../../support/api/requests/Channels"; } from "../../../support/api/requests/Channels";
import { createCheckout } from "../../../support/api/requests/Checkout"; 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 { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
} from "../../../support/api/utils/products/productsUtils"; } 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", () => { describe("Tests on inactive channel", () => {
const channelStartsWith = `InactiveChannel`; const channelStartsWith = `InactiveChannel`;
@ -30,7 +38,7 @@ describe("Tests on inactive channel", () => {
let newChannel; let newChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
cy.fixture("addresses").then(({ plAddress }) => { cy.fixture("addresses").then(({ plAddress }) => {
address = plAddress; address = plAddress;
}); });
@ -47,7 +55,7 @@ describe("Tests on inactive channel", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -3,11 +3,18 @@
import faker from "faker"; import faker from "faker";
import { CUSTOMER_DETAILS_SELECTORS } from "../../elements/customer/customer-details"; import {
import { CUSTOMERS_LIST_SELECTORS } from "../../elements/customer/customers-list"; 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 { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { customerDetailsUrl, urlList } from "../../fixtures/urlList"; import {
customerDetailsUrl,
urlList,
} from "../../fixtures/urlList";
import { import {
addressCreate, addressCreate,
createCustomer, createCustomer,
@ -20,7 +27,7 @@ describe("Tests for customer", () => {
let secondAddress; let secondAddress;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
cy.fixture("addresses").then(({ usAddress, secondUsAddress }) => { cy.fixture("addresses").then(({ usAddress, secondUsAddress }) => {
address = usAddress; address = usAddress;
secondAddress = secondUsAddress; secondAddress = secondUsAddress;
@ -29,7 +36,7 @@ describe("Tests for customer", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -21,7 +21,7 @@ describe("Tests for menu navigation", () => {
let menu; let menu;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createMenuViaApi(randomName).then(({ menu: menuResp }) => { createMenuViaApi(randomName).then(({ menu: menuResp }) => {
menu = menuResp; menu = menuResp;
cy.checkIfDataAreNotNull(menu); cy.checkIfDataAreNotNull(menu);
@ -29,7 +29,7 @@ describe("Tests for menu navigation", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -3,8 +3,12 @@
import faker from "faker"; import faker from "faker";
import { PERMISSION_GROUP_DETAILS_SELECTORS } from "../../elements/permissionGroup/permissionGroupDetails"; import {
import { PERMISSION_GROUP_LIST_SELECTORS } from "../../elements/permissionGroup/permissionGroupsList"; 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 { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { import {
@ -17,18 +21,16 @@ import {
createPermissionGroup, createPermissionGroup,
getPermissionGroup, getPermissionGroup,
} from "../../support/api/requests/PermissionGroup.js"; } from "../../support/api/requests/PermissionGroup.js";
import { getStaffMembersStartsWith } from "../../support/api/requests/StaffMembers"; import {
getStaffMembersStartsWith,
} from "../../support/api/requests/StaffMembers";
describe("Permissions groups", () => { describe("Permissions groups", () => {
const startsWith = "CyPermissions-" + Date.now(); const startsWith = "CyPermissions-" + Date.now();
const permissionManageProducts = "[MANAGE_PRODUCTS]"; const permissionManageProducts = "[MANAGE_PRODUCTS]";
before(() => {
cy.clearSessionData().loginUserViaRequest();
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -36,7 +36,7 @@ describe("Adyen payments", () => {
let cardData; let cardData;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
cy.fixture("cards").then(cardsResp => { cy.fixture("cards").then(cardsResp => {
paymentCards = cardsResp.adyen; paymentCards = cardsResp.adyen;
cardData = { cardData = {
@ -101,7 +101,7 @@ describe("Adyen payments", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createCheckout({ createCheckout({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
email, email,

View file

@ -3,7 +3,9 @@
import faker from "faker"; 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 { PLUGINS_LIST_SELECTORS } from "../../../elements/plugins/pluginsList";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
@ -25,7 +27,7 @@ describe("As an admin I want to manage plugins", () => {
let defaultChannel; let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel().then(channel => { getDefaultChannel().then(channel => {
defaultChannel = channel; defaultChannel = channel;
activatePlugin({ id: "mirumee.notifications.admin_email" }); activatePlugin({ id: "mirumee.notifications.admin_email" });
@ -37,10 +39,7 @@ describe("As an admin I want to manage plugins", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.loginUserViaRequest().visit(urlList.plugins).expectSkeletonIsVisible();
.loginUserViaRequest()
.visit(urlList.plugins)
.expectSkeletonIsVisible();
}); });
it( it(

View file

@ -13,7 +13,9 @@ import {
addStripePaymentAndGetConfirmationData, addStripePaymentAndGetConfirmationData,
getShippingMethodIdFromCheckout, getShippingMethodIdFromCheckout,
} from "../../../support/api/utils/ordersUtils"; } from "../../../support/api/utils/ordersUtils";
import { createProductWithShipping } from "../../../support/api/utils/products/productsUtils"; import {
createProductWithShipping,
} from "../../../support/api/utils/products/productsUtils";
describe("Stripe payments", () => { describe("Stripe payments", () => {
const startsWith = "Stripe-" + faker.datatype.number(); const startsWith = "Stripe-" + faker.datatype.number();
@ -28,7 +30,7 @@ describe("Stripe payments", () => {
let cardData; let cardData;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
cy.fixture("cards").then(({ stripe }) => { cy.fixture("cards").then(({ stripe }) => {
paymentCards = stripe; paymentCards = stripe;
cardData = { cardData = {
@ -56,7 +58,7 @@ describe("Stripe payments", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createCheckout({ createCheckout({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
email, email,

View file

@ -3,7 +3,9 @@
import faker from "faker"; 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 { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { productTypeDetailsUrl } from "../../../fixtures/urlList"; import { productTypeDetailsUrl } from "../../../fixtures/urlList";
import { createAttribute } from "../../../support/api/requests/Attribute"; 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; let attribute;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createAttribute({ name: startsWith }).then(resp => (attribute = resp)); createAttribute({ name: startsWith }).then(resp => (attribute = resp));
cy.checkIfDataAreNotNull(attribute); cy.checkIfDataAreNotNull(attribute);
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -10,13 +10,8 @@ import { createProductType } from "../../../support/pages/productTypePage";
describe("As an admin I want to create product types", () => { describe("As an admin I want to create product types", () => {
const startsWith = "productType"; const startsWith = "productType";
before(() => {
cy.clearSessionData().loginUserViaRequest();
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.loginUserViaRequest()
.loginUserViaRequest()
.visit(urlList.productTypes) .visit(urlList.productTypes)
.expectSkeletonIsVisible(); .expectSkeletonIsVisible();
}); });

View file

@ -11,9 +11,13 @@ import {
createTypeProduct, createTypeProduct,
getProductType, getProductType,
} from "../../../support/api/requests/ProductType"; } 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 { 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", () => { describe("As an admin I want to manage product types", () => {
const startsWith = "delProdType" + faker.datatype.number(); const startsWith = "delProdType" + faker.datatype.number();
@ -22,7 +26,7 @@ describe("As an admin I want to manage product types", () => {
let attribute; let attribute;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createAttribute({ name: startsWith }).then(resp => (attribute = resp)); createAttribute({ name: startsWith }).then(resp => (attribute = resp));
createCategory({ name: startsWith }).then(resp => (category = resp)); createCategory({ name: startsWith }).then(resp => (category = resp));
getDefaultChannel().then(resp => { getDefaultChannel().then(resp => {
@ -32,7 +36,7 @@ describe("As an admin I want to manage product types", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -4,7 +4,9 @@
import faker from "faker"; import faker from "faker";
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements"; 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 { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { createChannel } from "../../../support/api/requests/Channels"; import { createChannel } from "../../../support/api/requests/Channels";
import { import {
@ -22,10 +24,6 @@ describe("As a staff user I want have different shipping method prices for each
const startsWith = "ChannelShippingMethod"; const startsWith = "ChannelShippingMethod";
let defaultChannel; let defaultChannel;
before(() => {
cy.clearSessionData().loginUserViaRequest();
});
it( it(
"should be able to display different price for each channel. TC: SALEOR_0805", "should be able to display different price for each channel. TC: SALEOR_0805",
{ tags: ["@shipping", "@allEnv", "@stable"] }, { tags: ["@shipping", "@allEnv", "@stable"] },

View file

@ -5,14 +5,21 @@ import faker from "faker";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; 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 { createCheckout } from "../../../support/api/requests/Checkout";
import { createVariant } from "../../../support/api/requests/Product"; import { createVariant } from "../../../support/api/requests/Product";
import { createWarehouse } from "../../../support/api/requests/Warehouse"; import { createWarehouse } from "../../../support/api/requests/Warehouse";
import * as channelsUtils from "../../../support/api/utils/channelsUtils"; import * as channelsUtils from "../../../support/api/utils/channelsUtils";
import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils"; import {
import * as productsUtils from "../../../support/api/utils/products/productsUtils"; createWaitingForCaptureOrder,
import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils"; } from "../../../support/api/utils/ordersUtils";
import * as productsUtils
from "../../../support/api/utils/products/productsUtils";
import {
isShippingAvailableInCheckout,
} from "../../../support/api/utils/storeFront/checkoutUtils";
import { import {
createShippingRate, createShippingRate,
createShippingZone, 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 productTypeSlug = `${faker.lorem.slug()}slug`;
const productSlug = `${faker.lorem.slug()}slug`; const productSlug = `${faker.lorem.slug()}slug`;
const warehouseSlug = `${faker.lorem.slug()}slug`; const warehouseSlug = `${faker.lorem.slug()}slug`;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
channelsUtils channelsUtils
.getDefaultChannel() .getDefaultChannel()
.then(channel => { .then(channel => {
@ -108,7 +115,7 @@ describe("As a staff user I want to create shipping zone and rate", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -4,7 +4,9 @@
import faker from "faker"; import faker from "faker";
import { shippingRateUrl } from "../../../fixtures/urlList"; import { shippingRateUrl } from "../../../fixtures/urlList";
import { updateChannelWarehouses } from "../../../support/api/requests/Channels"; import {
updateChannelWarehouses,
} from "../../../support/api/requests/Channels";
import { import {
addChannelToShippingMethod, addChannelToShippingMethod,
createShippingRate, createShippingRate,
@ -30,7 +32,7 @@ describe("As a user I should be able to update and delete shipping method", () =
let warehouse; let warehouse;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
@ -64,7 +66,7 @@ describe("As a user I should be able to update and delete shipping method", () =
beforeEach(() => { beforeEach(() => {
const rateName = `${startsWith}${faker.datatype.number()}`; const rateName = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createShippingRate({ createShippingRate({
name: rateName, name: rateName,
shippingZone: shippingZone.id, shippingZone: shippingZone.id,

View file

@ -5,14 +5,18 @@ import faker from "faker";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { shippingZoneDetailsUrl } from "../../../fixtures/urlList"; import { shippingZoneDetailsUrl } from "../../../fixtures/urlList";
import { updateChannelWarehouses } from "../../../support/api/requests/Channels"; import {
updateChannelWarehouses,
} from "../../../support/api/requests/Channels";
import { import {
createShippingZone, createShippingZone,
getShippingZone, getShippingZone,
} from "../../../support/api/requests/ShippingMethod"; } from "../../../support/api/requests/ShippingMethod";
import { createWarehouse } from "../../../support/api/requests/Warehouse"; import { createWarehouse } from "../../../support/api/requests/Warehouse";
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; 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"; import { enterAndSelectShippings } from "../../../support/pages/shippingZones";
describe("As a user I should be able to update and delete shipping zone", () => { 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; let warehouse;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
@ -48,7 +52,7 @@ describe("As a user I should be able to update and delete shipping zone", () =>
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createShippingZone(name, "US", defaultChannel.id, warehouse.id).then( createShippingZone(name, "US", defaultChannel.id, warehouse.id).then(
shippingZoneResp => { shippingZoneResp => {
shippingZone = shippingZoneResp; shippingZone = shippingZoneResp;

View file

@ -5,16 +5,22 @@ import faker from "faker";
import { shippingZoneDetailsUrl } from "../../../fixtures/urlList"; import { shippingZoneDetailsUrl } from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; 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 { 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 { createWarehouse } from "../../../support/api/requests/Warehouse";
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
} from "../../../support/api/utils/products/productsUtils"; } from "../../../support/api/utils/products/productsUtils";
import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils"; import {
isShippingAvailableInCheckout,
} from "../../../support/api/utils/storeFront/checkoutUtils";
import { import {
createRateWithPostalCode, createRateWithPostalCode,
postalCodesOptions, postalCodesOptions,
@ -34,7 +40,7 @@ describe("As a user I want to create shipping method with postal codes", () => {
let variantsList; let variantsList;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
@ -90,9 +96,9 @@ describe("As a user I want to create shipping method with postal codes", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping).visit(
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping) shippingZoneDetailsUrl(shippingZone.id),
.visit(shippingZoneDetailsUrl(shippingZone.id)); );
}); });
it( it(

View file

@ -5,16 +5,22 @@ import faker from "faker";
import { shippingZoneDetailsUrl } from "../../../../fixtures/urlList"; import { shippingZoneDetailsUrl } from "../../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../../fixtures/users"; 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 { 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 { createWarehouse } from "../../../../support/api/requests/Warehouse";
import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils"; import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
} from "../../../../support/api/utils/products/productsUtils"; } from "../../../../support/api/utils/products/productsUtils";
import { isShippingAvailableInCheckout } from "../../../../support/api/utils/storeFront/checkoutUtils"; import {
isShippingAvailableInCheckout,
} from "../../../../support/api/utils/storeFront/checkoutUtils";
import { import {
createShippingRate, createShippingRate,
rateOptions, rateOptions,
@ -33,7 +39,7 @@ describe("As a staff user I want to manage shipping weights", () => {
let variantsList; let variantsList;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
@ -80,9 +86,9 @@ describe("As a staff user I want to manage shipping weights", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping).visit(
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping) shippingZoneDetailsUrl(shippingZone.id),
.visit(shippingZoneDetailsUrl(shippingZone.id)); );
}); });
it( it(

View file

@ -4,14 +4,23 @@
import faker from "faker"; import faker from "faker";
import { SHARED_ELEMENTS } from "../../../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../../../elements/shared/sharedElements";
import { SHIPPING_RATE_DETAILS } from "../../../../elements/shipping/shipping-rate-details"; import {
import { shippingRateUrl, urlList } from "../../../../fixtures/urlList"; SHIPPING_RATE_DETAILS,
import { updateChannelWarehouses } from "../../../../support/api/requests/Channels"; } from "../../../../elements/shipping/shipping-rate-details";
import {
shippingRateUrl,
urlList,
} from "../../../../fixtures/urlList";
import {
updateChannelWarehouses,
} from "../../../../support/api/requests/Channels";
import { import {
createShippingRate as createShippingRateViaApi, createShippingRate as createShippingRateViaApi,
createShippingZone, createShippingZone,
} from "../../../../support/api/requests/ShippingMethod"; } 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 { createWarehouse } from "../../../../support/api/requests/Warehouse";
import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils"; import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils";
import { changeWeightUnit } from "../../../../support/pages/shippingMethodPage"; 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; let warehouse;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
updateShopWeightUnit("KG") updateShopWeightUnit("KG")
.then(() => { .then(() => {
getDefaultChannel().then(channel => { getDefaultChannel().then(channel => {

View file

@ -12,7 +12,7 @@ describe("Tests for site settings", () => {
let address; let address;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
cy.fixture("addresses").then(({ usAddress, plAddress }) => { cy.fixture("addresses").then(({ usAddress, plAddress }) => {
address = usAddress; address = usAddress;

View file

@ -4,15 +4,21 @@
import faker from "faker"; import faker from "faker";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { SHIPPING_ZONE_DETAILS } from "../../../elements/shipping/shipping-zone-details"; import {
import { WAREHOUSES_DETAILS } from "../../../elements/warehouses/warehouse-details"; 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 { WAREHOUSES_LIST } from "../../../elements/warehouses/warehouses-list";
import { import {
shippingZoneDetailsUrl, shippingZoneDetailsUrl,
urlList, urlList,
warehouseDetailsUrl, warehouseDetailsUrl,
} from "../../../fixtures/urlList"; } from "../../../fixtures/urlList";
import { updateChannelWarehouses } from "../../../support/api/requests/Channels"; import {
updateChannelWarehouses,
} from "../../../support/api/requests/Channels";
import { import {
createShippingZone, createShippingZone,
createShippingZoneWithoutWarehouse, createShippingZoneWithoutWarehouse,
@ -29,7 +35,7 @@ describe("As an admin I want to manage warehouses", () => {
let secondUsAddress; let secondUsAddress;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
cy.fixture("addresses").then(addresses => { cy.fixture("addresses").then(addresses => {
usAddress = addresses.usAddress; usAddress = addresses.usAddress;
secondUsAddress = addresses.secondUsAddress; secondUsAddress = addresses.secondUsAddress;
@ -38,7 +44,7 @@ describe("As an admin I want to manage warehouses", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -3,7 +3,9 @@
import faker from "faker"; 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 { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
import { customerDetailsUrl } from "../fixtures/urlList"; import { customerDetailsUrl } from "../fixtures/urlList";
import { import {
@ -20,7 +22,7 @@ describe("Tests for customer registration", () => {
let defaultChannel; let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel().then(channel => { getDefaultChannel().then(channel => {
defaultChannel = channel; defaultChannel = channel;
cy.checkIfDataAreNotNull({ defaultChannel }); cy.checkIfDataAreNotNull({ defaultChannel });

View file

@ -7,9 +7,12 @@ import { urlList } from "../../../fixtures/urlList";
import { createChannel } from "../../../support/api/requests/Channels"; import { createChannel } from "../../../support/api/requests/Channels";
import { updateChannelInProduct } from "../../../support/api/requests/Product"; import { updateChannelInProduct } from "../../../support/api/requests/Product";
import * as channelsUtils from "../../../support/api/utils/channelsUtils"; 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 { createShipping } from "../../../support/api/utils/shippingUtils";
import { getProductPrice } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; import {
getProductPrice,
} from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import { import {
getDefaultTaxClass, getDefaultTaxClass,
updateTaxConfigurationForChannel, updateTaxConfigurationForChannel,
@ -36,7 +39,7 @@ describe("As an admin I want to create sale for products", () => {
before(() => { before(() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
productsUtils productsUtils
.createTypeAttributeAndCategoryForProduct({ name }) .createTypeAttributeAndCategoryForProduct({ name })
.then( .then(
@ -82,7 +85,7 @@ describe("As an admin I want to create sale for products", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
updateTaxConfigurationForChannel({ updateTaxConfigurationForChannel({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
pricesEnteredWithTax: true, pricesEnteredWithTax: true,

View file

@ -11,7 +11,8 @@ import {
createSaleInChannel, createSaleInChannel,
getVariantWithSaleStatus, getVariantWithSaleStatus,
} from "../../../support/api/utils/discounts/salesUtils"; } 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 { createShipping } from "../../../support/api/utils/shippingUtils";
import { import {
getDefaultTaxClass, getDefaultTaxClass,
@ -36,7 +37,7 @@ describe("Sales discounts for variant", () => {
before(() => { before(() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
channelsUtils channelsUtils
.getDefaultChannel() .getDefaultChannel()
.then(channel => { .then(channel => {
@ -86,7 +87,7 @@ describe("Sales discounts for variant", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
updateTaxConfigurationForChannel({ updateTaxConfigurationForChannel({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
pricesEnteredWithTax: true, pricesEnteredWithTax: true,

View file

@ -46,7 +46,7 @@ describe("As an admin I want to update sales", () => {
before(() => { before(() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteSalesStartsWith(startsWith); deleteSalesStartsWith(startsWith);
@ -104,7 +104,7 @@ describe("As an admin I want to update sales", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
updateTaxConfigurationForChannel({ updateTaxConfigurationForChannel({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
pricesEnteredWithTax: true, pricesEnteredWithTax: true,

View file

@ -10,8 +10,11 @@ import {
addPayment, addPayment,
createCheckoutWithVoucher, createCheckoutWithVoucher,
} from "../../../support/api/utils/ordersUtils"; } from "../../../support/api/utils/ordersUtils";
import * as productsUtils from "../../../support/api/utils/products/productsUtils"; import * as productsUtils
import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils"; from "../../../support/api/utils/products/productsUtils";
import {
updateTaxConfigurationForChannel,
} from "../../../support/api/utils/taxesUtils";
import { import {
createVoucher, createVoucher,
discountOptions, discountOptions,
@ -30,7 +33,7 @@ describe("As an admin I want to create voucher", () => {
let defaultChannel; let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
productsUtils productsUtils
.createProductWithShipping({ name, productPrice, shippingPrice }) .createProductWithShipping({ name, productPrice, shippingPrice })
.then( .then(
@ -63,7 +66,7 @@ describe("As an admin I want to create voucher", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
updateTaxConfigurationForChannel({ updateTaxConfigurationForChannel({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
pricesEnteredWithTax: true, pricesEnteredWithTax: true,

View file

@ -8,7 +8,8 @@ import {
addPayment, addPayment,
createCheckoutWithVoucher, createCheckoutWithVoucher,
} from "../../../support/api/utils/ordersUtils"; } from "../../../support/api/utils/ordersUtils";
import * as productsUtils from "../../../support/api/utils/products/productsUtils"; import * as productsUtils
from "../../../support/api/utils/products/productsUtils";
import { import {
discountOptions, discountOptions,
loginAndCreateCheckoutForVoucherWithDiscount, loginAndCreateCheckoutForVoucherWithDiscount,
@ -26,7 +27,7 @@ describe("As an admin I want to create voucher", () => {
before(() => { before(() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
productsUtils productsUtils
.createProductWithShipping({ name, productPrice, shippingPrice }) .createProductWithShipping({ name, productPrice, shippingPrice })
.then( .then(

View file

@ -6,11 +6,21 @@ import faker from "faker";
import { VOUCHERS_SELECTORS } from "../../../elements/discounts/vouchers"; import { VOUCHERS_SELECTORS } from "../../../elements/discounts/vouchers";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { voucherDetailsUrl } from "../../../fixtures/urlList"; import { voucherDetailsUrl } from "../../../fixtures/urlList";
import { createVoucherInChannel } from "../../../support/api/utils/discounts/vouchersUtils"; import {
import { createCheckoutWithVoucher } from "../../../support/api/utils/ordersUtils"; createVoucherInChannel,
import * as productsUtils from "../../../support/api/utils/products/productsUtils"; } from "../../../support/api/utils/discounts/vouchersUtils";
import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils"; import {
import { formatDate, formatTime } from "../../../support/formatData/formatDate"; 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"; import { setVoucherDate } from "../../../support/pages/discounts/vouchersPage";
describe("As an admin I want to update vouchers", () => { describe("As an admin I want to update vouchers", () => {
@ -26,7 +36,7 @@ describe("As an admin I want to update vouchers", () => {
before(() => { before(() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
productsUtils productsUtils
.createProductWithShipping({ name, productPrice, shippingPrice }) .createProductWithShipping({ name, productPrice, shippingPrice })
.then( .then(
@ -57,7 +67,7 @@ describe("As an admin I want to update vouchers", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
updateTaxConfigurationForChannel({ updateTaxConfigurationForChannel({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
pricesEnteredWithTax: true, pricesEnteredWithTax: true,

View file

@ -44,7 +44,7 @@ describe("As an admin I want to see correct information on dashboard home page",
let ordersRegexp; let ordersRegexp;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
productsUtils productsUtils
.createProductWithShipping({ .createProductWithShipping({
name: randomName, name: randomName,
@ -140,7 +140,7 @@ describe("As an admin I want to see correct information on dashboard home page",
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -5,10 +5,6 @@ import { LOGIN_SELECTORS } from "../elements/account/login-selectors";
import { urlList } from "../fixtures/urlList"; import { urlList } from "../fixtures/urlList";
describe("User authorization", () => { describe("User authorization", () => {
beforeEach(() => {
cy.clearSessionData();
});
it( it(
"should successfully log in an user", "should successfully log in an user",
{ tags: ["@login", "@allEnv", "@stable", "@oldRelease"] }, { tags: ["@login", "@allEnv", "@stable", "@oldRelease"] },

View file

@ -6,8 +6,13 @@ import {
updateMetadata, updateMetadata,
updatePrivateMetadata, updatePrivateMetadata,
} from "../support/api/requests/Metadata"; } from "../support/api/requests/Metadata";
import { createDraftOrder, getOrder } from "../support/api/requests/Order"; import {
import { getProductMetadata } from "../support/api/requests/storeFront/ProductDetails"; createDraftOrder,
getOrder,
} from "../support/api/requests/Order";
import {
getProductMetadata,
} from "../support/api/requests/storeFront/ProductDetails";
import { getDefaultChannel } from "../support/api/utils/channelsUtils"; import { getDefaultChannel } from "../support/api/utils/channelsUtils";
import { import {
createProductInChannel, createProductInChannel,
@ -22,7 +27,7 @@ describe("Test for metadata", () => {
let product; let product;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel() getDefaultChannel()
.then(channelResp => { .then(channelResp => {
channel = channelResp; channel = channelResp;
@ -47,7 +52,7 @@ describe("Test for metadata", () => {
"should create metadata for product", "should create metadata for product",
{ tags: ["@metadata", "@allEnv", "@stable"] }, { tags: ["@metadata", "@allEnv", "@stable"] },
() => { () => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
updateMetadata(product.id, metadata.key, metadata.value); updateMetadata(product.id, metadata.key, metadata.value);
updatePrivateMetadata(product.id, metadata.key, metadata.value) updatePrivateMetadata(product.id, metadata.key, metadata.value)
.then(() => { .then(() => {
@ -90,7 +95,7 @@ describe("Test for metadata", () => {
{ tags: ["@metadata", "@allEnv", "@stable"] }, { tags: ["@metadata", "@allEnv", "@stable"] },
() => { () => {
let order; let order;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createDraftOrder({ channelId: channel.id }) createDraftOrder({ channelId: channel.id })
.then(orderResp => { .then(orderResp => {
order = orderResp; order = orderResp;

View file

@ -35,9 +35,6 @@ import {
} from "../support/pages/mainMenuPage"; } from "../support/pages/mainMenuPage";
describe("As a staff user I want to navigate through shop using different permissions", () => { describe("As a staff user I want to navigate through shop using different permissions", () => {
beforeEach(() => {
cy.clearSessionData();
});
it( it(
`should be able to navigate through shop as a staff member using DISCOUNTS permission. TC: SALEOR_3405a - sales list`, `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"] }, { tags: ["@allEnv", "@navigation", "@stable", "@oldRelease", "@critical"] },

View file

@ -3,9 +3,13 @@
import faker from "faker"; 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 { 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 { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
import { urlList } from "../../fixtures/urlList"; import { urlList } from "../../fixtures/urlList";
import { createChannel } from "../../support/api/requests/Channels"; import { createChannel } from "../../support/api/requests/Channels";
@ -23,7 +27,7 @@ xdescribe("Channels in draft orders", () => {
let otherChannel; let otherChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
channelsUtils channelsUtils
.getDefaultChannel() .getDefaultChannel()
.then(channel => { .then(channel => {
@ -37,7 +41,7 @@ xdescribe("Channels in draft orders", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -19,7 +19,9 @@ import {
getDefaultChannel, getDefaultChannel,
} from "../../support/api/utils/"; } from "../../support/api/utils/";
import * as productsUtils from "../../support/api/utils/products/productsUtils"; import * as productsUtils from "../../support/api/utils/products/productsUtils";
import { ensureCanvasStatic } from "../../support/customCommands/sharedElementsOperations/canvas"; import {
ensureCanvasStatic,
} from "../../support/customCommands/sharedElementsOperations/canvas";
import { import {
finalizeDraftOrder, finalizeDraftOrder,
selectChannelInPicker, selectChannelInPicker,
@ -36,7 +38,7 @@ describe("Draft orders", () => {
let shippingMethod; let shippingMethod;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
updateOrdersSettings(); updateOrdersSettings();
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
@ -94,7 +96,7 @@ describe("Draft orders", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -4,7 +4,9 @@
import faker from "faker"; import faker from "faker";
import { createCheckout } from "../../support/api/requests/Checkout"; 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 { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import { import {
createProductInChannel, createProductInChannel,
@ -34,7 +36,7 @@ describe("As an admin I want to manage stock reservation", () => {
let dataForCheckout; let dataForCheckout;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
cy.fixture("addresses").then(addresses => { cy.fixture("addresses").then(addresses => {
address = addresses.usAddress; address = addresses.usAddress;
@ -81,7 +83,7 @@ describe("As an admin I want to manage stock reservation", () => {
beforeEach(() => { beforeEach(() => {
const productName = `${startsWith}${faker.datatype.number()}`; const productName = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createProductInChannel({ createProductInChannel({
attributeId: attribute.id, attributeId: attribute.id,

View file

@ -80,7 +80,7 @@ describe("Orders", () => {
privateMetadataValue + "- updated private metadata value"; privateMetadataValue + "- updated private metadata value";
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
updateOrdersSettings(); updateOrdersSettings();
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
@ -148,10 +148,7 @@ describe("Orders", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.order);
"auth",
ONE_PERMISSION_USERS.order,
);
}); });
it( it(

View file

@ -4,7 +4,10 @@
import faker from "faker"; import faker from "faker";
import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors"; import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
import { ONE_PERMISSION_USERS, urlList } from "../../fixtures"; import {
ONE_PERMISSION_USERS,
urlList,
} from "../../fixtures";
import { import {
createChannel, createChannel,
createCustomer, createCustomer,
@ -34,7 +37,7 @@ describe("Orders", () => {
let taxClass; let taxClass;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createChannel({ name: randomName }) createChannel({ name: randomName })
.then(channelResp => { .then(channelResp => {
channel = channelResp; channel = channelResp;
@ -103,9 +106,7 @@ describe("Orders", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.order).then(() => {
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.order)
.then(() => {
// set notifiedAboutNavigator to make navigator banner gone from the start - banner was covering needed elements during test // set notifiedAboutNavigator to make navigator banner gone from the start - banner was covering needed elements during test
window.localStorage.setItem("notifiedAboutNavigator", "true"); window.localStorage.setItem("notifiedAboutNavigator", "true");
}); });

View file

@ -3,11 +3,18 @@
import faker from "faker"; import faker from "faker";
import { PAGE_TYPE_DETAILS_SELECTORS } from "../../elements/pageTypes/pageTypeDetails"; import {
import { PAGE_TYPES_LIST_SELECTORS } from "../../elements/pageTypes/pageTypesList"; 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 { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; 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 { createAttribute } from "../../support/api/requests/Attribute";
import { import {
createPageType, createPageType,
@ -18,7 +25,7 @@ describe("Tests for page types", () => {
const startsWith = "PageTypes"; const startsWith = "PageTypes";
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -37,7 +37,7 @@ describe("Tests for pages", () => {
}; };
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
attributeRequests attributeRequests
.createAttribute({ name, type: "PAGE_TYPE" }) .createAttribute({ name, type: "PAGE_TYPE" })
.then(attributeResp => { .then(attributeResp => {
@ -51,7 +51,7 @@ describe("Tests for pages", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -3,7 +3,9 @@
import faker from "faker"; 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 { PRODUCTS_LIST } from "../../elements/catalog/products/products-list";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { urlList } from "../../fixtures/urlList"; import { urlList } from "../../fixtures/urlList";
@ -52,14 +54,14 @@ describe("As an admin I should be able to create product", () => {
let attribute; let attribute;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createAttribute({ name }).then(attributeResp => { createAttribute({ name }).then(attributeResp => {
attribute = attributeResp; attribute = attributeResp;
cy.checkIfDataAreNotNull({ attribute }); cy.checkIfDataAreNotNull({ attribute });
}); });
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -1,12 +1,16 @@
/// <reference types="cypress"/> /// <reference types="cypress"/>
/// <reference types="../../support"/> /// <reference types="../../support"/>
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 { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { demoProductsNames } from "../../fixtures/products"; import { demoProductsNames } from "../../fixtures/products";
import { productDetailsUrl } from "../../fixtures/urlList"; import { productDetailsUrl } from "../../fixtures/urlList";
import { getFirstProducts } from "../../support/api/requests/Product"; import { getFirstProducts } from "../../support/api/requests/Product";
import { deleteCollectionsStartsWith } from "../../support/api/utils/catalog/collectionsUtils"; import {
deleteCollectionsStartsWith,
} from "../../support/api/utils/catalog/collectionsUtils";
import { import {
createNewProductWithNewDataAndDefaultChannel, createNewProductWithNewDataAndDefaultChannel,
deleteProductsStartsWith, deleteProductsStartsWith,
@ -14,7 +18,7 @@ import {
describe("Tests for images", () => { describe("Tests for images", () => {
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -5,12 +5,19 @@ import faker from "faker";
import { productDetailsUrl } from "../../../fixtures/urlList"; import { productDetailsUrl } from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; 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 { 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 * as shippingUtils from "../../../support/api/utils/shippingUtils";
import { isProductAvailableForPurchase } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; import {
import { updateProductIsAvailableForPurchase } from "../../../support/pages/catalog/products/productDetailsPage"; isProductAvailableForPurchase,
} from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import {
updateProductIsAvailableForPurchase,
} from "../../../support/pages/catalog/products/productDetailsPage";
describe("Products available in listings", () => { describe("Products available in listings", () => {
const startsWith = "CyAvailForPurchase-"; const startsWith = "CyAvailForPurchase-";
@ -22,7 +29,7 @@ describe("Products available in listings", () => {
let warehouse; let warehouse;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
shippingUtils.deleteShippingStartsWith(startsWith); shippingUtils.deleteShippingStartsWith(startsWith);
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
@ -65,10 +72,7 @@ describe("Products available in listings", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product);
"auth",
ONE_PERMISSION_USERS.product,
);
}); });
it( it(

View file

@ -5,11 +5,18 @@ import faker from "faker";
import { productDetailsUrl } from "../../../fixtures/urlList"; import { productDetailsUrl } from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; 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 { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
import * as productsUtils from "../../../support/api/utils/products/productsUtils"; import * as productsUtils
import { isProductVisible } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; from "../../../support/api/utils/products/productsUtils";
import { updateProductPublish } from "../../../support/pages/catalog/products/productDetailsPage"; import {
isProductVisible,
} from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import {
updateProductPublish,
} from "../../../support/pages/catalog/products/productDetailsPage";
describe("Published products", () => { describe("Published products", () => {
const startsWith = "CyPublishedProducts-"; const startsWith = "CyPublishedProducts-";
@ -20,7 +27,7 @@ describe("Published products", () => {
let defaultChannel; let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
productsUtils productsUtils
.createTypeAttributeAndCategoryForProduct({ name }) .createTypeAttributeAndCategoryForProduct({ name })
.then( .then(
@ -47,10 +54,7 @@ describe("Published products", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product);
"auth",
ONE_PERMISSION_USERS.product,
);
}); });
it( it(

View file

@ -6,9 +6,14 @@ import { productDetailsUrl } from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { searchInShop } from "../../../support/api/requests/storeFront/Search"; import { searchInShop } from "../../../support/api/requests/storeFront/Search";
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
import * as productsUtils from "../../../support/api/utils/products/productsUtils"; import * as productsUtils
import { isProductVisibleInSearchResult } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; from "../../../support/api/utils/products/productsUtils";
import { updateProductVisibleInListings } from "../../../support/pages/catalog/products/productDetailsPage"; import {
isProductVisibleInSearchResult,
} from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import {
updateProductVisibleInListings,
} from "../../../support/pages/catalog/products/productDetailsPage";
describe("Products displayed in listings", () => { describe("Products displayed in listings", () => {
const startsWith = "CyVisibleInListings-"; const startsWith = "CyVisibleInListings-";
@ -19,7 +24,7 @@ describe("Products displayed in listings", () => {
let defaultChannel; let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
productsUtils productsUtils
.createTypeAttributeAndCategoryForProduct({ name }) .createTypeAttributeAndCategoryForProduct({ name })
.then( .then(
@ -46,10 +51,7 @@ describe("Products displayed in listings", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product);
"auth",
ONE_PERMISSION_USERS.product,
);
}); });
it( it(

View file

@ -2,15 +2,19 @@
/// <reference types="../../../support"/> /// <reference types="../../../support"/>
import { SHARED_ELEMENTS } from "../../../elements"; 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 { LOCAL_STORAGE_FOR_COLUMN_PICKER } from "../../../fixtures";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import { ensureCanvasStatic } from "../../../support/customCommands/sharedElementsOperations/canvas"; import {
ensureCanvasStatic,
} from "../../../support/customCommands/sharedElementsOperations/canvas";
import { columnPickerPage } from "../../../support/pages"; import { columnPickerPage } from "../../../support/pages";
describe("As an admin I should be able to use column picker", () => { describe("As an admin I should be able to use column picker", () => {
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -2,11 +2,19 @@
/// <reference types="../../../support"/> /// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { BUTTON_SELECTORS, PRODUCTS_LIST } from "../../../elements/"; import {
BUTTON_SELECTORS,
PRODUCTS_LIST,
} from "../../../elements/";
import { MESSAGES } from "../../../fixtures/"; import { MESSAGES } from "../../../fixtures/";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import { getDefaultChannel, productsUtils } from "../../../support/api/utils/"; import {
import { ensureCanvasStatic } from "../../../support/customCommands/sharedElementsOperations/canvas"; getDefaultChannel,
productsUtils,
} from "../../../support/api/utils/";
import {
ensureCanvasStatic,
} from "../../../support/customCommands/sharedElementsOperations/canvas";
describe("Test for deleting products", () => { describe("Test for deleting products", () => {
const startsWith = "AABulkDeleteCypress"; const startsWith = "AABulkDeleteCypress";
@ -16,7 +24,7 @@ describe("Test for deleting products", () => {
let product; let product;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel() getDefaultChannel()
.then(channelResp => { .then(channelResp => {
channel = channelResp; channel = channelResp;

View file

@ -32,7 +32,7 @@ describe("As an admin I should be able to filter products", () => {
let collection; let collection;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createTypeAttributeAndCategoryForProduct({ name }).then( createTypeAttributeAndCategoryForProduct({ name }).then(
({ ({
attribute: attributeResp, attribute: attributeResp,
@ -86,7 +86,7 @@ describe("As an admin I should be able to filter products", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest().visit(urlList.products); cy.loginUserViaRequest().visit(urlList.products);
}); });
const filterProductsBy = [ const filterProductsBy = [

View file

@ -2,13 +2,17 @@
/// <reference types="../../../support"/> /// <reference types="../../../support"/>
import { PAGINATION } from "../../../elements"; 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 { 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", () => { describe("As an admin I should be able to manage products table", () => {
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
cy.visit(urlList.products); cy.visit(urlList.products);
}); });

View file

@ -1,20 +1,10 @@
/// <reference types="cypress"/> /// <reference types="cypress"/>
/// <reference types="../../../support"/> /// <reference types="../../../support"/>
import { import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list";
PRODUCTS_LIST, import { PRESETS, SEARCH } from "../../../elements/shared";
} from "../../../elements/catalog/products/products-list"; import { LOCAL_STORAGE_KEYS, urlList } from "../../../fixtures/";
import { import { ensureCanvasStatic } from "../../../support/customCommands/sharedElementsOperations/canvas";
PRESETS,
SEARCH,
} from "../../../elements/shared";
import {
LOCAL_STORAGE_KEYS,
urlList,
} from "../../../fixtures/";
import {
ensureCanvasStatic,
} from "../../../support/customCommands/sharedElementsOperations/canvas";
import { import {
addPresetWithName, addPresetWithName,
clickDeletePresetButton, 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", () => { describe("As a user I should be able to save selected filters with search queries under the given name", () => {
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -1,6 +1,8 @@
/// <reference types="cypress"/> /// <reference types="cypress"/>
import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"; import {
PRODUCTS_LIST,
} from "../../../elements/catalog/products/products-list";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import { import {
changeToDatagridView, changeToDatagridView,
@ -9,9 +11,7 @@ import {
describe("As an user I should be able switch between product views", () => { describe("As an user I should be able switch between product views", () => {
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.loginUserViaRequest().then(() => {
.loginUserViaRequest()
.then(() => {
// set notifiedAboutNavigator to make navigator banner gone from the start - banner was covering needed elements during test // set notifiedAboutNavigator to make navigator banner gone from the start - banner was covering needed elements during test
window.localStorage.setItem("notifiedAboutNavigator", "true"); window.localStorage.setItem("notifiedAboutNavigator", "true");
}); });

View file

@ -1,7 +1,9 @@
/// <reference types="cypress"/> /// <reference types="cypress"/>
/// <reference types="../../../support"/> /// <reference types="../../../support"/>
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 { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils"; 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; let defaultChannel;
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.loginUserViaRequest()
.loginUserViaRequest()
.visit(urlList.products) .visit(urlList.products)
.get(SHARED_ELEMENTS.header) .get(SHARED_ELEMENTS.header)
.should("be.visible"); .should("be.visible");
}); });
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel().then(channel => { getDefaultChannel().then(channel => {
defaultChannel = channel; defaultChannel = channel;
cy.checkIfDataAreNotNull({ defaultChannel }); cy.checkIfDataAreNotNull({ defaultChannel });

View file

@ -3,7 +3,9 @@
import faker from "faker"; 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 { urlList } from "../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../fixtures/users"; import { ONE_PERMISSION_USERS } from "../../fixtures/users";
import { createChannel } from "../../support/api/requests/Channels"; import { createChannel } from "../../support/api/requests/Channels";
@ -12,7 +14,9 @@ import {
updateChannelInProduct, updateChannelInProduct,
} from "../../support/api/requests/Product"; } from "../../support/api/requests/Product";
import * as productUtils from "../../support/api/utils/products/productsUtils"; 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 { import {
addVariantToDataGrid, addVariantToDataGrid,
enterVariantEditPage, enterVariantEditPage,
@ -36,7 +40,7 @@ describe("As an admin I should be able to create variant", () => {
before(() => { before(() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
productUtils productUtils
.createShippingProductTypeAttributeAndCategory(name, attributeValues) .createShippingProductTypeAttributeAndCategory(name, attributeValues)
@ -63,10 +67,7 @@ describe("As an admin I should be able to create variant", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product);
"auth",
ONE_PERMISSION_USERS.product,
);
}); });
it( it(

View file

@ -8,7 +8,10 @@ import {
PRODUCT_DETAILS, PRODUCT_DETAILS,
PRODUCTS_LIST, PRODUCTS_LIST,
} from "../../../elements/"; } from "../../../elements/";
import { ONE_PERMISSION_USERS, urlList } from "../../../fixtures/"; import {
ONE_PERMISSION_USERS,
urlList,
} from "../../../fixtures/";
import { import {
productsRequests, productsRequests,
productsTypeRequests, productsTypeRequests,
@ -41,7 +44,7 @@ describe("Creating variants", () => {
let address; let address;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const simpleProductTypeName = `${startsWith}${faker.datatype.number()}`; const simpleProductTypeName = `${startsWith}${faker.datatype.number()}`;
@ -97,10 +100,7 @@ describe("Creating variants", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product);
"auth",
ONE_PERMISSION_USERS.product,
);
}); });
it( it(

View file

@ -3,7 +3,9 @@
import faker from "faker"; 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 { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
import { productVariantDetailUrl } from "../../../fixtures/urlList"; import { productVariantDetailUrl } from "../../../fixtures/urlList";
@ -14,10 +16,15 @@ import {
updateChannelPriceInVariant, updateChannelPriceInVariant,
} from "../../../support/api/requests/Product"; } from "../../../support/api/requests/Product";
import { createTypeProduct } from "../../../support/api/requests/ProductType"; import { createTypeProduct } from "../../../support/api/requests/ProductType";
import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils"; import {
import * as productUtils from "../../../support/api/utils/products/productsUtils"; createWaitingForCaptureOrder,
} from "../../../support/api/utils/ordersUtils";
import * as productUtils
from "../../../support/api/utils/products/productsUtils";
import * as shippingUtils from "../../../support/api/utils/shippingUtils"; 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", () => { describe("Updating products without sku", () => {
const startsWith = "UpdateProductsSku"; const startsWith = "UpdateProductsSku";
@ -38,7 +45,7 @@ describe("Updating products without sku", () => {
const attributeValues = ["value1", "value2"]; const attributeValues = ["value1", "value2"];
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
productUtils.deleteProductsStartsWith(startsWith); productUtils.deleteProductsStartsWith(startsWith);
shippingUtils.deleteShippingStartsWith(startsWith); shippingUtils.deleteShippingStartsWith(startsWith);
deleteWarehouseStartsWith(startsWith); deleteWarehouseStartsWith(startsWith);
@ -90,7 +97,7 @@ describe("Updating products without sku", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(
"should be able to add SKU to simple product TC: SALEOR_2802", "should be able to add SKU to simple product TC: SALEOR_2802",

View file

@ -3,21 +3,29 @@
import faker from "faker"; 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 { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { productDetailsUrl } from "../../fixtures/urlList"; import { productDetailsUrl } from "../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../fixtures/users"; import { ONE_PERMISSION_USERS } from "../../fixtures/users";
import { createCategory } from "../../support/api/requests/Category"; import { createCategory } from "../../support/api/requests/Category";
import { createCollection } from "../../support/api/requests/Collections"; 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 { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import { expectCorrectProductInformation } from "../../support/api/utils/products/checkProductInfo"; import {
expectCorrectProductInformation,
} from "../../support/api/utils/products/checkProductInfo";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
} from "../../support/api/utils/products/productsUtils"; } from "../../support/api/utils/products/productsUtils";
import { metadataForms } from "../../support/pages/catalog/metadataComponent"; 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", () => { describe("Update products", () => {
const startsWith = "CyUpdateProducts-"; const startsWith = "CyUpdateProducts-";
@ -30,7 +38,7 @@ describe("Update products", () => {
let attribute; let attribute;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;

View file

@ -12,7 +12,11 @@ import {
STAFF_MEMBERS_LIST_SELECTORS, STAFF_MEMBERS_LIST_SELECTORS,
} from "../elements/"; } from "../elements/";
import { LOGIN_SELECTORS } from "../elements/account/login-selectors"; 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 { userDetailsUrl } from "../fixtures/urlList";
import { import {
activatePlugin, activatePlugin,
@ -42,7 +46,7 @@ describe("Staff members", () => {
let user; let user;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
activatePlugin({ id: "mirumee.notifications.admin_email" }); activatePlugin({ id: "mirumee.notifications.admin_email" });
inviteStaffMemberWithFirstPermission({ email }) inviteStaffMemberWithFirstPermission({ email })
.then(({ user: userResp }) => { .then(({ user: userResp }) => {
@ -58,7 +62,7 @@ describe("Staff members", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -18,7 +18,7 @@ describe("As an admin I want to manage translations", () => {
let category; let category;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
createCategory({ name: startsWith, slug }).then(categoryResp => { createCategory({ name: startsWith, slug }).then(categoryResp => {
category = categoryResp; category = categoryResp;
cy.checkIfDataAreNotNull({ category }); cy.checkIfDataAreNotNull({ category });
@ -26,7 +26,7 @@ describe("As an admin I want to manage translations", () => {
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.loginUserViaRequest();
}); });
it( it(

View file

@ -47,6 +47,7 @@ Cypress.Commands.add(
"_saleorRefreshToken", "_saleorRefreshToken",
resp.body.data.tokenCreate.refreshToken, resp.body.data.tokenCreate.refreshToken,
); );
window.localStorage.setItem("notifiedAboutNavigator", "true");
window.sessionStorage.setItem( window.sessionStorage.setItem(
authorization, authorization,
resp.body.data.tokenCreate.token, resp.body.data.tokenCreate.token,

View file

@ -24,7 +24,9 @@ import {
SHARED_ELEMENTS, SHARED_ELEMENTS,
} from "../elements"; } from "../elements";
import { urlList } from "../fixtures/urlList"; 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"; import cypressGrep from "../support/cypress-grep/support";
commandTimings(); commandTimings();