diff --git a/.eslintrc.json b/.eslintrc.json
index 9c8aa5fd6..1bb03ae24 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -167,7 +167,7 @@
"sort-imports": "off", // imports are handled by simple-import-sort/sort
"sort-keys": "off",
"space-before-function-paren": "off",
- "spaced-comment": "error",
+ "spaced-comment": ["error", "always", { "markers": ["/"] }],
"use-isnan": "error",
"valid-typeof": "off",
"no-restricted-imports": [
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index de47bdc2f..ef4372cb8 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -8,7 +8,7 @@ on:
jobs:
cypress-run:
if: github.event.pull_request.head.repo.full_name == 'mirumee/saleor-dashboard' && (((github.event.action == 'labeled') && (github.event.label.name == 'run e2e')) || ((github.event.action != 'labeled') && contains(github.event.pull_request.labels.*.name, 'run e2e')))
- runs-on: ubuntu-16.04
+ runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
diff --git a/cypress/elements/navigation/menu-details.js b/cypress/elements/navigation/menu-details.js
index 94b637d4a..4213d002a 100644
--- a/cypress/elements/navigation/menu-details.js
+++ b/cypress/elements/navigation/menu-details.js
@@ -5,6 +5,7 @@ export const MENU_DETAILS = {
autocompleteSelectReference: '[data-test-id="containerAutocompleteSelect"]',
categoryItem: '[data-test-id="category"]',
collectionItem: '[data-test-id="collection"]',
- pageItem: '[data-test-id="page"]'
+ pageItem: '[data-test-id="page"]',
+ anyMenuItem: '[id="downshift-0-item-2"]'
}
};
diff --git a/cypress/Data/permissions.js b/cypress/fixtures/permissions.js
similarity index 100%
rename from cypress/Data/permissions.js
rename to cypress/fixtures/permissions.js
diff --git a/cypress/Data/permissionsUsers.js b/cypress/fixtures/permissionsUsers.js
similarity index 100%
rename from cypress/Data/permissionsUsers.js
rename to cypress/fixtures/permissionsUsers.js
diff --git a/cypress/url/urlList.js b/cypress/fixtures/urlList.js
similarity index 100%
rename from cypress/url/urlList.js
rename to cypress/fixtures/urlList.js
diff --git a/cypress/Data/users.js b/cypress/fixtures/users.js
similarity index 100%
rename from cypress/Data/users.js
rename to cypress/fixtures/users.js
diff --git a/cypress/integration/apps.js b/cypress/integration/apps.js
index fa9cd941d..a1896c311 100644
--- a/cypress/integration/apps.js
+++ b/cypress/integration/apps.js
@@ -1,17 +1,19 @@
+///
+///
+
import faker from "faker";
-import { createApp, getApp } from "../apiRequests/Apps";
-import { ONE_PERMISSION_USERS } from "../Data/users";
import { APP_DETAILS } from "../elements/apps/appDetails";
import { APPS_LIST } from "../elements/apps/appsList";
import { WEBHOOK_DETAILS } from "../elements/apps/webhookDetails";
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages";
+import { appDetailsUrl, urlList } from "../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../fixtures/users";
+import { createApp, getApp } from "../support/api/requests/Apps";
+import { deleteAppsStartsWith } from "../support/api/utils/appUtils";
import filterTests from "../support/filterTests";
-import { appDetailsUrl, urlList } from "../url/urlList";
-import { deleteAppsStartsWith } from "../utils/appUtils";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Tests for apps", () => {
const startsWith = "Apps";
const name = `${startsWith}${faker.datatype.number()}`;
@@ -45,9 +47,9 @@ filterTests(["all"], () => {
.click()
.addAliasToGraphRequest("AppCreate")
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- cy.wait("@AppCreate")
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@AppCreate")
.its("response.body.data.appCreate.app")
.then(app => {
getApp(app.id);
@@ -71,8 +73,8 @@ filterTests(["all"], () => {
.get(WEBHOOK_DETAILS.targetUrlInput)
.type(targetUrl)
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
+ .click()
+ .confirmationMessageShouldDisappear();
getApp(createdApp.id).then(({ webhooks }) => {
expect(webhooks[0].name).to.eq(randomName);
expect(webhooks[0].targetUrl).to.eq(targetUrl);
diff --git a/cypress/integration/categories.js b/cypress/integration/catalog/categories.js
similarity index 77%
rename from cypress/integration/categories.js
rename to cypress/integration/catalog/categories.js
index cd7b2537d..050749f61 100644
--- a/cypress/integration/categories.js
+++ b/cypress/integration/catalog/categories.js
@@ -1,21 +1,22 @@
-//
+///
+///
+
import faker from "faker";
-import { getCategory } from "../apiRequests/Category";
-import { CATEGORIES_LIST } from "../elements/catalog/categories/categories-list";
-import { CATEGORY_DETAILS } from "../elements/catalog/categories/category-details";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
-import { createCategory } from "../steps/categoriesSteps";
-import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages";
-import filterTests from "../support/filterTests";
-import { categoryDetailsUrl, urlList } from "../url/urlList";
-import { deleteCategoriesStartsWith } from "../utils/categoryUtils";
-import * as channelsUtils from "../utils/channelsUtils";
-import * as productsUtils from "../utils/products/productsUtils";
-import { deleteShippingStartsWith } from "../utils/shippingUtils";
+import { CATEGORIES_LIST } from "../../elements/catalog/categories/categories-list";
+import { CATEGORY_DETAILS } from "../../elements/catalog/categories/category-details";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
+import { categoryDetailsUrl, urlList } from "../../fixtures/urlList";
+import { getCategory } from "../../support/api/requests/Category";
+import { deleteCategoriesStartsWith } from "../../support/api/utils/categoryUtils";
+import * as channelsUtils from "../../support/api/utils/channelsUtils";
+import * as productsUtils from "../../support/api/utils/products/productsUtils";
+import { deleteShippingStartsWith } from "../../support/api/utils/shippingUtils";
+import filterTests from "../../support/filterTests";
+import { createCategory } from "../../support/pages/catalog/categoriesPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Categories", () => {
const startsWith = "CyCollections";
const name = `${startsWith}${faker.datatype.number()}`;
@@ -118,11 +119,11 @@ filterTests(["all"], () => {
.click()
.addAliasToGraphRequest("productBulkDelete")
.get(BUTTON_SELECTORS.submit)
- .click();
- confirmationMessageShouldDisappear();
+ .click()
+ .confirmationMessageShouldDisappear();
cy.contains(CATEGORY_DETAILS.productRow, product.name)
.should("not.exist")
- .wait("@productBulkDelete");
+ .waitForRequestAndCheckIfNoErrors("@productBulkDelete");
getCategory(category.id).then(categoryResp => {
expect(categoryResp.products.edges.length).to.be.eq(0);
});
diff --git a/cypress/integration/collections.js b/cypress/integration/catalog/collections.js
similarity index 83%
rename from cypress/integration/collections.js
rename to cypress/integration/catalog/collections.js
index 372c38da0..69a10eaa1 100644
--- a/cypress/integration/collections.js
+++ b/cypress/integration/catalog/collections.js
@@ -1,27 +1,29 @@
-//
+///
+///
+
import faker from "faker";
-import { createChannel } from "../apiRequests/Channels";
-import { updateChannelInProduct } from "../apiRequests/Product";
-import { getCollection } from "../apiRequests/storeFront/Collections";
-import { searchInShop } from "../apiRequests/storeFront/Search";
-import {
- assignProductsToCollection,
- createCollection
-} from "../steps/collectionsSteps";
-import filterTests from "../support/filterTests";
-import { urlList } from "../url/urlList";
-import * as channelsUtils from "../utils/channelsUtils";
-import { deleteCollectionsStartsWith } from "../utils/collectionsUtils";
-import * as productsUtils from "../utils/products/productsUtils";
-import { deleteShippingStartsWith } from "../utils/shippingUtils";
+import { urlList } from "../../fixtures/urlList";
+import { createChannel } from "../../support/api/requests/Channels";
+import { updateChannelInProduct } from "../../support/api/requests/Product";
+import { getCollection } from "../../support/api/requests/storeFront/Collections";
+import { searchInShop } from "../../support/api/requests/storeFront/Search";
+import * as channelsUtils from "../../support/api/utils/channelsUtils";
+import { deleteCollectionsStartsWith } from "../../support/api/utils/collectionsUtils";
+import * as productsUtils from "../../support/api/utils/products/productsUtils";
+import { deleteShippingStartsWith } from "../../support/api/utils/shippingUtils";
import {
isCollectionVisible,
isProductInCollectionVisible
-} from "../utils/storeFront/collectionsUtils";
-import { isProductVisibleInSearchResult } from "../utils/storeFront/storeFrontProductUtils";
+} from "../../support/api/utils/storeFront/collectionsUtils";
+import { isProductVisibleInSearchResult } from "../../support/api/utils/storeFront/storeFrontProductUtils";
+import filterTests from "../../support/filterTests";
+import {
+ assignProductsToCollection,
+ createCollection
+} from "../../support/pages/catalog/collectionsPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Collections", () => {
const startsWith = "CyCollections-";
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/giftCards.js b/cypress/integration/catalog/giftCards.js
similarity index 87%
rename from cypress/integration/giftCards.js
rename to cypress/integration/catalog/giftCards.js
index 3a9c5ff48..e5b65c546 100644
--- a/cypress/integration/giftCards.js
+++ b/cypress/integration/catalog/giftCards.js
@@ -1,7 +1,11 @@
-//
+///
+///
+
import faker from "faker";
-import { getGiftCardWithTag } from "../apiRequests/giftCards";
+import { getGiftCardWithTag } from "../../support/api/requests/GiftCard";
+import filterTests from "../../support/filterTests";
+import { formatDate } from "../../support/formatData/formatDate";
import {
expiryPeriods,
openAndFillUpCreateGiftCardDialog,
@@ -9,11 +13,9 @@ import {
setExpiryDate,
setExpiryPeriod,
setNeverExpire
-} from "../steps/giftCardSteps";
-import filterTests from "../support/filterTests";
-import { formatDate } from "../support/format/formatDate";
+} from "../../support/pages/catalog/giftCardPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
describe("Tests for gift cards", () => {
const startsWith = "GiftCards";
const amount = 50;
diff --git a/cypress/integration/checkout/productWithoutShipping.js b/cypress/integration/checkout/productWithoutShipping.js
index b383991e3..c8e4aed09 100644
--- a/cypress/integration/checkout/productWithoutShipping.js
+++ b/cypress/integration/checkout/productWithoutShipping.js
@@ -1,25 +1,26 @@
-//
+///
+///
import faker from "faker";
-import { createChannel } from "../../apiRequests/Channels";
+import { createChannel } from "../../support/api/requests/Channels";
import {
addProductsToCheckout,
addShippingMethod,
createCheckout
-} from "../../apiRequests/Checkout";
-import filterTests from "../../support/filterTests";
+} from "../../support/api/requests/Checkout";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith
-} from "../../utils/products/productsUtils";
+} from "../../support/api/utils/products/productsUtils";
import {
createShipping,
deleteShippingStartsWith
-} from "../../utils/shippingUtils";
+} from "../../support/api/utils/shippingUtils";
+import filterTests from "../../support/filterTests";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Products without shipment option", () => {
const startsWith = "WithoutShipmentCheckout-";
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/checkout/purchaseWithProductTypes.js b/cypress/integration/checkout/purchaseWithProductTypes.js
index 7dcadcf11..0f457bca0 100644
--- a/cypress/integration/checkout/purchaseWithProductTypes.js
+++ b/cypress/integration/checkout/purchaseWithProductTypes.js
@@ -1,33 +1,36 @@
+///
+///
+
import faker from "faker";
-import { createAttribute } from "../../apiRequests/Attribute";
-import { createCategory } from "../../apiRequests/Category";
+import { createAttribute } from "../../support/api/requests/Attribute";
+import { createCategory } from "../../support/api/requests/Category";
import {
checkoutShippingAddressUpdate,
checkoutShippingMethodUpdate,
checkoutVariantsUpdate,
completeCheckout,
createCheckout
-} from "../../apiRequests/Checkout";
-import { getOrder } from "../../apiRequests/Order";
-import { createTypeProduct } from "../../apiRequests/productType";
-import filterTests from "../../support/filterTests";
-import { getDefaultChannel } from "../../utils/channelsUtils";
+} from "../../support/api/requests/Checkout";
+import { getOrder } from "../../support/api/requests/Order";
+import { createTypeProduct } from "../../support/api/requests/ProductType";
+import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import {
addPayment,
createAndCompleteCheckoutWithoutShipping,
createWaitingForCaptureOrder
-} from "../../utils/ordersUtils";
+} from "../../support/api/utils/ordersUtils";
import {
createProductInChannel,
deleteProductsStartsWith
-} from "../../utils/products/productsUtils";
+} from "../../support/api/utils/products/productsUtils";
import {
createShipping,
deleteShippingStartsWith
-} from "../../utils/shippingUtils";
+} from "../../support/api/utils/shippingUtils";
+import filterTests from "../../support/filterTests";
-filterTests(["all", "critical"], () => {
+filterTests({ definedTags: ["all", "critical"] }, () => {
describe("Purchase products with all products types", () => {
const startsWith = `CyPurchaseByType`;
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/checkout/stocksInCheckout.js b/cypress/integration/checkout/stocksInCheckout.js
index 03fc8d087..b1624d728 100644
--- a/cypress/integration/checkout/stocksInCheckout.js
+++ b/cypress/integration/checkout/stocksInCheckout.js
@@ -1,24 +1,27 @@
+///
+///
+
import faker from "faker";
import {
addProductsToCheckout,
createCheckout
-} from "../../apiRequests/Checkout";
-import { getVariants } from "../../apiRequests/Product";
-import filterTests from "../../support/filterTests";
-import { getDefaultChannel } from "../../utils/channelsUtils";
-import { createOrderWithNewProduct } from "../../utils/ordersUtils";
+} from "../../support/api/requests/Checkout";
+import { getVariants } from "../../support/api/requests/Product";
+import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
+import { createOrderWithNewProduct } from "../../support/api/utils/ordersUtils";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith
-} from "../../utils/products/productsUtils";
+} from "../../support/api/utils/products/productsUtils";
import {
createShipping,
deleteShippingStartsWith
-} from "../../utils/shippingUtils";
+} from "../../support/api/utils/shippingUtils";
+import filterTests from "../../support/filterTests";
-filterTests(["all", "critical"], () => {
+filterTests({ definedTags: ["all", "critical"] }, () => {
describe("Products stocks in checkout", () => {
const startsWith = "CyStocksCheckout-";
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/checkout/warehouses.js b/cypress/integration/checkout/warehouses.js
index c5162305c..74aab6788 100644
--- a/cypress/integration/checkout/warehouses.js
+++ b/cypress/integration/checkout/warehouses.js
@@ -1,19 +1,22 @@
+///
+///
+
import faker from "faker";
-import { createCheckout } from "../../apiRequests/Checkout";
-import filterTests from "../../support/filterTests";
-import { getDefaultChannel } from "../../utils/channelsUtils";
+import { createCheckout } from "../../support/api/requests/Checkout";
+import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith
-} from "../../utils/products/productsUtils";
+} from "../../support/api/utils/products/productsUtils";
import {
createShipping,
deleteShippingStartsWith
-} from "../../utils/shippingUtils";
+} from "../../support/api/utils/shippingUtils";
+import filterTests from "../../support/filterTests";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Warehouses in checkout", () => {
const startsWith = `CyWarehouseCheckout`;
let defaultChannel;
diff --git a/cypress/integration/configuration/attributes/attributes.js b/cypress/integration/configuration/attributes/attributes.js
index ca4b2a2b9..c77689c85 100644
--- a/cypress/integration/configuration/attributes/attributes.js
+++ b/cypress/integration/configuration/attributes/attributes.js
@@ -1,16 +1,17 @@
-//
+///
+///
import faker from "faker";
-import { getAttribute } from "../../../apiRequests/Attribute";
import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list";
-import { createAttributeWithInputType } from "../../../steps/attributesSteps";
+import { urlList } from "../../../fixtures/urlList";
+import { getAttribute } from "../../../support/api/requests/Attribute";
+import { deleteAttributesStartsWith } from "../../../support/api/utils/attributes/attributeUtils";
+import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData";
import filterTests from "../../../support/filterTests";
-import { urlList } from "../../../url/urlList";
-import { deleteAttributesStartsWith } from "../../../utils/attributes/attributeUtils";
-import { expectCorrectDataInAttribute } from "../../../utils/attributes/checkAttributeData";
+import { createAttributeWithInputType } from "../../../support/pages/attributesPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Create attribute with type", () => {
const startsWith = "AttrCreate";
const attributesTypes = [
diff --git a/cypress/integration/configuration/attributes/contentAttribute.js b/cypress/integration/configuration/attributes/contentAttribute.js
index c4c31ba68..55a1be047 100644
--- a/cypress/integration/configuration/attributes/contentAttribute.js
+++ b/cypress/integration/configuration/attributes/contentAttribute.js
@@ -1,15 +1,18 @@
+///
+///
+
import faker from "faker";
-import { getAttribute } from "../../../apiRequests/Attribute";
import { ATTRIBUTES_DETAILS } from "../../../elements/attribute/attributes_details";
import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list";
-import { createAttributeWithInputType } from "../../../steps/attributesSteps";
+import { urlList } from "../../../fixtures/urlList";
+import { getAttribute } from "../../../support/api/requests/Attribute";
+import { deleteAttributesStartsWith } from "../../../support/api/utils/attributes/attributeUtils";
+import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData";
import filterTests from "../../../support/filterTests";
-import { urlList } from "../../../url/urlList";
-import { deleteAttributesStartsWith } from "../../../utils/attributes/attributeUtils";
-import { expectCorrectDataInAttribute } from "../../../utils/attributes/checkAttributeData";
+import { createAttributeWithInputType } from "../../../support/pages/attributesPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Create content attribute", () => {
const startsWith = "AttrCont";
const attributesTypes = [
diff --git a/cypress/integration/configuration/attributes/filters.js b/cypress/integration/configuration/attributes/filters.js
index b74d780c2..e3a18e060 100644
--- a/cypress/integration/configuration/attributes/filters.js
+++ b/cypress/integration/configuration/attributes/filters.js
@@ -1,57 +1,69 @@
-import { updateAttribute } from "../../../apiRequests/Attribute";
-import { createProduct } from "../../../apiRequests/Product";
-import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
-import { enterAttributeAndChanegeIsFilterableInDashbord } from "../../../steps/attributesSteps";
+///
+///
+
+import {
+ getElementByDataTestId,
+ SHARED_ELEMENTS
+} from "../../../elements/shared/sharedElements";
+import { updateAttribute } from "../../../support/api/requests/Attribute";
+import { createProduct } from "../../../support/api/requests/Product";
+import {
+ createTypeAttributeAndCategoryForProduct,
+ deleteProductsStartsWith
+} from "../../../support/api/utils/products/productsUtils";
+import filterTests from "../../../support/filterTests";
+import { enterAttributeAndChanegeIsFilterableInDashbord } from "../../../support/pages/attributesPage";
import {
enterProductListPage,
selectAttributeFilter,
showFilters
-} from "../../../steps/catalog/products/productsListSteps";
-import {
- createTypeAttributeAndCategoryForProduct,
- deleteProductsStartsWith
-} from "../../../utils/products/productsUtils";
+} from "../../../support/pages/catalog/products/productsListPage";
-describe("Tests for using attributes in filters", () => {
- const startsWith = "AttrFilter";
+filterTests({ definedTags: ["all"] }, () => {
+ describe("Tests for using attributes in filters", () => {
+ const startsWith = "AttrFilter";
- let attribute;
+ let attribute;
- before(() => {
- cy.clearSessionData().loginUserViaRequest();
- deleteProductsStartsWith(startsWith);
- createTypeAttributeAndCategoryForProduct(startsWith, [startsWith]).then(
- ({ attribute: attributeResp, category, productType }) => {
- attribute = attributeResp;
- createProduct({
- attributeId: attribute.id,
- attributeValue: startsWith,
- categoryId: category.id,
- productTypeId: productType.id,
- name: startsWith
- });
- }
- );
- });
-
- it("should use attribute as filter", () => {
- updateAttribute({
- attributeId: attribute.id,
- filterableInDashboard: false
+ before(() => {
+ cy.clearSessionData().loginUserViaRequest();
+ deleteProductsStartsWith(startsWith);
+ createTypeAttributeAndCategoryForProduct(startsWith, [startsWith]).then(
+ ({ attribute: attributeResp, category, productType }) => {
+ attribute = attributeResp;
+ createProduct({
+ attributeId: attribute.id,
+ attributeValue: startsWith,
+ categoryId: category.id,
+ productTypeId: productType.id,
+ name: startsWith
+ });
+ }
+ );
});
- enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
- enterProductListPage();
- selectAttributeFilter(attribute.slug, attribute.name);
- cy.contains(SHARED_ELEMENTS.tableRow, attribute.name).should("be.visible");
- });
- it("should remove attribute from filters", () => {
- updateAttribute({ attributeId: attribute.id, filterableInDashboard: true });
- enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
- enterProductListPage();
- showFilters();
- cy.contains(SHARED_ELEMENTS.filters.filterRow, attribute.name).should(
- "not.exist"
- );
+ it("should use attribute as filter", () => {
+ updateAttribute({
+ attributeId: attribute.id,
+ filterableInDashboard: false
+ });
+ enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
+ enterProductListPage();
+ selectAttributeFilter(attribute.slug, attribute.name);
+ cy.contains(SHARED_ELEMENTS.tableRow, attribute.name).should(
+ "be.visible"
+ );
+ });
+
+ it("should remove attribute from filters", () => {
+ updateAttribute({
+ attributeId: attribute.id,
+ filterableInDashboard: true
+ });
+ enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
+ enterProductListPage();
+ showFilters();
+ cy.get(getElementByDataTestId(attribute.name)).should("not.exist");
+ });
});
});
diff --git a/cypress/integration/configuration/channels.js b/cypress/integration/configuration/channels/channels.js
similarity index 71%
rename from cypress/integration/configuration/channels.js
rename to cypress/integration/configuration/channels/channels.js
index aa8723b5c..7aa1eb37d 100644
--- a/cypress/integration/configuration/channels.js
+++ b/cypress/integration/configuration/channels/channels.js
@@ -1,27 +1,27 @@
-//
+///
+///
import faker from "faker";
-import { createChannel } from "../../apiRequests/Channels";
+import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list";
+import { ADD_CHANNEL_FORM_SELECTORS } from "../../../elements/channels/add-channel-form-selectors";
+import { AVAILABLE_CHANNELS_FORM } from "../../../elements/channels/available-channels-form";
+import { CHANNELS_SELECTORS } from "../../../elements/channels/channels-selectors";
+import { SELECT_CHANNELS_TO_ASSIGN } from "../../../elements/channels/select-channels-to-assign";
+import { HEADER_SELECTORS } from "../../../elements/header/header-selectors";
+import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
+import { urlList } from "../../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
+import { createChannel } from "../../../support/api/requests/Channels";
import {
createShippingZone,
getShippingZone
-} from "../../apiRequests/ShippingMethod";
-import { ONE_PERMISSION_USERS } from "../../Data/users";
-import { PRODUCTS_LIST } from "../../elements/catalog/products/products-list";
-import { ADD_CHANNEL_FORM_SELECTORS } from "../../elements/channels/add-channel-form-selectors";
-import { AVAILABLE_CHANNELS_FORM } from "../../elements/channels/available-channels-form";
-import { CHANNELS_SELECTORS } from "../../elements/channels/channels-selectors";
-import { SELECT_CHANNELS_TO_ASSIGN } from "../../elements/channels/select-channels-to-assign";
-import { HEADER_SELECTORS } from "../../elements/header/header-selectors";
-import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
-import { createChannelByView } from "../../steps/channelsSteps";
-import { waitForProgressBarToNotExist } from "../../steps/shared/progressBar";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-import { deleteChannelsStartsWith } from "../../utils/channelsUtils";
-import { deleteShippingStartsWith } from "../../utils/shippingUtils";
+} from "../../../support/api/requests/ShippingMethod";
+import { deleteChannelsStartsWith } from "../../../support/api/utils/channelsUtils";
+import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
+import filterTests from "../../../support/filterTests";
+import { createChannelByView } from "../../../support/pages/channelsPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Channels", () => {
const channelStartsWith = `CyChannels`;
const randomName = `${channelStartsWith} ${faker.datatype.number()}`;
@@ -50,9 +50,9 @@ filterTests(["all"], () => {
cy.addAliasToGraphRequest("Channels");
cy.visit(urlList.channels);
cy.softExpectSkeletonIsVisible();
- cy.wait("@Channels");
+ cy.waitForRequestAndCheckIfNoErrors("@Channels");
createChannelByView({ name: randomChannel, currency });
- cy.wait("@Channel");
+ cy.waitForRequestAndCheckIfNoErrors("@Channel");
// New channel should be visible in channels list
cy.get(ADD_CHANNEL_FORM_SELECTORS.backToChannelsList)
@@ -71,11 +71,12 @@ filterTests(["all"], () => {
// new channel should be visible at product availability form
cy.clearSessionData().loginUserViaRequest();
cy.addAliasToGraphRequest("InitialProductFilterAttributes");
- cy.visit(urlList.products);
- cy.wait("@InitialProductFilterAttributes");
- waitForProgressBarToNotExist();
- cy.get(PRODUCTS_LIST.emptyProductRow).should("not.exist");
- cy.get(PRODUCTS_LIST.productsList)
+ cy.visit(urlList.products)
+ .waitForRequestAndCheckIfNoErrors("@InitialProductFilterAttributes")
+ .waitForProgressBarToNotExist()
+ .get(PRODUCTS_LIST.emptyProductRow)
+ .should("not.exist")
+ .get(PRODUCTS_LIST.productsList)
.first()
.click()
.get(AVAILABLE_CHANNELS_FORM.menageChannelsButton)
@@ -98,7 +99,7 @@ filterTests(["all"], () => {
currency,
shippingZone: shippingZone.name
});
- cy.wait("@Channel");
+ cy.waitForRequestAndCheckIfNoErrors("@Channel");
getShippingZone(shippingZone.id).then(shippingZoneResp => {
const assignedChannel = shippingZoneResp.channels.find(
channel => channel.name === randomChannel
@@ -154,7 +155,7 @@ filterTests(["all"], () => {
.click();
cy.addAliasToGraphRequest("Channels");
cy.get(BUTTON_SELECTORS.submit).click();
- cy.wait("@Channels");
+ cy.waitForRequestAndCheckIfNoErrors("@Channels");
cy.get(CHANNELS_SELECTORS.channelName)
.contains(randomChannelToDelete)
diff --git a/cypress/integration/configuration/inactiveChannel.js b/cypress/integration/configuration/channels/inactiveChannel.js
similarity index 81%
rename from cypress/integration/configuration/inactiveChannel.js
rename to cypress/integration/configuration/channels/inactiveChannel.js
index da9075e76..e22c20acb 100644
--- a/cypress/integration/configuration/inactiveChannel.js
+++ b/cypress/integration/configuration/channels/inactiveChannel.js
@@ -1,26 +1,31 @@
-//
+///
+///
+
import faker from "faker";
-import { activateChannel, createChannel } from "../../apiRequests/Channels";
-import { createCheckout } from "../../apiRequests/Checkout";
-import { getProductDetails } from "../../apiRequests/storeFront/ProductDetails";
-import { CHANNEL_FORM_SELECTORS } from "../../elements/channels/channel-form-selectors";
-import { DRAFT_ORDER_SELECTORS } from "../../elements/orders/draft-order-selectors";
-import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
+import { CHANNEL_FORM_SELECTORS } from "../../../elements/channels/channel-form-selectors";
+import { DRAFT_ORDER_SELECTORS } from "../../../elements/orders/draft-order-selectors";
+import { ORDERS_SELECTORS } from "../../../elements/orders/orders-selectors";
+import { urlList } from "../../../fixtures/urlList";
+import {
+ activateChannel,
+ createChannel
+} from "../../../support/api/requests/Channels";
+import { createCheckout } from "../../../support/api/requests/Checkout";
+import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails";
import {
deleteChannelsStartsWith,
getDefaultChannel
-} from "../../utils/channelsUtils";
+} from "../../../support/api/utils/channelsUtils";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith
-} from "../../utils/products/productsUtils";
-import { isProductVisible } from "../../utils/storeFront/storeFrontProductUtils";
+} from "../../../support/api/utils/products/productsUtils";
+import { isProductVisible } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
+import filterTests from "../../../support/filterTests";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Tests on inactive channel", () => {
const channelStartsWith = `InactiveChannel`;
const randomName = `${channelStartsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/configuration/customer.js b/cypress/integration/configuration/customer.js
index 96fba9b7c..1be7be359 100644
--- a/cypress/integration/configuration/customer.js
+++ b/cypress/integration/configuration/customer.js
@@ -1,17 +1,18 @@
+///
+///
+
import faker from "faker";
-import { getCustomer } from "../../apiRequests/Customer";
-import { ONE_PERMISSION_USERS } from "../../Data/users";
import { CUSTOMER_DETAILS } from "../../elements/customer/customer-details";
import { CUSTOMERS_LIST } from "../../elements/customer/customers-list";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
-import { fillUpAddressForm } from "../../steps/shared/addressForm";
-import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
+import { urlList } from "../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../fixtures/users";
+import { getCustomer } from "../../support/api/requests/Customer";
import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Tests for customer", () => {
const channelStartsWith = `Customers`;
@@ -37,15 +38,15 @@ filterTests(["all"], () => {
.fixture("addresses")
.then(({ usAddress }) => {
address = usAddress;
- fillUpAddressForm(address);
+ cy.fillUpAddressForm(address);
})
.get(CUSTOMER_DETAILS.noteInput)
.type(note)
.addAliasToGraphRequest("CreateCustomer")
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- cy.wait("@CreateCustomer")
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@CreateCustomer")
.its("response.body.data.customerCreate.user")
.then(customer => {
getCustomer(customer.id);
diff --git a/cypress/integration/configuration/navigation.js b/cypress/integration/configuration/navigation.js
index 32e54758d..db721300e 100644
--- a/cypress/integration/configuration/navigation.js
+++ b/cypress/integration/configuration/navigation.js
@@ -1,18 +1,21 @@
+///
+///
+
import faker from "faker";
import {
createMenu as createMenuViaApi,
getMenu
-} from "../../apiRequests/Menu";
+} from "../../support/api/requests/Menu";
+import { deleteMenusStartsWith } from "../../support/api/utils/navigationUtils";
+import filterTests from "../../support/filterTests";
import {
createMenu,
createNewMenuItem,
MENU_ITEM_TYPES
-} from "../../steps/navigationSteps";
-import filterTests from "../../support/filterTests";
-import { deleteMenusStartsWith } from "../../utils/navigationUtils";
+} from "../../support/pages/navigationPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Tests for menu navigation", () => {
const startsWith = "Navigation";
const randomName = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/configuration/permissions.js b/cypress/integration/configuration/permissions.js
index cc1c94c2b..f9a6e197d 100644
--- a/cypress/integration/configuration/permissions.js
+++ b/cypress/integration/configuration/permissions.js
@@ -1,25 +1,27 @@
+///
+///
+
import faker from "faker";
-import {
- createPermissionGroup,
- getPermissionGroup
-} from "../../apiRequests/PermissionGroup.js";
-import { getStaffMembersStartsWith } from "../../apiRequests/StaffMembers";
-import { TEST_ADMIN_USER } from "../../Data/users.js";
import { PERMISSION_GROUP_DETAILS } from "../../elements/permissionGroup/permissionGroupDetails";
import { PERMISSION_GROUP_LIST } from "../../elements/permissionGroup/permissionGroupsList";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
-import { waitForProgressBarToNotExist } from "../../steps/shared/progressBar.js";
-import filterTests from "../../support/filterTests.js";
import {
permissionGroupDetails,
staffMemberDetailsUrl,
urlList
-} from "../../url/urlList";
-import { deletePermissionGroupsStartsWith } from "../../utils/permissionGroupUtils.js";
+} from "../../fixtures/urlList";
+import { TEST_ADMIN_USER } from "../../fixtures/users.js";
+import {
+ createPermissionGroup,
+ getPermissionGroup
+} from "../../support/api/requests/PermissionGroup.js";
+import { getStaffMembersStartsWith } from "../../support/api/requests/StaffMembers";
+import { deletePermissionGroupsStartsWith } from "../../support/api/utils/permissionGroupUtils.js";
+import filterTests from "../../support/filterTests.js";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Permissions groups", () => {
const startsWith = "CyPermissions-";
@@ -51,8 +53,8 @@ filterTests(["all"], () => {
.get(PERMISSION_GROUP_DETAILS.assignMemberButton)
.should("be.visible")
.get(BUTTON_SELECTORS.back)
- .click();
- waitForProgressBarToNotExist();
+ .click()
+ .waitForProgressBarToNotExist();
cy.contains(
PERMISSION_GROUP_LIST.permissionGroupRow,
permissionName
@@ -110,7 +112,7 @@ filterTests(["all"], () => {
.addAliasToGraphRequest("PermissionGroupUpdate")
.get(BUTTON_SELECTORS.confirm)
.click()
- .wait("@PermissionGroupUpdate");
+ .waitForRequestAndCheckIfNoErrors("@PermissionGroupUpdate");
getPermissionGroup(group.id);
})
.then(resp => {
@@ -141,7 +143,7 @@ filterTests(["all"], () => {
.addAliasToGraphRequest("PermissionGroupUpdate")
.get(BUTTON_SELECTORS.confirm)
.click()
- .wait("@PermissionGroupUpdate");
+ .waitForRequestAndCheckIfNoErrors("@PermissionGroupUpdate");
cy.visit(staffMemberDetailsUrl(staffMember.id));
cy.get(SHARED_ELEMENTS.header).should("be.visible");
cy.contains(permissionName).should("not.exist");
diff --git a/cypress/integration/adyen.js b/cypress/integration/configuration/plugins/adyen.js
similarity index 91%
rename from cypress/integration/adyen.js
rename to cypress/integration/configuration/plugins/adyen.js
index 5a890ad64..035b4ca4e 100644
--- a/cypress/integration/adyen.js
+++ b/cypress/integration/configuration/plugins/adyen.js
@@ -1,25 +1,28 @@
+///
+///
+
import faker from "faker";
import {
addShippingMethod,
completeCheckout,
createCheckout
-} from "../apiRequests/Checkout";
-import { getOrder } from "../apiRequests/Order";
-import filterTests from "../support/filterTests";
-import { getDefaultChannel } from "../utils/channelsUtils";
-import { addAdyenPayment } from "../utils/ordersUtils";
+} from "../../../support/api/requests/Checkout";
+import { getOrder } from "../../../support/api/requests/Order";
+import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
+import { addAdyenPayment } from "../../../support/api/utils/ordersUtils";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith
-} from "../utils/products/productsUtils";
+} from "../../../support/api/utils/products/productsUtils";
import {
createShipping,
deleteShippingStartsWith
-} from "../utils/shippingUtils";
+} from "../../../support/api/utils/shippingUtils";
+import filterTests from "../../../support/filterTests";
-filterTests(["stagedOnly"], () => {
+filterTests({ definedTags: ["stagedOnly"] }, () => {
describe("Adyen payments", () => {
const startsWith = "CyChannelInDraftOrders-";
const name = startsWith + faker.datatype.number();
diff --git a/cypress/integration/plugins.js b/cypress/integration/configuration/plugins/plugins.js
similarity index 69%
rename from cypress/integration/plugins.js
rename to cypress/integration/configuration/plugins/plugins.js
index 58d4ca468..50c98e5ab 100644
--- a/cypress/integration/plugins.js
+++ b/cypress/integration/configuration/plugins/plugins.js
@@ -1,21 +1,23 @@
+///
+///
+
import faker from "faker";
-import { createChannel } from "../apiRequests/Channels";
+import { PLUGINS_DETAILS } from "../../../elements/plugins/pluginDetails";
+import { PLUGINS_LIST } from "../../../elements/plugins/pluginsList";
+import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
+import { urlList } from "../../../fixtures/urlList";
+import { createChannel } from "../../../support/api/requests/Channels";
import {
customerRegistration,
deleteCustomersStartsWith,
requestPasswordReset
-} from "../apiRequests/Customer";
-import { PLUGINS_DETAILS } from "../elements/plugins/pluginDetails";
-import { PLUGINS_LIST } from "../elements/plugins/pluginsList";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages";
-import filterTests from "../support/filterTests";
-import { urlList } from "../url/urlList";
-import { getDefaultChannel } from "../utils/channelsUtils";
-import { getMailsForUser } from "../utils/users";
+} from "../../../support/api/requests/Customer";
+import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
+import { getMailsForUser } from "../../../support/api/utils/users";
+import filterTests from "../../../support/filterTests";
-filterTests(["stagedOnly"], () => {
+filterTests({ definedTags: ["stagedOnly"], version: "3.1.1" }, () => {
describe("Plugins", () => {
const startsWith = "Plugins";
const randomName = `${startsWith}${faker.datatype.number()}`;
@@ -43,8 +45,8 @@ filterTests(["stagedOnly"], () => {
.get(PLUGINS_DETAILS.accountConfirmationSubjectInput)
.clearAndType(randomName)
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
+ .click()
+ .confirmationMessageShouldDisappear();
customerRegistration({
email: customerEmail,
channel: defaultChannel.slug
@@ -66,8 +68,8 @@ filterTests(["stagedOnly"], () => {
.clear()
.clearAndType(randomName)
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
+ .click()
+ .confirmationMessageShouldDisappear();
requestPasswordReset(Cypress.env("USER_NAME"), defaultChannel.slug)
.then(() => {
getMailsForUser(customerEmail);
diff --git a/cypress/integration/configuration/productTypes.js b/cypress/integration/configuration/productTypes.js
index 767160fcc..ac4f9ba2c 100644
--- a/cypress/integration/configuration/productTypes.js
+++ b/cypress/integration/configuration/productTypes.js
@@ -1,20 +1,20 @@
+///
+///
+
import faker from "faker";
-import { createAttribute } from "../../apiRequests/Attribute";
+import { PRODUCT_TYPE_DETAILS } from "../../elements/productTypes/productTypeDetails";
+import { productTypeDetailsUrl, urlList } from "../../fixtures/urlList";
+import { createAttribute } from "../../support/api/requests/Attribute";
import {
createTypeProduct,
getProductType
-} from "../../apiRequests/productType";
-import { PRODUCT_TYPE_DETAILS } from "../../elements/productTypes/productTypeDetails";
-import { createProductType } from "../../steps/productTypeSteps";
-import { assignElements } from "../../steps/shared/assignElements";
-import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
-import { visitAndWaitForProgressBarToDisappear } from "../../steps/shared/progressBar";
+} from "../../support/api/requests/ProductType";
+import { deleteProductsStartsWith } from "../../support/api/utils/products/productsUtils";
import filterTests from "../../support/filterTests";
-import { productTypeDetailsUrl, urlList } from "../../url/urlList";
-import { deleteProductsStartsWith } from "../../utils/products/productsUtils";
+import { createProductType } from "../../support/pages/productTypePage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Tests for product types", () => {
const startsWith = "ProductType";
@@ -64,15 +64,15 @@ filterTests(["all"], () => {
createTypeProduct({ name })
.then(productType => {
- visitAndWaitForProgressBarToDisappear(
+ cy.visitAndWaitForProgressBarToDisappear(
productTypeDetailsUrl(productType.id)
)
.get(PRODUCT_TYPE_DETAILS.assignProductAttributeButton)
- .click();
- cy.addAliasToGraphRequest("AssignProductAttribute");
- assignElements(startsWith, false);
- confirmationMessageShouldDisappear();
- cy.wait("@AssignProductAttribute");
+ .click()
+ .addAliasToGraphRequest("AssignProductAttribute")
+ .assignElements(startsWith, false)
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@AssignProductAttribute");
getProductType(productType.id);
})
.then(productType => {
@@ -85,17 +85,17 @@ filterTests(["all"], () => {
createTypeProduct({ name, hasVariants: false })
.then(productType => {
- visitAndWaitForProgressBarToDisappear(
+ cy.visitAndWaitForProgressBarToDisappear(
productTypeDetailsUrl(productType.id)
)
.get(PRODUCT_TYPE_DETAILS.hasVariantsButton)
.click()
.get(PRODUCT_TYPE_DETAILS.assignVariantAttributeButton)
- .click();
- cy.addAliasToGraphRequest("AssignProductAttribute");
- assignElements(startsWith, false);
- confirmationMessageShouldDisappear();
- cy.wait("@AssignProductAttribute");
+ .click()
+ .addAliasToGraphRequest("AssignProductAttribute")
+ .assignElements(startsWith, false)
+ .confirmationMessageShouldDisappear()
+ .wait("@AssignProductAttribute");
getProductType(productType.id);
})
.then(productType => {
diff --git a/cypress/integration/configuration/shippingMethods/channelsInShipping.js b/cypress/integration/configuration/shippingMethods/channelsInShipping.js
index c913ea647..9c49de49e 100644
--- a/cypress/integration/configuration/shippingMethods/channelsInShipping.js
+++ b/cypress/integration/configuration/shippingMethods/channelsInShipping.js
@@ -1,27 +1,25 @@
-//
+///
+///
+
import faker from "faker";
-import { createChannel } from "../../../apiRequests/Channels";
-import {
- addChannelToShippingMethod,
- addChannelToShippingZone
-} from "../../../apiRequests/ShippingMethod";
-import { ONE_PERMISSION_USERS } from "../../../Data/users";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
import { SHIPPING_ZONE_DETAILS } from "../../../elements/shipping/shipping-zone-details";
-import { enterHomePageChangeChannelAndReturn } from "../../../steps/channelsSteps";
+import { urlList } from "../../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
+import { createChannel } from "../../../support/api/requests/Channels";
import {
- waitForProgressBarToNotBeVisible,
- waitForProgressBarToNotExist
-} from "../../../steps/shared/progressBar";
+ addChannelToShippingMethod,
+ addChannelToShippingZone
+} from "../../../support/api/requests/ShippingMethod";
+import * as channelsUtils from "../../../support/api/utils/channelsUtils";
+import * as shippingUtils from "../../../support/api/utils/shippingUtils";
import filterTests from "../../../support/filterTests";
-import { getCurrencyAndAmountInString } from "../../../support/format/formatCurrencyAmount";
-import { urlList } from "../../../url/urlList";
-import * as channelsUtils from "../../../utils/channelsUtils";
-import * as shippingUtils from "../../../utils/shippingUtils";
+import { getCurrencyAndAmountInString } from "../../../support/formatData/formatCurrencyAmount";
+import { enterHomePageChangeChannelAndReturn } from "../../../support/pages/channelsPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Channels in shippingMethod", () => {
const startsWith = "ChannelShippingMethod";
let defaultChannel;
@@ -90,23 +88,25 @@ filterTests(["all"], () => {
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping)
.visit(urlList.shippingMethods)
.get(SHARED_ELEMENTS.header)
- .should("be.visible");
- waitForProgressBarToNotExist();
- cy.addAliasToGraphRequest("ShippingZone");
- cy.getTextFromElement(SHARED_ELEMENTS.table);
+ .should("be.visible")
+ .waitForProgressBarToNotExist()
+ .addAliasToGraphRequest("ShippingZone")
+ .getTextFromElement(SHARED_ELEMENTS.table);
})
.then(tableText => {
if (!tableText.includes(shippingZone.name)) {
cy.get(BUTTON_SELECTORS.nextPaginationButton).click();
}
- cy.contains(shippingZone.name).click();
- cy.wait("@ShippingZone");
+ cy.contains(shippingZone.name)
+ .click()
+ .waitForRequestAndCheckIfNoErrors("@ShippingZone");
enterHomePageChangeChannelAndReturn(defaultChannel.name);
- waitForProgressBarToNotBeVisible();
- cy.get(SHARED_ELEMENTS.skeleton).should("not.exist");
- cy.getTextFromElement(
- SHIPPING_ZONE_DETAILS.shippingRatePriceTableCell
- )
+ cy.waitForProgressBarToNotBeVisible()
+ .get(SHARED_ELEMENTS.skeleton)
+ .should("not.exist")
+ .getTextFromElement(
+ SHIPPING_ZONE_DETAILS.shippingRatePriceTableCell
+ )
.then(text => {
const expectedValue = getCurrencyAndAmountInString(
defaultChannelPrice,
@@ -115,8 +115,9 @@ filterTests(["all"], () => {
expect(text).to.be.eq(expectedValue);
enterHomePageChangeChannelAndReturn(createdChannel.name);
- waitForProgressBarToNotBeVisible();
- cy.get(SHARED_ELEMENTS.skeleton).should("not.exist");
+ cy.waitForProgressBarToNotBeVisible()
+ .get(SHARED_ELEMENTS.skeleton)
+ .should("not.exist");
})
.then(() => {
cy.getTextFromElement(
diff --git a/cypress/integration/configuration/shippingMethods/createShippingMethod.js b/cypress/integration/configuration/shippingMethods/createShippingMethod.js
index f1129df44..d0f10e436 100644
--- a/cypress/integration/configuration/shippingMethods/createShippingMethod.js
+++ b/cypress/integration/configuration/shippingMethods/createShippingMethod.js
@@ -1,22 +1,24 @@
-//
+///
+///
+
import faker from "faker";
-import { createCheckout } from "../../../apiRequests/Checkout";
-import { createWarehouse } from "../../../apiRequests/Warehouse";
-import { ONE_PERMISSION_USERS } from "../../../Data/users";
+import { urlList } from "../../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
+import { createCheckout } from "../../../support/api/requests/Checkout";
+import { createWarehouse } from "../../../support/api/requests/Warehouse";
+import * as channelsUtils from "../../../support/api/utils/channelsUtils";
+import * as productsUtils from "../../../support/api/utils/products/productsUtils";
+import * as shippingUtils from "../../../support/api/utils/shippingUtils";
+import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils";
+import filterTests from "../../../support/filterTests";
import {
createShippingRate,
createShippingZone,
rateOptions
-} from "../../../steps/shippingMethodSteps";
-import filterTests from "../../../support/filterTests";
-import { urlList } from "../../../url/urlList";
-import * as channelsUtils from "../../../utils/channelsUtils";
-import * as productsUtils from "../../../utils/products/productsUtils";
-import * as shippingUtils from "../../../utils/shippingUtils";
-import { isShippingAvailableInCheckout } from "../../../utils/storeFront/checkoutUtils";
+} from "../../../support/pages/shippingMethodPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Create shipping method", () => {
const startsWith = "CreateShippingMethods-";
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/configuration/shippingMethods/postalCodes.js b/cypress/integration/configuration/shippingMethods/postalCodes.js
index 08ff31bdd..c161921d5 100644
--- a/cypress/integration/configuration/shippingMethods/postalCodes.js
+++ b/cypress/integration/configuration/shippingMethods/postalCodes.js
@@ -1,26 +1,28 @@
-//
+///
+///
+
import faker from "faker";
-import { createCheckout } from "../../../apiRequests/Checkout";
-import { createShippingZone } from "../../../apiRequests/ShippingMethod";
-import { createWarehouse } from "../../../apiRequests/Warehouse";
-import { ONE_PERMISSION_USERS } from "../../../Data/users";
-import {
- createRateWithPostalCode,
- postalCodesOptions
-} from "../../../steps/shippingMethodSteps";
-import filterTests from "../../../support/filterTests";
-import { shippingZoneDetailsUrl } from "../../../url/urlList";
-import { getDefaultChannel } from "../../../utils/channelsUtils";
+import { shippingZoneDetailsUrl } from "../../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
+import { createCheckout } from "../../../support/api/requests/Checkout";
+import { createShippingZone } from "../../../support/api/requests/ShippingMethod";
+import { createWarehouse } from "../../../support/api/requests/Warehouse";
+import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith
-} from "../../../utils/products/productsUtils";
-import { deleteShippingStartsWith } from "../../../utils/shippingUtils";
-import { isShippingAvailableInCheckout } from "../../../utils/storeFront/checkoutUtils";
+} from "../../../support/api/utils/products/productsUtils";
+import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
+import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils";
+import filterTests from "../../../support/filterTests";
+import {
+ createRateWithPostalCode,
+ postalCodesOptions
+} from "../../../support/pages/shippingMethodPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Postal codes in shipping", () => {
const startsWith = "CyShippingMethods-";
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/configuration/shippingMethods/shippingWeights/shippingWeightsLimits.js b/cypress/integration/configuration/shippingMethods/shippingWeights/shippingWeightsLimits.js
index 21052c8c6..58ce52e45 100644
--- a/cypress/integration/configuration/shippingMethods/shippingWeights/shippingWeightsLimits.js
+++ b/cypress/integration/configuration/shippingMethods/shippingWeights/shippingWeightsLimits.js
@@ -1,26 +1,28 @@
-//
+///
+///
+
import faker from "faker";
-import { createCheckout } from "../../../../apiRequests/Checkout";
-import { createShippingZone } from "../../../../apiRequests/ShippingMethod";
-import { createWarehouse } from "../../../../apiRequests/Warehouse";
-import { ONE_PERMISSION_USERS } from "../../../../Data/users";
-import {
- createShippingRate,
- rateOptions
-} from "../../../../steps/shippingMethodSteps";
-import filterTests from "../../../../support/filterTests";
-import { shippingZoneDetailsUrl } from "../../../../url/urlList";
-import { getDefaultChannel } from "../../../../utils/channelsUtils";
+import { shippingZoneDetailsUrl } from "../../../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../../../fixtures/users";
+import { createCheckout } from "../../../../support/api/requests/Checkout";
+import { createShippingZone } from "../../../../support/api/requests/ShippingMethod";
+import { createWarehouse } from "../../../../support/api/requests/Warehouse";
+import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith
-} from "../../../../utils/products/productsUtils";
-import { deleteShippingStartsWith } from "../../../../utils/shippingUtils";
-import { isShippingAvailableInCheckout } from "../../../../utils/storeFront/checkoutUtils";
+} from "../../../../support/api/utils/products/productsUtils";
+import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils";
+import { isShippingAvailableInCheckout } from "../../../../support/api/utils/storeFront/checkoutUtils";
+import filterTests from "../../../../support/filterTests";
+import {
+ createShippingRate,
+ rateOptions
+} from "../../../../support/pages/shippingMethodPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Shipping weight limits", () => {
const startsWith = "CyWeightRates-";
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/configuration/shippingMethods/shippingWeights/weightRecalculate.js b/cypress/integration/configuration/shippingMethods/shippingWeights/weightRecalculate.js
index babc7d577..e1b85e575 100644
--- a/cypress/integration/configuration/shippingMethods/shippingWeights/weightRecalculate.js
+++ b/cypress/integration/configuration/shippingMethods/shippingWeights/weightRecalculate.js
@@ -1,22 +1,23 @@
-//
+///
+///
+
import faker from "faker";
+import { SHARED_ELEMENTS } from "../../../../elements/shared/sharedElements";
+import { SHIPPING_RATE_DETAILS } from "../../../../elements/shipping/shipping-rate-details";
+import { urlList, weightRateUrl } from "../../../../fixtures/urlList";
import {
createShippingRate as createShippingRateViaApi,
createShippingZone
-} from "../../../../apiRequests/ShippingMethod";
-import { updateShopWeightUnit } from "../../../../apiRequests/shopSettings";
-import { SHARED_ELEMENTS } from "../../../../elements/shared/sharedElements";
-import { SHIPPING_RATE_DETAILS } from "../../../../elements/shipping/shipping-rate-details";
-import { waitForProgressBarToNotBeVisible } from "../../../../steps/shared/progressBar";
-import { changeWeightUnit } from "../../../../steps/shippingMethodSteps";
+} from "../../../../support/api/requests/ShippingMethod";
+import { updateShopWeightUnit } from "../../../../support/api/requests/ShopSettings";
+import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils";
+import { deleteProductsStartsWith } from "../../../../support/api/utils/products/productsUtils";
+import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils";
import filterTests from "../../../../support/filterTests";
-import { urlList, weightRateUrl } from "../../../../url/urlList";
-import { getDefaultChannel } from "../../../../utils/channelsUtils";
-import { deleteProductsStartsWith } from "../../../../utils/products/productsUtils";
-import { deleteShippingStartsWith } from "../../../../utils/shippingUtils";
+import { changeWeightUnit } from "../../../../support/pages/shippingMethodPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Recalculate weights", () => {
const startsWith = "RecalculateWeight";
const name = `${startsWith}${faker.datatype.number()}`;
@@ -83,7 +84,7 @@ filterTests(["all"], () => {
const rate = shippingMethods.find(
element => element.id === shippingMethod.id
);
- waitForProgressBarToNotBeVisible();
+ cy.waitForProgressBarToNotBeVisible();
expect(rate.minimumOrderWeight.unit).to.eq("G");
cy.get(SHIPPING_RATE_DETAILS.minWeightInput).invoke("val");
})
diff --git a/cypress/integration/configuration/siteSettings.js b/cypress/integration/configuration/siteSettings.js
index 892e44cc9..057d4828d 100644
--- a/cypress/integration/configuration/siteSettings.js
+++ b/cypress/integration/configuration/siteSettings.js
@@ -1,14 +1,18 @@
+///
+///
+
import faker from "faker";
-import { getShopInfo, updateShopAddress } from "../../apiRequests/shopSettings";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SITE_SETTINGS_DETAILS } from "../../elements/siteSettings/site-settings-details";
-import { fillUpBasicAddress } from "../../steps/shared/addressForm";
-import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
+import { urlList } from "../../fixtures/urlList";
+import {
+ getShopInfo,
+ updateShopAddress
+} from "../../support/api/requests/ShopSettings";
import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Tests for site settings", () => {
let address;
@@ -33,8 +37,8 @@ filterTests(["all"], () => {
cy.get(SITE_SETTINGS_DETAILS.nameInput)
.clearAndType(name)
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
+ .click()
+ .confirmationMessageShouldDisappear();
getShopInfo().then(shopInfo => {
expect(shopInfo.name).to.eq(name);
});
@@ -46,8 +50,8 @@ filterTests(["all"], () => {
cy.get(SITE_SETTINGS_DETAILS.urlInput)
.clearAndType(url)
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
+ .click()
+ .confirmationMessageShouldDisappear();
getShopInfo().then(shopInfo => {
expect(shopInfo.domain.host).to.eq(url);
});
@@ -59,17 +63,18 @@ filterTests(["all"], () => {
cy.get(SITE_SETTINGS_DETAILS.descriptionInput)
.clearAndType(description)
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
+ .click()
+ .confirmationMessageShouldDisappear();
getShopInfo().then(shopInfo => {
expect(shopInfo.description).to.eq(description);
});
});
it("should change store address", () => {
- fillUpBasicAddress(address);
- cy.get(BUTTON_SELECTORS.confirm).click();
- confirmationMessageShouldDisappear();
+ cy.fillUpBasicAddress(address)
+ .get(BUTTON_SELECTORS.confirm)
+ .click()
+ .confirmationMessageShouldDisappear();
getShopInfo().then(({ companyAddress }) => {
expect(companyAddress.companyName).to.eq(address.companyName);
cy.expectCorrectBasicAddress(companyAddress, address);
diff --git a/cypress/integration/configuration/translations.js b/cypress/integration/configuration/translations.js
index cb866671a..078d7618f 100644
--- a/cypress/integration/configuration/translations.js
+++ b/cypress/integration/configuration/translations.js
@@ -1,17 +1,21 @@
+///
+///
+
import faker from "faker";
-import { createCategory, getCategory } from "../../apiRequests/Category";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { ELEMENT_TRANSLATION } from "../../elements/translations/element-translation";
import { LANGUAGES_LIST } from "../../elements/translations/languages-list";
-import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
-import { findElementOnTable } from "../../steps/shared/tables";
+import { urlList } from "../../fixtures/urlList";
+import {
+ createCategory,
+ getCategory
+} from "../../support/api/requests/Category";
+import { deleteCategoriesStartsWith } from "../../support/api/utils/categoryUtils";
import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-import { deleteCategoriesStartsWith } from "../../utils/categoryUtils";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"], version: "3.1.1" }, () => {
describe("Tests for translations", () => {
const startsWith = "Translations";
const randomNumber = faker.datatype.number();
@@ -32,8 +36,8 @@ filterTests(["all"], () => {
it("should create translation", () => {
cy.visit(urlList.translations)
.get(LANGUAGES_LIST.polishLanguageButton)
- .click();
- findElementOnTable(category.name);
+ .click()
+ .findElementOnTable(category.name);
cy.get(ELEMENT_TRANSLATION.editNameButton)
.click()
.get(SHARED_ELEMENTS.skeleton)
@@ -41,9 +45,9 @@ filterTests(["all"], () => {
.get(ELEMENT_TRANSLATION.translationInputField)
.type(`TranslatedName${randomNumber}`)
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- cy.get(ELEMENT_TRANSLATION.editDescriptionButton)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .get(ELEMENT_TRANSLATION.editDescriptionButton)
.click()
.get(SHARED_ELEMENTS.richTextEditor.loader)
.should("not.exist")
@@ -51,22 +55,22 @@ filterTests(["all"], () => {
.type(`TranslatedDescription${randomNumber}`)
.wait(500)
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- cy.get(ELEMENT_TRANSLATION.editSeoTitleButton)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .get(ELEMENT_TRANSLATION.editSeoTitleButton)
.click()
.get(ELEMENT_TRANSLATION.translationInputField)
.type(`TranslatedSeoTitle${randomNumber}`)
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- cy.get(ELEMENT_TRANSLATION.editSeoDescriptionButton)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .get(ELEMENT_TRANSLATION.editSeoDescriptionButton)
.click()
.get(ELEMENT_TRANSLATION.translationInputField)
.type(`TranslatedSeoDescription${randomNumber}`)
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
+ .click()
+ .confirmationMessageShouldDisappear();
getCategory(category.id, "PL").then(({ translation }) => {
expect(translation.name).to.eq(`TranslatedName${randomNumber}`);
expect(translation.description).to.includes(
diff --git a/cypress/integration/configuration/warehouse.js b/cypress/integration/configuration/warehouse.js
index 06605dabc..f7145adba 100644
--- a/cypress/integration/configuration/warehouse.js
+++ b/cypress/integration/configuration/warehouse.js
@@ -1,24 +1,27 @@
-//
+///
+///
+
import faker from "faker";
-import { createShippingZone } from "../../apiRequests/ShippingMethod";
-import { createWarehouse, getWarehouse } from "../../apiRequests/Warehouse";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHIPPING_ZONE_DETAILS } from "../../elements/shipping/shipping-zone-details";
import { WAREHOUSES_DETAILS } from "../../elements/warehouses/warehouse-details";
import { WAREHOUSES_LIST } from "../../elements/warehouses/warehouses-list";
-import { fillUpBasicAddress } from "../../steps/shared/addressForm";
-import { fillAutocompleteSelect } from "../../steps/shared/selects";
-import filterTests from "../../support/filterTests";
import {
shippingZoneDetailsUrl,
urlList,
warehouseDetailsUrl
-} from "../../url/urlList";
-import { getDefaultChannel } from "../../utils/channelsUtils";
-import { deleteShippingStartsWith } from "../../utils/shippingUtils";
+} from "../../fixtures/urlList";
+import { createShippingZone } from "../../support/api/requests/ShippingMethod";
+import {
+ createWarehouse,
+ getWarehouse
+} from "../../support/api/requests/Warehouse";
+import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
+import { deleteShippingStartsWith } from "../../support/api/utils/shippingUtils";
+import filterTests from "../../support/filterTests";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Warehouse settings", () => {
const startsWith = "CyWarehouse";
let usAddress;
@@ -39,13 +42,14 @@ filterTests(["all"], () => {
const name = `${startsWith}${faker.datatype.number()}`;
cy.visit(urlList.warehouses)
.get(WAREHOUSES_LIST.createNewButton)
- .click();
- cy.get(WAREHOUSES_DETAILS.nameInput).type(name);
- fillUpBasicAddress(usAddress);
- cy.addAliasToGraphRequest("WarehouseCreate")
+ .click()
+ .get(WAREHOUSES_DETAILS.nameInput)
+ .type(name)
+ .fillUpBasicAddress(usAddress)
+ .addAliasToGraphRequest("WarehouseCreate")
.get(BUTTON_SELECTORS.confirm)
.click()
- .wait("@WarehouseCreate")
+ .waitForRequestAndCheckIfNoErrors("@WarehouseCreate")
.its("response.body.data.createWarehouse.warehouse")
.then(warehouse => {
getWarehouse(warehouse.id);
@@ -77,15 +81,15 @@ filterTests(["all"], () => {
})
.then(shippingZoneResp => {
shippingZone = shippingZoneResp;
- cy.visit(shippingZoneDetailsUrl(shippingZone.id));
- fillAutocompleteSelect(
- SHIPPING_ZONE_DETAILS.warehouseSelector,
- warehouse.name
- );
- cy.addAliasToGraphRequest("UpdateShippingZone")
+ cy.visit(shippingZoneDetailsUrl(shippingZone.id))
+ .fillAutocompleteSelect(
+ SHIPPING_ZONE_DETAILS.warehouseSelector,
+ warehouse.name
+ )
+ .addAliasToGraphRequest("UpdateShippingZone")
.get(BUTTON_SELECTORS.confirm)
.click()
- .wait("@UpdateShippingZone");
+ .waitForRequestAndCheckIfNoErrors("@UpdateShippingZone");
getWarehouse(warehouse.id);
})
.then(warehouseResp => {
@@ -107,7 +111,7 @@ filterTests(["all"], () => {
.addAliasToGraphRequest("WarehouseDelete")
.get(BUTTON_SELECTORS.submit)
.click()
- .wait("@WarehouseDelete");
+ .waitForRequestAndCheckIfNoErrors("@WarehouseDelete");
getWarehouse(warehouse.id).should("be.null");
});
});
diff --git a/cypress/integration/customerRegistration.js b/cypress/integration/customerRegistration.js
index a310a33c8..a92d8724e 100644
--- a/cypress/integration/customerRegistration.js
+++ b/cypress/integration/customerRegistration.js
@@ -1,17 +1,19 @@
+///
+///
+
import faker from "faker";
+import { CUSTOMER_DETAILS } from "../elements/customers/customer-details";
+import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
+import { customerDetailsUrl } from "../fixtures/urlList";
import {
confirmAccount,
customerRegistration,
deleteCustomersStartsWith
-} from "../apiRequests/Customer";
-import { CUSTOMER_DETAILS } from "../elements/customers/customer-details";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages";
+} from "../support/api/requests/Customer";
+import { getDefaultChannel } from "../support/api/utils/channelsUtils";
+import { getMailActivationLinkForUser } from "../support/api/utils/users";
import filterTests from "../support/filterTests";
-import { customerDetailsUrl } from "../url/urlList";
-import { getDefaultChannel } from "../utils/channelsUtils";
-import { getMailActivationLinkForUser } from "../utils/users";
describe("Tests for customer registration", () => {
const startsWith = "Registration";
@@ -27,7 +29,7 @@ describe("Tests for customer registration", () => {
});
});
- filterTests(["stagedOnly"], () => {
+ filterTests({ definedTags: ["stagedOnly"] }, () => {
it("should register customer", () => {
const email = `${startsWith}${faker.datatype.number()}@example.com`;
customerRegistration({ email, channel: defaultChannel.slug });
@@ -72,9 +74,9 @@ describe("Tests for customer registration", () => {
.get(CUSTOMER_DETAILS.isActiveCheckbox)
.click()
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- cy.clearSessionData()
+ .click()
+ .confirmationMessageShouldDisappear()
+ .clearSessionData()
.loginUserViaRequest("token", {
email,
password: Cypress.env("USER_PASSWORD")
diff --git a/cypress/integration/discounts/sales.js b/cypress/integration/discounts/sales.js
index 61f360329..e7cf022bb 100644
--- a/cypress/integration/discounts/sales.js
+++ b/cypress/integration/discounts/sales.js
@@ -1,26 +1,27 @@
-//
+///
+///
import faker from "faker";
-import { createChannel } from "../../apiRequests/Channels";
-import { updateChannelInProduct } from "../../apiRequests/Product";
+import { urlList } from "../../fixtures/urlList";
+import { createChannel } from "../../support/api/requests/Channels";
+import { updateChannelInProduct } from "../../support/api/requests/Product";
+import * as channelsUtils from "../../support/api/utils/channelsUtils";
+import { deleteSalesStartsWith } from "../../support/api/utils/discounts/salesUtils";
+import * as productsUtils from "../../support/api/utils/products/productsUtils";
+import {
+ createShipping,
+ deleteShippingStartsWith
+} from "../../support/api/utils/shippingUtils";
+import { getProductPrice } from "../../support/api/utils/storeFront/storeFrontProductUtils";
+import filterTests from "../../support/filterTests";
import {
assignProducts,
createSale,
discountOptions
-} from "../../steps/discounts/salesSteps";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-import * as channelsUtils from "../../utils/channelsUtils";
-import { deleteSalesStartsWith } from "../../utils/discounts/salesUtils";
-import * as productsUtils from "../../utils/products/productsUtils";
-import {
- createShipping,
- deleteShippingStartsWith
-} from "../../utils/shippingUtils";
-import { getProductPrice } from "../../utils/storeFront/storeFrontProductUtils";
+} from "../../support/pages/discounts/salesPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Sales discounts", () => {
const startsWith = "CySales-";
diff --git a/cypress/integration/discounts/vouchers.js b/cypress/integration/discounts/vouchers.js
index eba0deda1..a41b8b33e 100644
--- a/cypress/integration/discounts/vouchers.js
+++ b/cypress/integration/discounts/vouchers.js
@@ -1,24 +1,26 @@
-//
+///
+///
+
import faker from "faker";
-import { createChannel } from "../../apiRequests/Channels";
-import { ONE_PERMISSION_USERS } from "../../Data/users";
-import {
- createVoucher,
- discountOptions
-} from "../../steps/discounts/vouchersSteps";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-import * as channelsUtils from "../../utils/channelsUtils";
-import { deleteVouchersStartsWith } from "../../utils/discounts/vouchersUtils";
-import { createCheckoutWithVoucher } from "../../utils/ordersUtils";
-import * as productsUtils from "../../utils/products/productsUtils";
+import { urlList } from "../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../fixtures/users";
+import { createChannel } from "../../support/api/requests/Channels";
+import * as channelsUtils from "../../support/api/utils/channelsUtils";
+import { deleteVouchersStartsWith } from "../../support/api/utils/discounts/vouchersUtils";
+import { createCheckoutWithVoucher } from "../../support/api/utils/ordersUtils";
+import * as productsUtils from "../../support/api/utils/products/productsUtils";
import {
createShipping,
deleteShippingStartsWith
-} from "../../utils/shippingUtils";
+} from "../../support/api/utils/shippingUtils";
+import filterTests from "../../support/filterTests";
+import {
+ createVoucher,
+ discountOptions
+} from "../../support/pages/discounts/vouchersPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Vouchers discounts", () => {
const startsWith = "CyVou-";
const productPrice = 100;
diff --git a/cypress/integration/homePage/homePage.js b/cypress/integration/homePage/homePage.js
index b29dec296..709d10d9b 100644
--- a/cypress/integration/homePage/homePage.js
+++ b/cypress/integration/homePage/homePage.js
@@ -1,9 +1,12 @@
-import { TEST_ADMIN_USER, USER_WITHOUT_NAME } from "../../Data/users";
-import { expectWelcomeMessageIncludes } from "../../steps/homePageSteps";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
+///
+///
-filterTests(["all"], () => {
+import { urlList } from "../../fixtures/urlList";
+import { TEST_ADMIN_USER, USER_WITHOUT_NAME } from "../../fixtures/users";
+import filterTests from "../../support/filterTests";
+import { expectWelcomeMessageIncludes } from "../../support/pages/homePage";
+
+filterTests({ definedTags: ["all"] }, () => {
describe("Displaying welcome message on home page", () => {
it("should display user name on home page", () => {
cy.loginUserViaRequest();
diff --git a/cypress/integration/homePage/homePageAnalitics.js b/cypress/integration/homePage/homePageAnalitics.js
index 337e02de6..8ad4b3f5e 100644
--- a/cypress/integration/homePage/homePageAnalitics.js
+++ b/cypress/integration/homePage/homePageAnalitics.js
@@ -1,25 +1,28 @@
+///
+///
+
import faker from "faker";
+import { HOMEPAGE_SELECTORS } from "../../elements/homePage/homePage-selectors";
+import { urlList } from "../../fixtures/urlList";
import {
createCustomer,
deleteCustomersStartsWith
-} from "../../apiRequests/Customer";
-import { HOMEPAGE_SELECTORS } from "../../elements/homePage/homePage-selectors";
-import { changeChannel } from "../../steps/homePageSteps";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-import { getDefaultChannel } from "../../utils/channelsUtils";
-import * as homePageUtils from "../../utils/homePageUtils";
+} from "../../support/api/requests/Customer";
+import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
+import * as homePageUtils from "../../support/api/utils/homePageUtils";
import {
createReadyToFulfillOrder,
createWaitingForCaptureOrder
-} from "../../utils/ordersUtils";
-import * as productsUtils from "../../utils/products/productsUtils";
-import * as shippingUtils from "../../utils/shippingUtils";
+} from "../../support/api/utils/ordersUtils";
+import * as productsUtils from "../../support/api/utils/products/productsUtils";
+import * as shippingUtils from "../../support/api/utils/shippingUtils";
+import filterTests from "../../support/filterTests";
+import { changeChannel } from "../../support/pages/homePage";
//
-filterTests(["all", "critical"], () => {
+filterTests({ definedTags: ["all", "critical"] }, () => {
describe("Homepage analytics", () => {
const startsWith = "CyHomeAnalytics";
diff --git a/cypress/integration/login_form.js b/cypress/integration/login.js
similarity index 87%
rename from cypress/integration/login_form.js
rename to cypress/integration/login.js
index e98623dfa..3445e6406 100644
--- a/cypress/integration/login_form.js
+++ b/cypress/integration/login.js
@@ -1,9 +1,11 @@
-//
-import { LOGIN_SELECTORS } from "../elements/account/login-selectors";
-import filterTests from "../support/filterTests";
-import { urlList } from "../url/urlList";
+///
+///
-filterTests(["all"], () => {
+import { LOGIN_SELECTORS } from "../elements/account/login-selectors";
+import { urlList } from "../fixtures/urlList";
+import filterTests from "../support/filterTests";
+
+filterTests({ definedTags: ["all"] }, () => {
describe("User authorization", () => {
beforeEach(() => {
cy.clearSessionData();
diff --git a/cypress/integration/metadata.js b/cypress/integration/metadata.js
index ad0569e36..8853b1479 100644
--- a/cypress/integration/metadata.js
+++ b/cypress/integration/metadata.js
@@ -1,16 +1,21 @@
+///
+///
import faker from "faker";
-import { updateMetadata, updatePrivateMetadata } from "../apiRequests/Metadata";
-import { createDraftOrder, getOrder } from "../apiRequests/Order";
-import { getProductMetadata } from "../apiRequests/storeFront/ProductDetails";
-import filterTests from "../support/filterTests";
-import { getDefaultChannel } from "../utils/channelsUtils";
+import {
+ updateMetadata,
+ updatePrivateMetadata
+} from "../support/api/requests/Metadata";
+import { createDraftOrder, getOrder } from "../support/api/requests/Order";
+import { getProductMetadata } from "../support/api/requests/storeFront/ProductDetails";
+import { getDefaultChannel } from "../support/api/utils/channelsUtils";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct
-} from "../utils/products/productsUtils";
+} from "../support/api/utils/products/productsUtils";
+import filterTests from "../support/filterTests";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Test for metadata", () => {
const startsWith = "Metadata";
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/navigation.js b/cypress/integration/navigation.js
index 7683958cb..d0386cd30 100644
--- a/cypress/integration/navigation.js
+++ b/cypress/integration/navigation.js
@@ -1,11 +1,14 @@
-import { PERMISSIONS_OPTIONS } from "../Data/permissionsUsers";
-import * as permissionsSteps from "../steps/permissions";
+///
+///
+
+import { PERMISSIONS_OPTIONS } from "../fixtures/permissionsUsers";
import filterTests from "../support/filterTests";
+import * as permissionsSteps from "../support/pages/permissionsPage";
describe("Navigation for users with different permissions", () => {
Object.keys(PERMISSIONS_OPTIONS).forEach(key => {
const tags = key === "all" ? ["critical", "all"] : ["all"];
- filterTests(tags, () => {
+ filterTests({ definedTags: tags }, () => {
it(`should navigate as an user with ${key} permission`, () => {
const permissionOption = PERMISSIONS_OPTIONS[key];
const permissions = permissionOption.permissions;
diff --git a/cypress/integration/orders/channelsInDraftOrders.js b/cypress/integration/orders/channelsInDraftOrders.js
index 109e94ef1..b245fd15b 100644
--- a/cypress/integration/orders/channelsInDraftOrders.js
+++ b/cypress/integration/orders/channelsInDraftOrders.js
@@ -1,20 +1,22 @@
-//
+///
+///
+
import faker from "faker";
-import { createChannel } from "../../apiRequests/Channels";
import { CHANNEL_FORM_SELECTORS } from "../../elements/channels/channel-form-selectors";
import { HEADER_SELECTORS } from "../../elements/header/header-selectors";
import { DRAFT_ORDER_SELECTORS } from "../../elements/orders/draft-order-selectors";
import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
+import { urlList } from "../../fixtures/urlList";
+import { createChannel } from "../../support/api/requests/Channels";
+import * as channelsUtils from "../../support/api/utils/channelsUtils";
+import filterTests from "../../support/filterTests";
import {
selectChannelInHeader,
selectChannelInPicker
-} from "../../steps/channelsSteps";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-import * as channelsUtils from "../../utils/channelsUtils";
+} from "../../support/pages/channelsPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Channels in draft orders", () => {
const startsWith = "CyChannelInDraftOrders-";
const randomName = startsWith + faker.datatype.number();
diff --git a/cypress/integration/orders/draftOrders.js b/cypress/integration/orders/draftOrders.js
index 472e5f7b6..916805196 100644
--- a/cypress/integration/orders/draftOrders.js
+++ b/cypress/integration/orders/draftOrders.js
@@ -1,25 +1,27 @@
-//
+///
+///
+
import faker from "faker";
+import { DRAFT_ORDERS_LIST_SELECTORS } from "../../elements/orders/draft-orders-list-selectors";
+import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
+import { urlList } from "../../fixtures/urlList";
import {
createCustomer,
deleteCustomersStartsWith
-} from "../../apiRequests/Customer";
-import { updateOrdersSettings } from "../../apiRequests/Order";
-import { DRAFT_ORDERS_LIST_SELECTORS } from "../../elements/orders/draft-orders-list-selectors";
-import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
-import { selectChannelInPicker } from "../../steps/channelsSteps";
-import { finalizeDraftOrder } from "../../steps/draftOrderSteps";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-import { getDefaultChannel } from "../../utils/channelsUtils";
-import * as productsUtils from "../../utils/products/productsUtils";
+} from "../../support/api/requests/Customer";
+import { updateOrdersSettings } from "../../support/api/requests/Order";
+import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
+import * as productsUtils from "../../support/api/utils/products/productsUtils";
import {
createShipping,
deleteShippingStartsWith
-} from "../../utils/shippingUtils";
+} from "../../support/api/utils/shippingUtils";
+import filterTests from "../../support/filterTests";
+import { selectChannelInPicker } from "../../support/pages/channelsPage";
+import { finalizeDraftOrder } from "../../support/pages/draftOrderPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Draft orders", () => {
const startsWith = "CyDraftOrders-";
const randomName = startsWith + faker.datatype.number();
diff --git a/cypress/integration/orders/orders.js b/cypress/integration/orders/orders.js
index 03b6b8ceb..34c74bd4e 100644
--- a/cypress/integration/orders/orders.js
+++ b/cypress/integration/orders/orders.js
@@ -1,34 +1,38 @@
-//
+///
+///
+
import faker from "faker";
-import {
- createCustomer,
- deleteCustomersStartsWith
-} from "../../apiRequests/Customer";
-import { getOrder, updateOrdersSettings } from "../../apiRequests/Order";
-import { ONE_PERMISSION_USERS } from "../../Data/users";
import { ORDER_REFUND } from "../../elements/orders/order-refund";
import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
-import { selectChannelInPicker } from "../../steps/channelsSteps";
-import { finalizeDraftOrder } from "../../steps/draftOrderSteps";
-import { fillAutocompleteSelect } from "../../steps/shared/selects";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-import { getDefaultChannel } from "../../utils/channelsUtils";
+import { urlList } from "../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../fixtures/users";
+import {
+ createCustomer,
+ deleteCustomersStartsWith
+} from "../../support/api/requests/Customer";
+import {
+ getOrder,
+ updateOrdersSettings
+} from "../../support/api/requests/Order";
+import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import {
createFulfilledOrder,
createOrder,
createReadyToFulfillOrder
-} from "../../utils/ordersUtils";
-import * as productsUtils from "../../utils/products/productsUtils";
+} from "../../support/api/utils/ordersUtils";
+import * as productsUtils from "../../support/api/utils/products/productsUtils";
import {
createShipping,
deleteShippingStartsWith
-} from "../../utils/shippingUtils";
+} from "../../support/api/utils/shippingUtils";
+import filterTests from "../../support/filterTests";
+import { selectChannelInPicker } from "../../support/pages/channelsPage";
+import { finalizeDraftOrder } from "../../support/pages/draftOrderPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Orders", () => {
const startsWith = "CyOrders-";
const randomName = startsWith + faker.datatype.number();
@@ -160,16 +164,15 @@ filterTests(["all"], () => {
cy.get(SHARED_ELEMENTS.skeleton)
.should("not.exist")
.get(ORDERS_SELECTORS.cancelFulfillment)
- .click();
- })
- .then(() => {
- fillAutocompleteSelect(
- ORDERS_SELECTORS.cancelFulfillmentSelectField,
- warehouse.name
- );
- cy.addAliasToGraphRequest("OrderFulfillmentCancel");
- cy.get(BUTTON_SELECTORS.submit).click();
- cy.wait("@OrderFulfillmentCancel");
+ .click()
+ .fillAutocompleteSelect(
+ ORDERS_SELECTORS.cancelFulfillmentSelectField,
+ warehouse.name
+ )
+ .addAliasToGraphRequest("OrderFulfillmentCancel")
+ .get(BUTTON_SELECTORS.submit)
+ .click()
+ .waitForRequestAndCheckIfNoErrors("@OrderFulfillmentCancel");
getOrder(order.id);
})
.then(orderResp => {
@@ -198,7 +201,9 @@ filterTests(["all"], () => {
.addAliasToGraphRequest("OrderFulfillmentRefundProducts");
cy.get(BUTTON_SELECTORS.submit)
.click()
- .wait("@OrderFulfillmentRefundProducts");
+ .waitForRequestAndCheckIfNoErrors(
+ "@OrderFulfillmentRefundProducts"
+ );
getOrder(order.id);
})
.then(orderResp => {
diff --git a/cypress/integration/pages/pageTypes.js b/cypress/integration/pages/pageTypes.js
index 2ea5674d5..e80cf672c 100644
--- a/cypress/integration/pages/pageTypes.js
+++ b/cypress/integration/pages/pageTypes.js
@@ -1,17 +1,21 @@
+///
+///
+
import faker from "faker";
-import { createAttribute } from "../../apiRequests/Attribute";
-import { createPageType, getPageType } from "../../apiRequests/PageTypes";
import { PAGE_TYPE_DETAILS } from "../../elements/pageTypes/pageTypeDetails";
import { PAGE_TYPES_LIST } from "../../elements/pageTypes/pageTypesList";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
-import { assignElements } from "../../steps/shared/assignElements";
-import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
+import { pageTypeDetailsUrl, urlList } from "../../fixtures/urlList";
+import { createAttribute } from "../../support/api/requests/Attribute";
+import {
+ createPageType,
+ getPageType
+} from "../../support/api/requests/PageType";
import filterTests from "../../support/filterTests";
-import { pageTypeDetailsUrl, urlList } from "../../url/urlList";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Tests for page types", () => {
const startsWith = "PageTypes";
@@ -29,9 +33,9 @@ filterTests(["all"], () => {
.type(randomName)
.addAliasToGraphRequest("PageTypeCreate")
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- cy.wait("@PageTypeCreate")
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@PageTypeCreate")
.its("response.body.data.pageTypeCreate.pageType")
.then(pageType => {
getPageType(pageType.id);
@@ -51,9 +55,9 @@ filterTests(["all"], () => {
.get(SHARED_ELEMENTS.progressBar)
.should("be.not.visible")
.get(PAGE_TYPE_DETAILS.assignAttributesButton)
- .click();
- assignElements(randomName, false);
- confirmationMessageShouldDisappear();
+ .click()
+ .assignElements(randomName, false)
+ .confirmationMessageShouldDisappear();
getPageType(pageType.id);
})
.then(pageType => {
diff --git a/cypress/integration/pages/pages.js b/cypress/integration/pages/pages.js
index 771536e7a..813d81d75 100644
--- a/cypress/integration/pages/pages.js
+++ b/cypress/integration/pages/pages.js
@@ -1,103 +1,113 @@
+///
+///
+
import faker from "faker";
-import { createAttribute } from "../../apiRequests/Attribute";
-import { getPage } from "../../apiRequests/Page";
-import { createPageType } from "../../apiRequests/PageTypes";
-import { attributesTypes, createPage } from "../../steps/pageSteps";
-import { deleteAttributesStartsWith } from "../../utils/attributes/attributeUtils";
-import { deletePageTypesStartsWith } from "../../utils/pageTypeUtils";
+import { createAttribute } from "../../support/api/requests/Attribute";
+import { getPage } from "../../support/api/requests/Page";
+import { createPageType } from "../../support/api/requests/PageType";
+import { deleteAttributesStartsWith } from "../../support/api/utils/attributes/attributeUtils";
+import { deletePageTypesStartsWith } from "../../support/api/utils/pageTypeUtils";
+import filterTests from "../../support/filterTests";
+import { attributesTypes, createPage } from "../../support/pages/pagesPage";
-describe("Tests for pages", () => {
- const startsWith = `Pages`;
- const name = `${startsWith}${faker.datatype.number()}`;
- let attribute;
+filterTests({ definedTags: ["all"] }, () => {
+ describe("Tests for pages", () => {
+ const startsWith = `Pages`;
+ const name = `${startsWith}${faker.datatype.number()}`;
+ let attribute;
- const attributeValuesOnPage = {
- NUMERIC: 1,
- RICH_TEXT: faker.lorem.sentence(),
- DROPDOWN: "value",
- MULTISELECT: "value",
- BOOLEAN: true
- };
+ const attributeValuesOnPage = {
+ NUMERIC: 1,
+ RICH_TEXT: faker.lorem.sentence(),
+ DROPDOWN: "value",
+ MULTISELECT: "value",
+ BOOLEAN: true
+ };
- before(() => {
- cy.clearSessionData().loginUserViaRequest();
- deleteAttributesStartsWith(startsWith);
- deletePageTypesStartsWith(startsWith);
+ before(() => {
+ cy.clearSessionData().loginUserViaRequest();
+ deleteAttributesStartsWith(startsWith);
+ deletePageTypesStartsWith(startsWith);
- createAttribute({ name, type: "PAGE_TYPE" }).then(attributeResp => {
- attribute = attributeResp;
- createPageType({ name, attributeId: attribute.id });
- });
- });
-
- beforeEach(() => {
- cy.clearSessionData().loginUserViaRequest();
- });
-
- it("should create not published page", () => {
- const randomName = `${startsWith}${faker.datatype.number()}`;
-
- createPage({ pageName: randomName, pageTypeName: name })
- .then(page => {
- getPage(page.id);
- })
- .then(page => {
- expect(page.title).to.eq(randomName);
- expect(page.isPublished).to.be.false;
- expect(page.attributes[0].attribute.id).to.eq(attribute.id);
- getPage(page.id, "token").should("be.null");
- });
- });
-
- it("should create published page", () => {
- const randomName = `${startsWith}${faker.datatype.number()}`;
-
- createPage({ pageName: randomName, pageTypeName: name, isPublished: true })
- .then(page => {
- getPage(page.id, "token");
- })
- .then(page => {
- expect(page.title).to.eq(randomName);
- expect(page.isPublished).to.be.true;
- expect(page.attributes[0].attribute.id).to.eq(attribute.id);
- });
- });
-
- Object.keys(attributesTypes).forEach(attributeType => {
- it(`should create page with ${attributeType} attribute`, () => {
- const randomName = `${startsWith}${faker.datatype.number()}`;
- const attributeValues = [attributeValuesOnPage[attributeType]];
- createAttribute({
- name: randomName,
- type: "PAGE_TYPE",
- inputType: attributeType,
- attributeValues
- }).then(attributeResp => {
+ createAttribute({ name, type: "PAGE_TYPE" }).then(attributeResp => {
attribute = attributeResp;
- createPageType({ name: randomName, attributeId: attribute.id });
+ createPageType({ name, attributeId: attribute.id });
});
- createPage({
- pageName: randomName,
- pageTypeName: randomName,
- attributeType,
- attributeValue: attributeValuesOnPage[attributeType]
- })
+ });
+
+ beforeEach(() => {
+ cy.clearSessionData().loginUserViaRequest();
+ });
+
+ it("should create not published page", () => {
+ const randomName = `${startsWith}${faker.datatype.number()}`;
+
+ createPage({ pageName: randomName, pageTypeName: name })
.then(page => {
getPage(page.id);
})
.then(page => {
- expect(page.attributes[0].values[0].inputType).to.eq(attributeType);
- if (attributeType !== "BOOLEAN") {
- expect(page.attributes[0].values[0].name).to.eq(
- attributeValuesOnPage[attributeType].toString()
- );
- } else {
- expect(page.attributes[0].values[0].name).to.includes(
- "Yes".toString()
- );
- }
+ expect(page.title).to.eq(randomName);
+ expect(page.isPublished).to.be.false;
+ expect(page.attributes[0].attribute.id).to.eq(attribute.id);
+ getPage(page.id, "token").should("be.null");
});
});
+
+ it("should create published page", () => {
+ const randomName = `${startsWith}${faker.datatype.number()}`;
+
+ createPage({
+ pageName: randomName,
+ pageTypeName: name,
+ isPublished: true
+ })
+ .then(page => {
+ getPage(page.id, "token");
+ })
+ .then(page => {
+ expect(page.title).to.eq(randomName);
+ expect(page.isPublished).to.be.true;
+ expect(page.attributes[0].attribute.id).to.eq(attribute.id);
+ });
+ });
+
+ Object.keys(attributesTypes).forEach(attributeType => {
+ it(`should create page with ${attributeType} attribute`, () => {
+ const randomName = `${startsWith}${faker.datatype.number()}`;
+ const attributeValues = [attributeValuesOnPage[attributeType]];
+ createAttribute({
+ name: randomName,
+ type: "PAGE_TYPE",
+ inputType: attributeType,
+ attributeValues
+ }).then(attributeResp => {
+ attribute = attributeResp;
+ createPageType({ name: randomName, attributeId: attribute.id });
+ });
+ createPage({
+ pageName: randomName,
+ pageTypeName: randomName,
+ attributeType,
+ attributeValue: attributeValuesOnPage[attributeType]
+ })
+ .then(page => {
+ getPage(page.id);
+ })
+ .then(page => {
+ expect(page.attributes[0].values[0].inputType).to.eq(attributeType);
+ if (attributeType !== "BOOLEAN") {
+ expect(page.attributes[0].values[0].name).to.eq(
+ attributeValuesOnPage[attributeType].toString()
+ );
+ } else {
+ expect(page.attributes[0].values[0].name).to.includes(
+ "Yes".toString()
+ );
+ }
+ });
+ });
+ });
});
});
diff --git a/cypress/integration/products/createProduct.js b/cypress/integration/products/createProduct.js
index 82ba9f767..da1e25e54 100644
--- a/cypress/integration/products/createProduct.js
+++ b/cypress/integration/products/createProduct.js
@@ -1,30 +1,30 @@
-//
+///
+///
+
import faker from "faker";
-import { createAttribute } from "../../apiRequests/Attribute";
-import { createTypeProduct } from "../../apiRequests/productType";
-import { ONE_PERMISSION_USERS } from "../../Data/users";
import { PRODUCT_DETAILS } from "../../elements/catalog/products/product-details";
import { PRODUCTS_LIST } from "../../elements/catalog/products/products-list";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
-import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
-import { metadataForms } from "../../steps/catalog/metadataSteps";
-import {
- fillUpPriceList,
- priceInputLists
-} from "../../steps/catalog/products/priceList";
-import { fillUpCommonFieldsForAllProductTypes } from "../../steps/catalog/products/productSteps";
-import { selectChannelInDetailsPages } from "../../steps/channelsSteps";
-import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
+import { urlList } from "../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../fixtures/users";
+import { createAttribute } from "../../support/api/requests/Attribute";
+import { createTypeProduct } from "../../support/api/requests/ProductType";
import {
expectCorrectProductInformation,
expectCorrectProductVariantInformation
-} from "../../utils/products/checkProductInfo";
-import * as productUtils from "../../utils/products/productsUtils";
+} from "../../support/api/utils/products/checkProductInfo";
+import * as productUtils from "../../support/api/utils/products/productsUtils";
+import filterTests from "../../support/filterTests";
+import { metadataForms } from "../../support/pages/catalog/metadataComponent";
+import {
+ fillUpPriceList,
+ priceInputLists
+} from "../../support/pages/catalog/products/priceListComponent";
+import { fillUpCommonFieldsForAllProductTypes } from "../../support/pages/catalog/products/productDetailsPage";
+import { selectChannelInDetailsPages } from "../../support/pages/channelsPage";
-filterTests(["all", "critical"], () => {
+filterTests({ definedTags: ["all", "critical"] }, () => {
describe("Create product", () => {
const startsWith = "CyCreateProduct-";
const name = `${startsWith}${faker.datatype.number()}`;
@@ -75,11 +75,12 @@ filterTests(["all", "critical"], () => {
createTpeAndFillUpProductFields(randomName, true, productData).then(
productOrgResp => (productData.productOrganization = productOrgResp)
);
- cy.addAliasToGraphRequest("ProductDetails");
- cy.get(BUTTON_SELECTORS.confirm).click();
- confirmationMessageShouldDisappear();
- cy.wait("@ProductDetails");
- cy.get("@ProductDetails")
+ cy.addAliasToGraphRequest("ProductDetails")
+ .get(BUTTON_SELECTORS.confirm)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@ProductDetails")
+ .get("@ProductDetails")
.its("response.body")
.then(resp => {
const productResp = resp.find(element => element.data.product).data
@@ -105,12 +106,14 @@ filterTests(["all", "critical"], () => {
selectChannelInDetailsPages();
fillUpPriceList(prices.sellingPrice);
fillUpPriceList(prices.costPrice, priceInputLists.costPrice);
- cy.get(PRODUCT_DETAILS.skuInput).type(randomName);
- cy.addAliasToGraphRequest("ProductDetails");
- cy.get(BUTTON_SELECTORS.confirm).click();
- confirmationMessageShouldDisappear();
- cy.wait("@ProductDetails");
- cy.get("@ProductDetails")
+ cy.get(PRODUCT_DETAILS.skuInput)
+ .type(randomName)
+ .addAliasToGraphRequest("ProductDetails")
+ .get(BUTTON_SELECTORS.confirm)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .wait("@ProductDetails")
+ .get("@ProductDetails")
.its("response.body")
.then(resp => {
const productResp = resp.find(element => element.data.product).data
diff --git a/cypress/integration/products/menageProducts/availableForPurchaseProducts.js b/cypress/integration/products/menageProducts/availableForPurchaseProducts.js
index 9cca22ef4..f74e8385d 100644
--- a/cypress/integration/products/menageProducts/availableForPurchaseProducts.js
+++ b/cypress/integration/products/menageProducts/availableForPurchaseProducts.js
@@ -1,18 +1,19 @@
+///
+///
+
import faker from "faker";
-import { getProductDetails } from "../../../apiRequests/storeFront/ProductDetails";
-import { ONE_PERMISSION_USERS } from "../../../Data/users";
-import { updateProductIsAvailableForPurchase } from "../../../steps/catalog/products/productSteps";
+import { productDetailsUrl } from "../../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
+import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails";
+import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
+import * as productsUtils from "../../../support/api/utils/products/productsUtils";
+import * as shippingUtils from "../../../support/api/utils/shippingUtils";
+import { isProductAvailableForPurchase } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import filterTests from "../../../support/filterTests";
-import { productDetailsUrl } from "../../../url/urlList";
-import { getDefaultChannel } from "../../../utils/channelsUtils";
-import * as productsUtils from "../../../utils/products/productsUtils";
-import * as shippingUtils from "../../../utils/shippingUtils";
-import { isProductAvailableForPurchase } from "../../../utils/storeFront/storeFrontProductUtils";
+import { updateProductIsAvailableForPurchase } from "../../../support/pages/catalog/products/productDetailsPage";
-//
-
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Products available in listings", () => {
const startsWith = "CyAvailForPurchase-";
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/products/menageProducts/publishedProducts.js b/cypress/integration/products/menageProducts/publishedProducts.js
index 217871efe..89a95f1d6 100644
--- a/cypress/integration/products/menageProducts/publishedProducts.js
+++ b/cypress/integration/products/menageProducts/publishedProducts.js
@@ -1,17 +1,18 @@
+///
+///
+
import faker from "faker";
-import { getProductDetails } from "../../../apiRequests/storeFront/ProductDetails";
-import { ONE_PERMISSION_USERS } from "../../../Data/users";
-import { updateProductPublish } from "../../../steps/catalog/products/productSteps";
+import { productDetailsUrl } from "../../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
+import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails";
+import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
+import * as productsUtils from "../../../support/api/utils/products/productsUtils";
+import { isProductVisible } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import filterTests from "../../../support/filterTests";
-import { productDetailsUrl } from "../../../url/urlList";
-import { getDefaultChannel } from "../../../utils/channelsUtils";
-import * as productsUtils from "../../../utils/products/productsUtils";
-import { isProductVisible } from "../../../utils/storeFront/storeFrontProductUtils";
+import { updateProductPublish } from "../../../support/pages/catalog/products/productDetailsPage";
-//
-
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Published products", () => {
const startsWith = "CyPublishedProducts-";
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/products/menageProducts/visibleInListingsProducts.js b/cypress/integration/products/menageProducts/visibleInListingsProducts.js
index 431a6ce87..3810c09f1 100644
--- a/cypress/integration/products/menageProducts/visibleInListingsProducts.js
+++ b/cypress/integration/products/menageProducts/visibleInListingsProducts.js
@@ -1,17 +1,17 @@
+///
+///
import faker from "faker";
-import { searchInShop } from "../../../apiRequests/storeFront/Search";
-import { ONE_PERMISSION_USERS } from "../../../Data/users";
-import { updateProductVisibleInListings } from "../../../steps/catalog/products/productSteps";
+import { productDetailsUrl } from "../../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
+import { searchInShop } from "../../../support/api/requests/storeFront/Search";
+import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
+import * as productsUtils from "../../../support/api/utils/products/productsUtils";
+import { isProductVisibleInSearchResult } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import filterTests from "../../../support/filterTests";
-import { productDetailsUrl } from "../../../url/urlList";
-import { getDefaultChannel } from "../../../utils/channelsUtils";
-import * as productsUtils from "../../../utils/products/productsUtils";
-import { isProductVisibleInSearchResult } from "../../../utils/storeFront/storeFrontProductUtils";
+import { updateProductVisibleInListings } from "../../../support/pages/catalog/products/productDetailsPage";
-//
-
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Products displayed in listings", () => {
const startsWith = "CyVisibleInListings-";
const name = `${startsWith}${faker.datatype.number()}`;
diff --git a/cypress/integration/products/productsList/filteringProducts.js b/cypress/integration/products/productsList/filteringProducts.js
index 5a13f5b26..4c5666c84 100644
--- a/cypress/integration/products/productsList/filteringProducts.js
+++ b/cypress/integration/products/productsList/filteringProducts.js
@@ -1,29 +1,30 @@
+///
+///
+
import faker from "faker";
-import { createCollection } from "../../../apiRequests/Collections";
-import { updateProduct } from "../../../apiRequests/Product";
import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list";
-import {
- selectChannel,
- selectFilterOption,
- selectProductsOutOfStock
-} from "../../../steps/catalog/products/productsListSteps";
-import { waitForProgressBarToNotExist } from "../../../steps/shared/progressBar";
-import { searchInTable } from "../../../steps/shared/tables";
-import filterTests from "../../../support/filterTests";
-import { urlList } from "../../../url/urlList";
-import { getDefaultChannel } from "../../../utils/channelsUtils";
+import { urlList } from "../../../fixtures/urlList";
+import { createCollection } from "../../../support/api/requests/Collections";
+import { updateProduct } from "../../../support/api/requests/Product";
+import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith
-} from "../../../utils/products/productsUtils";
+} from "../../../support/api/utils/products/productsUtils";
import {
createShipping,
deleteShippingStartsWith
-} from "../../../utils/shippingUtils";
+} from "../../../support/api/utils/shippingUtils";
+import filterTests from "../../../support/filterTests";
+import {
+ selectChannel,
+ selectFilterOption,
+ selectProductsOutOfStock
+} from "../../../support/pages/catalog/products/productsListPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Filtering products", () => {
const startsWith = "CyFilterProducts-";
const name = `${startsWith}${faker.datatype.number()}`;
@@ -83,16 +84,17 @@ filterTests(["all"], () => {
updateProduct(product.id, { collections: [collection.id] });
});
});
+
beforeEach(() => {
cy.clearSessionData()
.loginUserViaRequest()
.visit(urlList.products);
});
+
const filterProductsBy = ["category", "collection", "productType"];
filterProductsBy.forEach(filterBy => {
it(`should filter products by ${filterBy}`, () => {
- cy.softExpectSkeletonIsVisible();
- waitForProgressBarToNotExist();
+ cy.softExpectSkeletonIsVisible().waitForProgressBarToNotExist();
selectFilterOption(filterBy, name);
cy.getTextFromElement(PRODUCTS_LIST.productsNames).then(product => {
expect(product).to.includes(name);
@@ -113,13 +115,16 @@ filterTests(["all"], () => {
categoryId: category.id,
price
});
+ cy.waitForProgressBarToNotExist();
selectChannel(channel.slug);
selectProductsOutOfStock();
- searchInTable(productOutOfStock);
- cy.get(PRODUCTS_LIST.productsNames).should("have.length", 1);
- cy.getTextFromElement(PRODUCTS_LIST.productsNames).then(product => {
- expect(product).to.includes(productOutOfStock);
- });
+ cy.searchInTable(productOutOfStock)
+ .get(PRODUCTS_LIST.productsNames)
+ .should("have.length", 1)
+ .getTextFromElement(PRODUCTS_LIST.productsNames)
+ .then(product => {
+ expect(product).to.includes(productOutOfStock);
+ });
});
});
});
diff --git a/cypress/integration/products/productsList/pagination.js b/cypress/integration/products/productsList/pagination.js
index e4075d579..ec9b69057 100644
--- a/cypress/integration/products/productsList/pagination.js
+++ b/cypress/integration/products/productsList/pagination.js
@@ -1,14 +1,16 @@
+///
+///
+
import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
+import { urlList } from "../../../fixtures/urlList";
+import filterTests from "../../../support/filterTests";
import {
getDisplayedColumnArray,
isNumberOfProductsSameAsInSelectResultsOnPage
-} from "../../../steps/catalog/products/productsListSteps";
-import { waitForProgressBarToNotExist } from "../../../steps/shared/progressBar";
-import filterTests from "../../../support/filterTests";
-import { urlList } from "../../../url/urlList";
+} from "../../../support/pages/catalog/products/productsListPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Products", () => {
beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
@@ -26,10 +28,11 @@ filterTests(["all"], () => {
getDisplayedColumnArray("name").then(
productsList => (firstPageProducts = productsList)
);
- cy.addAliasToGraphRequest("ProductList");
- cy.get(PRODUCTS_LIST.nextPageButton).click();
- waitForProgressBarToNotExist();
- cy.wait("@ProductList");
+ cy.addAliasToGraphRequest("ProductList")
+ .get(PRODUCTS_LIST.nextPageButton)
+ .click()
+ .waitForProgressBarToNotExist()
+ .wait("@ProductList");
getDisplayedColumnArray("name").then(productList => {
expect(productList).to.not.equal(firstPageProducts);
});
@@ -50,8 +53,8 @@ filterTests(["all"], () => {
`${PRODUCTS_LIST.rowNumberOption}${BUTTON_SELECTORS.notSelectedOption}`
)
.first()
- .click();
- waitForProgressBarToNotExist();
+ .click()
+ .waitForProgressBarToNotExist();
isNumberOfProductsSameAsInSelectResultsOnPage().then(
isTheSame =>
expect(
diff --git a/cypress/integration/products/productsList/sortingProducts.js b/cypress/integration/products/productsList/sortingProducts.js
index 37b1cbd0c..dbd0c29a6 100644
--- a/cypress/integration/products/productsList/sortingProducts.js
+++ b/cypress/integration/products/productsList/sortingProducts.js
@@ -1,11 +1,13 @@
+///
+///
+
import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list";
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
-import { waitForProgressBarToNotExist } from "../../../steps/shared/progressBar";
+import { urlList } from "../../../fixtures/urlList";
+import { expectProductsSortedBy } from "../../../support/api/utils/products/productsListUtils";
import filterTests from "../../../support/filterTests";
-import { urlList } from "../../../url/urlList";
-import { expectProductsSortedBy } from "../../../utils/products/productsListUtils";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Sorting products", () => {
const sortByList = ["name", "type"];
sortByList.forEach(sortBy => {
@@ -16,14 +18,16 @@ filterTests(["all"], () => {
cy.softExpectSkeletonIsVisible();
cy.get(SHARED_ELEMENTS.header).should("be.visible");
if (sortBy !== "name") {
- cy.get(PRODUCTS_LIST.tableHeaders[sortBy]).click();
- waitForProgressBarToNotExist();
+ cy.get(PRODUCTS_LIST.tableHeaders[sortBy])
+ .click()
+ .waitForProgressBarToNotExist();
}
expectProductsSortedBy(sortBy);
cy.addAliasToGraphRequest("ProductList")
.get(PRODUCTS_LIST.tableHeaders[sortBy])
- .click();
- waitForProgressBarToNotExist().wait("@ProductList");
+ .click()
+ .waitForProgressBarToNotExist()
+ .waitForRequestAndCheckIfNoErrors("@ProductList");
expectProductsSortedBy(sortBy, false);
});
});
diff --git a/cypress/integration/products/productsVariants.js b/cypress/integration/products/productsVariants.js
index 4bd4e8f1f..15894e5ac 100644
--- a/cypress/integration/products/productsVariants.js
+++ b/cypress/integration/products/productsVariants.js
@@ -1,29 +1,31 @@
+///
+///
+
import faker from "faker";
-import { createChannel } from "../../apiRequests/Channels";
+import { urlList } from "../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../fixtures/users";
+import { createChannel } from "../../support/api/requests/Channels";
import {
createProduct,
updateChannelInProduct
-} from "../../apiRequests/Product";
-import { ONE_PERMISSION_USERS } from "../../Data/users";
+} from "../../support/api/requests/Product";
+import {
+ deleteChannelsStartsWith,
+ getDefaultChannel
+} from "../../support/api/utils/channelsUtils";
+import * as productUtils from "../../support/api/utils/products/productsUtils";
+import * as shippingUtils from "../../support/api/utils/shippingUtils";
+import { getProductVariants } from "../../support/api/utils/storeFront/storeFrontProductUtils";
+import filterTests from "../../support/filterTests";
import {
createFirstVariant,
createVariant,
variantsShouldBeVisible
-} from "../../steps/catalog/products/VariantsSteps";
-import { enterHomePageChangeChannelAndReturn } from "../../steps/channelsSteps";
-import filterTests from "../../support/filterTests";
-import { urlList } from "../../url/urlList";
-import {
- deleteChannelsStartsWith,
- getDefaultChannel
-} from "../../utils/channelsUtils";
-import * as productUtils from "../../utils/products/productsUtils";
-import * as shippingUtils from "../../utils/shippingUtils";
-import { getProductVariants } from "../../utils/storeFront/storeFrontProductUtils";
-//
+} from "../../support/pages/catalog/products/VariantsPage";
+import { enterHomePageChangeChannelAndReturn } from "../../support/pages/channelsPage";
-filterTests(["all", "critical"], () => {
+filterTests({ definedTags: ["all", "critical"] }, () => {
describe("Creating variants", () => {
const startsWith = "CyCreateVariants-";
const attributeValues = ["value1", "value2"];
diff --git a/cypress/integration/products/updatingProducts.js b/cypress/integration/products/updatingProducts.js
index 5c83aa011..61748dda5 100644
--- a/cypress/integration/products/updatingProducts.js
+++ b/cypress/integration/products/updatingProducts.js
@@ -1,27 +1,28 @@
+///
+///
+
import faker from "faker";
-import { createCategory } from "../../apiRequests/Category";
-import { createCollection } from "../../apiRequests/Collections";
-import { getProductDetails } from "../../apiRequests/storeFront/ProductDetails";
-import { ONE_PERMISSION_USERS } from "../../Data/users";
import { PRODUCT_DETAILS } from "../../elements/catalog/products/product-details";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
-import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
-import { metadataForms } from "../../steps/catalog/metadataSteps";
-import { fillUpCommonFieldsForAllProductTypes } from "../../steps/catalog/products/productSteps";
-import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
-import filterTests from "../../support/filterTests";
-import { productDetailsUrl } from "../../url/urlList";
-import { getDefaultChannel } from "../../utils/channelsUtils";
-import { deleteCollectionsStartsWith } from "../../utils/collectionsUtils";
-import { expectCorrectProductInformation } from "../../utils/products/checkProductInfo";
+import { productDetailsUrl } from "../../fixtures/urlList";
+import { ONE_PERMISSION_USERS } from "../../fixtures/users";
+import { createCategory } from "../../support/api/requests/Category";
+import { createCollection } from "../../support/api/requests/Collections";
+import { getProductDetails } from "../../support/api/requests/storeFront/ProductDetails";
+import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
+import { deleteCollectionsStartsWith } from "../../support/api/utils/collectionsUtils";
+import { expectCorrectProductInformation } from "../../support/api/utils/products/checkProductInfo";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith
-} from "../../utils/products/productsUtils";
+} from "../../support/api/utils/products/productsUtils";
+import filterTests from "../../support/filterTests";
+import { metadataForms } from "../../support/pages/catalog/metadataComponent";
+import { fillUpCommonFieldsForAllProductTypes } from "../../support/pages/catalog/products/productDetailsPage";
-filterTests(["all"], () => {
+filterTests({ definedTags: ["all"] }, () => {
describe("Update products", () => {
const startsWith = "CyUpdateProducts-";
const name = `${startsWith}${faker.datatype.number()}`;
@@ -107,14 +108,15 @@ filterTests(["all"], () => {
.get(PRODUCT_DETAILS.collectionRemoveButtons)
.click();
fillUpCommonFieldsForAllProductTypes(productData, false);
- cy.addAliasToGraphRequest("UpdatePrivateMetadata");
- cy.addAliasToGraphRequest("UpdateMetadata");
- cy.addAliasToGraphRequest("ProductUpdate");
- cy.get(BUTTON_SELECTORS.confirm).click();
- confirmationMessageShouldDisappear();
- cy.wait("@ProductUpdate");
- cy.wait("@UpdateMetadata");
- cy.wait("@UpdatePrivateMetadata");
+ cy.addAliasToGraphRequest("UpdatePrivateMetadata")
+ .addAliasToGraphRequest("UpdateMetadata")
+ .addAliasToGraphRequest("ProductUpdate")
+ .get(BUTTON_SELECTORS.confirm)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@ProductUpdate")
+ .waitForRequestAndCheckIfNoErrors("@UpdateMetadata")
+ .waitForRequestAndCheckIfNoErrors("@UpdatePrivateMetadata");
productData.productOrganization.productType = name;
productData.attribute = attribute;
cy.loginUserViaRequest("token")
@@ -138,7 +140,7 @@ filterTests(["all"], () => {
.click()
.get(BUTTON_SELECTORS.submit)
.click()
- .wait("@ProductDelete")
+ .waitForRequestAndCheckIfNoErrors("@ProductDelete")
.loginUserViaRequest("token")
.then(() => {
getProductDetails(product.id, defaultChannel.slug).its("body.data");
diff --git a/cypress/integration/staffMembers.js b/cypress/integration/staffMembers.js
index 3351797f2..8002167cf 100644
--- a/cypress/integration/staffMembers.js
+++ b/cypress/integration/staffMembers.js
@@ -1,29 +1,31 @@
+///
+///
+
import faker from "faker";
-import {
- deleteStaffMembersStartsWith,
- updateStaffMember
-} from "../apiRequests/StaffMembers";
import { LEFT_MENU_SELECTORS } from "../elements/account/left-menu/left-menu-selectors";
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
import { STAFF_MEMBER_DETAILS } from "../elements/staffMembers/staffMemberDetails";
import { STAFF_MEMBERS_LIST } from "../elements/staffMembers/staffMembersList";
-import { expectWelcomeMessageIncludes } from "../steps/homePageSteps";
-import { getDisplayedSelectors } from "../steps/permissions";
-import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages";
+import { urlList, userDetailsUrl } from "../fixtures/urlList";
+import {
+ deleteStaffMembersStartsWith,
+ updateStaffMember
+} from "../support/api/requests/StaffMembers";
+import {
+ getMailActivationLinkForUser,
+ inviteStaffMemberWithFirstPermission
+} from "../support/api/utils/users";
+import filterTests from "../support/filterTests";
+import { expectWelcomeMessageIncludes } from "../support/pages/homePage";
+import { getDisplayedSelectors } from "../support/pages/permissionsPage";
import {
fillUpSetPassword,
fillUpUserDetails,
updateUserActiveFlag
-} from "../steps/user";
-import filterTests from "../support/filterTests";
-import { urlList, userDetailsUrl } from "../url/urlList";
-import {
- getMailActivationLinkForUser,
- inviteStaffMemberWithFirstPermission
-} from "../utils/users";
+} from "../support/pages/userPage";
-filterTests(["stagedOnly"], () => {
+filterTests({ definedTags: ["stagedOnly"] }, () => {
describe("Staff members", () => {
const startsWith = "StaffMembers";
const password = Cypress.env("USER_PASSWORD");
@@ -99,9 +101,9 @@ filterTests(["stagedOnly"], () => {
.click()
.addAliasToGraphRequest("StaffMemberUpdate")
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- cy.wait("@StaffMemberUpdate")
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@StaffMemberUpdate")
.clearSessionData()
.loginUserViaRequest("auth", { email, password })
.visit(urlList.homePage);
diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js
index 7a5bc3758..24e49f4ec 100644
--- a/cypress/plugins/index.js
+++ b/cypress/plugins/index.js
@@ -15,11 +15,17 @@
/**
* @type {Cypress.PluginConfig}
*/
-module.exports = (on, config) => {
+
+/* eslint-disable @typescript-eslint/no-var-requires */
+
+const graphql = require("graphql-request");
+
+module.exports = async (on, config) => {
// make env variables visible for cypress
config.env.API_URI = process.env.API_URI;
config.env.APP_MOUNT_URI = process.env.APP_MOUNT_URI;
config.env.mailHogUrl = process.env.CYPRESS_MAILHOG;
+ config.env.SHOP = await getShopInfo(process.env);
on("before:browser:launch", (browser = {}, launchOptions) => {
launchOptions.args.push("--proxy-bypass-list=<-loopback>");
@@ -27,3 +33,34 @@ module.exports = (on, config) => {
});
return config;
};
+
+function getShopInfo(envVariables) {
+ // envVariables.CYPRESS_USER_NAME
+ const variables = {
+ email: envVariables.CYPRESS_USER_NAME,
+ password: envVariables.CYPRESS_USER_PASSWORD
+ };
+
+ const createTokenMutation = graphql.gql`mutation tokenCreate($email: String!, $password: String!){
+ tokenCreate(email:$email, password:$password){
+ token
+ }
+ }`;
+
+ const getShopInfoQuery = graphql.gql`query{
+ shop{
+ version
+ }
+ }`;
+
+ const client = new graphql.GraphQLClient(envVariables.API_URI, {
+ headers: {}
+ });
+ return client.request(createTokenMutation, variables).then(data => {
+ const token = data.tokenCreate.token;
+ client.setHeader("Authorization", `JWT ${token}`);
+ return client
+ .request(getShopInfoQuery)
+ .then(shopInfo => shopInfo.shop.version);
+ });
+}
diff --git a/cypress/steps/categoriesSteps.js b/cypress/steps/categoriesSteps.js
deleted file mode 100644
index adeb27f0c..000000000
--- a/cypress/steps/categoriesSteps.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import { CATEGORY_DETAILS } from "../elements/catalog/categories/category-details";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
-
-export function createCategory({ name, description }) {
- cy.get(CATEGORY_DETAILS.nameInput)
- .type(name)
- .get(CATEGORY_DETAILS.descriptionInput)
- .type(description)
- .addAliasToGraphRequest("CategoryCreate")
- .get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- return cy.wait("@CategoryCreate");
-}
diff --git a/cypress/steps/draftOrderSteps.js b/cypress/steps/draftOrderSteps.js
deleted file mode 100644
index 0f9d6948a..000000000
--- a/cypress/steps/draftOrderSteps.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import { DRAFT_ORDER_SELECTORS } from "../elements/orders/draft-order-selectors";
-import { ASSIGN_ELEMENTS_SELECTORS } from "../elements/shared/assign-elements-selectors";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
-import { SELECT_SHIPPING_METHOD_FORM } from "../elements/shipping/select-shipping-method-form";
-import { assignElements } from "./shared/assignElements";
-
-export function finalizeDraftOrder(name, address) {
- cy.get(DRAFT_ORDER_SELECTORS.addProducts).click();
- assignElements(name);
- cy.get(DRAFT_ORDER_SELECTORS.editCustomerButton)
- .click()
- .get(DRAFT_ORDER_SELECTORS.selectCustomer)
- .type(name);
- cy.contains(DRAFT_ORDER_SELECTORS.selectCustomerOption, name)
- .click()
- .get(DRAFT_ORDER_SELECTORS.customerEmail)
- .should("be.visible")
- .get(SHARED_ELEMENTS.skeleton)
- .should("not.exist")
- .get(BUTTON_SELECTORS.submit)
- .click()
- .get(DRAFT_ORDER_SELECTORS.addShippingCarrierLink)
- .click()
- .get(SELECT_SHIPPING_METHOD_FORM.selectShippingMethod)
- .click()
- .get(SELECT_SHIPPING_METHOD_FORM.shippingMethodOption)
- .first()
- .click();
- cy.addAliasToGraphRequest("OrderShippingMethodUpdate")
- .get(SELECT_SHIPPING_METHOD_FORM.submitButton)
- .click();
- cy.wait("@OrderShippingMethodUpdate");
- cy.getTextFromElement(DRAFT_ORDER_SELECTORS.pageHeader).as(
- "draftOrderNumber"
- );
- cy.addAliasToGraphRequest("OrderDraftFinalize");
- cy.get(DRAFT_ORDER_SELECTORS.finalizeButton).click();
- cy.wait("@OrderDraftFinalize");
- return cy.get("@draftOrderNumber");
-}
diff --git a/cypress/steps/homePageSteps.js b/cypress/steps/homePageSteps.js
deleted file mode 100644
index 98349abb5..000000000
--- a/cypress/steps/homePageSteps.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import { HEADER_SELECTORS } from "../elements/header/header-selectors";
-import { HOMEPAGE_SELECTORS } from "../elements/homePage/homePage-selectors";
-
-export function changeChannel(channelName) {
- cy.get(HEADER_SELECTORS.channelSelect).click();
- cy.addAliasToGraphRequest("Home");
- cy.get(HEADER_SELECTORS.channelSelectList)
- .contains(channelName)
- .click();
- cy.wait("@Home");
-}
-
-export function expectWelcomeMessageIncludes(name) {
- cy.get(HOMEPAGE_SELECTORS.welcomeMessage)
- .invoke("text")
- .then(text => {
- expect(text, `welcome message should contains ${name}`).to.contains(name);
- });
-}
diff --git a/cypress/steps/shared/assignElements.js b/cypress/steps/shared/assignElements.js
deleted file mode 100644
index d62b2a0f4..000000000
--- a/cypress/steps/shared/assignElements.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import { ASSIGN_ELEMENTS_SELECTORS } from "../../elements/shared/assign-elements-selectors";
-import { waitForProgressBarToNotBeVisible } from "./progressBar";
-
-export function assignElements(name, withLoader = true) {
- cy.get(ASSIGN_ELEMENTS_SELECTORS.searchInput).type(name);
- if (withLoader) {
- cy.get(ASSIGN_ELEMENTS_SELECTORS.dialogContent);
- waitForProgressBarToNotBeVisible();
- }
- cy.contains(ASSIGN_ELEMENTS_SELECTORS.tableRow, name)
- .find(ASSIGN_ELEMENTS_SELECTORS.checkbox)
- .click()
- .get(ASSIGN_ELEMENTS_SELECTORS.submitButton)
- .click();
-}
diff --git a/cypress/steps/shared/confirmationMessages.js b/cypress/steps/shared/confirmationMessages.js
deleted file mode 100644
index 67fafefaa..000000000
--- a/cypress/steps/shared/confirmationMessages.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
-
-export function confirmationMessageShouldDisappear() {
- cy.get(SHARED_ELEMENTS.notificationSuccess)
- .should("be.visible")
- .get(SHARED_ELEMENTS.notificationSuccess)
- .should("not.exist");
-}
diff --git a/cypress/steps/shared/progressBar.js b/cypress/steps/shared/progressBar.js
deleted file mode 100644
index a0b8eae87..000000000
--- a/cypress/steps/shared/progressBar.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
-
-export function visitAndWaitForProgressBarToDisappear(url) {
- cy.visit(url);
- return waitForProgressBarToNotBeVisible();
-}
-
-export function waitForProgressBarToNotBeVisible() {
- return cy.get(SHARED_ELEMENTS.progressBar).should("be.not.visible");
-}
-
-export function waitForProgressBarToNotExist() {
- return cy.get(SHARED_ELEMENTS.progressBar).should("not.exist");
-}
diff --git a/cypress/steps/shared/tables.js b/cypress/steps/shared/tables.js
deleted file mode 100644
index 0c5490204..000000000
--- a/cypress/steps/shared/tables.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
-import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
-import { waitForProgressBarToNotExist } from "./progressBar";
-
-export function searchInTable(query) {
- cy.get(SHARED_ELEMENTS.searchInput).type(query);
- waitForProgressBarToNotExist();
-}
-
-export function findElementOnTable(elementName) {
- cy.getTextFromElement(SHARED_ELEMENTS.table).then(tableText => {
- if (tableText.includes(elementName)) {
- cy.contains(SHARED_ELEMENTS.tableRow, elementName).click();
- } else {
- cy.get(BUTTON_SELECTORS.nextPaginationButton).click();
- findElementOnTable(elementName);
- }
- });
-}
diff --git a/cypress/steps/user.js b/cypress/steps/user.js
deleted file mode 100644
index 94bfc59de..000000000
--- a/cypress/steps/user.js
+++ /dev/null
@@ -1,46 +0,0 @@
-import { SET_PASSWORD } from "../elements/account/setPassword";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { INVITE_STAFF_MEMBER_FORM } from "../elements/staffMembers/inviteStaffMemberForm";
-import { STAFF_MEMBER_DETAILS } from "../elements/staffMembers/staffMemberDetails";
-import { userDetailsUrl } from "../url/urlList";
-import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
-import { visitAndWaitForProgressBarToDisappear } from "./shared/progressBar";
-import { fillAutocompleteSelect } from "./shared/selects";
-
-export function fillUpSetPassword(password) {
- cy.get(SET_PASSWORD.confirmPasswordInput)
- .type(password)
- .get(SET_PASSWORD.passwordInput)
- .type(password)
- .addAliasToGraphRequest("SetPassword")
- .get(BUTTON_SELECTORS.confirm)
- .click()
- .wait("@SetPassword");
-}
-
-export function fillUpUserDetails(firstName, lastName, email) {
- cy.get(INVITE_STAFF_MEMBER_FORM.firstNameInput)
- .type(firstName)
- .get(INVITE_STAFF_MEMBER_FORM.lastNameInput)
- .type(lastName)
- .get(INVITE_STAFF_MEMBER_FORM.emailInput)
- .type(email)
- .get(BUTTON_SELECTORS.submit)
- .click();
- confirmationMessageShouldDisappear();
- fillAutocompleteSelect(STAFF_MEMBER_DETAILS.permissionsSelect);
- cy.addAliasToGraphRequest("StaffMemberUpdate");
- cy.get(BUTTON_SELECTORS.confirm)
- .click()
- .wait("@StaffMemberUpdate");
-}
-
-export function updateUserActiveFlag(userId) {
- visitAndWaitForProgressBarToDisappear(userDetailsUrl(userId))
- .get(STAFF_MEMBER_DETAILS.isActiveCheckBox)
- .click()
- .addAliasToGraphRequest("StaffMemberUpdate");
- cy.get(BUTTON_SELECTORS.confirm)
- .click()
- .wait("@StaffMemberUpdate");
-}
diff --git a/cypress/apiRequests/Apps.js b/cypress/support/api/requests/Apps.js
similarity index 100%
rename from cypress/apiRequests/Apps.js
rename to cypress/support/api/requests/Apps.js
diff --git a/cypress/apiRequests/Attribute.js b/cypress/support/api/requests/Attribute.js
similarity index 100%
rename from cypress/apiRequests/Attribute.js
rename to cypress/support/api/requests/Attribute.js
diff --git a/cypress/apiRequests/Category.js b/cypress/support/api/requests/Category.js
similarity index 100%
rename from cypress/apiRequests/Category.js
rename to cypress/support/api/requests/Category.js
diff --git a/cypress/apiRequests/Channels.js b/cypress/support/api/requests/Channels.js
similarity index 100%
rename from cypress/apiRequests/Channels.js
rename to cypress/support/api/requests/Channels.js
diff --git a/cypress/apiRequests/Checkout.js b/cypress/support/api/requests/Checkout.js
similarity index 100%
rename from cypress/apiRequests/Checkout.js
rename to cypress/support/api/requests/Checkout.js
diff --git a/cypress/apiRequests/Collections.js b/cypress/support/api/requests/Collections.js
similarity index 100%
rename from cypress/apiRequests/Collections.js
rename to cypress/support/api/requests/Collections.js
diff --git a/cypress/apiRequests/Customer.js b/cypress/support/api/requests/Customer.js
similarity index 100%
rename from cypress/apiRequests/Customer.js
rename to cypress/support/api/requests/Customer.js
diff --git a/cypress/apiRequests/Discounts/Sales.js b/cypress/support/api/requests/Discounts/Sales.js
similarity index 100%
rename from cypress/apiRequests/Discounts/Sales.js
rename to cypress/support/api/requests/Discounts/Sales.js
diff --git a/cypress/apiRequests/Discounts/Vouchers.js b/cypress/support/api/requests/Discounts/Vouchers.js
similarity index 100%
rename from cypress/apiRequests/Discounts/Vouchers.js
rename to cypress/support/api/requests/Discounts/Vouchers.js
diff --git a/cypress/apiRequests/giftCards.js b/cypress/support/api/requests/GiftCard.js
similarity index 100%
rename from cypress/apiRequests/giftCards.js
rename to cypress/support/api/requests/GiftCard.js
diff --git a/cypress/apiRequests/HomePage.js b/cypress/support/api/requests/HomePage.js
similarity index 100%
rename from cypress/apiRequests/HomePage.js
rename to cypress/support/api/requests/HomePage.js
diff --git a/cypress/apiRequests/Menu.js b/cypress/support/api/requests/Menu.js
similarity index 100%
rename from cypress/apiRequests/Menu.js
rename to cypress/support/api/requests/Menu.js
diff --git a/cypress/apiRequests/Metadata.js b/cypress/support/api/requests/Metadata.js
similarity index 100%
rename from cypress/apiRequests/Metadata.js
rename to cypress/support/api/requests/Metadata.js
diff --git a/cypress/apiRequests/Order.js b/cypress/support/api/requests/Order.js
similarity index 100%
rename from cypress/apiRequests/Order.js
rename to cypress/support/api/requests/Order.js
diff --git a/cypress/apiRequests/Page.js b/cypress/support/api/requests/Page.js
similarity index 100%
rename from cypress/apiRequests/Page.js
rename to cypress/support/api/requests/Page.js
diff --git a/cypress/apiRequests/PageTypes.js b/cypress/support/api/requests/PageType.js
similarity index 100%
rename from cypress/apiRequests/PageTypes.js
rename to cypress/support/api/requests/PageType.js
diff --git a/cypress/apiRequests/PermissionGroup.js b/cypress/support/api/requests/PermissionGroup.js
similarity index 100%
rename from cypress/apiRequests/PermissionGroup.js
rename to cypress/support/api/requests/PermissionGroup.js
diff --git a/cypress/apiRequests/permissions.js b/cypress/support/api/requests/Permissions.js
similarity index 100%
rename from cypress/apiRequests/permissions.js
rename to cypress/support/api/requests/Permissions.js
diff --git a/cypress/apiRequests/Product.js b/cypress/support/api/requests/Product.js
similarity index 98%
rename from cypress/apiRequests/Product.js
rename to cypress/support/api/requests/Product.js
index cfe59b599..6160fd1d7 100644
--- a/cypress/apiRequests/Product.js
+++ b/cypress/support/api/requests/Product.js
@@ -1,4 +1,4 @@
-import { stringify } from "../support/format/formatJson";
+import { stringify } from "../.././formatData/formatJson";
import { getValueWithDefault, getVariantsListIds } from "./utils/Utils";
export function getFirstProducts(first, search) {
@@ -18,7 +18,8 @@ export function getFirstProducts(first, search) {
}
}
}
- }`;
+ }
+ }`;
return cy
.sendRequestWithQuery(query)
.then(resp => resp.body.data.products.edges);
diff --git a/cypress/apiRequests/productType.js b/cypress/support/api/requests/ProductType.js
similarity index 89%
rename from cypress/apiRequests/productType.js
rename to cypress/support/api/requests/ProductType.js
index fde3581c8..07ff85e82 100644
--- a/cypress/apiRequests/productType.js
+++ b/cypress/support/api/requests/ProductType.js
@@ -1,3 +1,4 @@
+import { returnValueDependsOnShopVersion } from "../../formatData/dataDependingOnVersion";
import { getValueWithDefault } from "./utils/Utils";
export function createTypeProduct({
@@ -5,8 +6,10 @@ export function createTypeProduct({
attributeId,
hasVariants = true,
slug = name,
- shippable = true
+ shippable = true,
+ kind = "NORMAL"
}) {
+ const kindLines = returnValueDependsOnShopVersion("3.1", `kind: ${kind}`);
const productAttributesLine = getValueWithDefault(
attributeId,
`productAttributes: "${attributeId}"`
@@ -23,6 +26,7 @@ export function createTypeProduct({
hasVariants: ${hasVariants}
${variantAttributesLine}
isShippingRequired:${shippable}
+ ${kindLines}
}){
productErrors{
field
diff --git a/cypress/apiRequests/ShippingMethod.js b/cypress/support/api/requests/ShippingMethod.js
similarity index 100%
rename from cypress/apiRequests/ShippingMethod.js
rename to cypress/support/api/requests/ShippingMethod.js
diff --git a/cypress/apiRequests/shopSettings.js b/cypress/support/api/requests/ShopSettings.js
similarity index 98%
rename from cypress/apiRequests/shopSettings.js
rename to cypress/support/api/requests/ShopSettings.js
index 6253ed1a4..8e9aaa606 100644
--- a/cypress/apiRequests/shopSettings.js
+++ b/cypress/support/api/requests/ShopSettings.js
@@ -37,6 +37,7 @@ export function getShopInfo() {
const query = `query{
shop{
name
+ version
domain{
host
}
diff --git a/cypress/apiRequests/StaffMembers.js b/cypress/support/api/requests/StaffMembers.js
similarity index 97%
rename from cypress/apiRequests/StaffMembers.js
rename to cypress/support/api/requests/StaffMembers.js
index 36554441f..c77c63c81 100644
--- a/cypress/apiRequests/StaffMembers.js
+++ b/cypress/support/api/requests/StaffMembers.js
@@ -1,4 +1,4 @@
-import { urlList } from "../url/urlList";
+import { urlList } from "../../../fixtures/urlList";
export function getStaffMembersStartsWith(startsWith) {
const query = `query{
diff --git a/cypress/apiRequests/Warehouse.js b/cypress/support/api/requests/Warehouse.js
similarity index 100%
rename from cypress/apiRequests/Warehouse.js
rename to cypress/support/api/requests/Warehouse.js
diff --git a/cypress/apiRequests/storeFront/Collections.js b/cypress/support/api/requests/storeFront/Collections.js
similarity index 100%
rename from cypress/apiRequests/storeFront/Collections.js
rename to cypress/support/api/requests/storeFront/Collections.js
diff --git a/cypress/apiRequests/storeFront/ProductDetails.js b/cypress/support/api/requests/storeFront/ProductDetails.js
similarity index 100%
rename from cypress/apiRequests/storeFront/ProductDetails.js
rename to cypress/support/api/requests/storeFront/ProductDetails.js
diff --git a/cypress/apiRequests/storeFront/Search.js b/cypress/support/api/requests/storeFront/Search.js
similarity index 100%
rename from cypress/apiRequests/storeFront/Search.js
rename to cypress/support/api/requests/storeFront/Search.js
diff --git a/cypress/apiRequests/utils/Utils.js b/cypress/support/api/requests/utils/Utils.js
similarity index 100%
rename from cypress/apiRequests/utils/Utils.js
rename to cypress/support/api/requests/utils/Utils.js
diff --git a/cypress/utils/appUtils.js b/cypress/support/api/utils/appUtils.js
similarity index 66%
rename from cypress/utils/appUtils.js
rename to cypress/support/api/utils/appUtils.js
index 610fdddca..cbb49a207 100644
--- a/cypress/utils/appUtils.js
+++ b/cypress/support/api/utils/appUtils.js
@@ -1,4 +1,4 @@
-import { deleteApp, getApps } from "../apiRequests/Apps";
+import { deleteApp, getApps } from "../requests/Apps";
export function deleteAppsStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteApp, getApps, startsWith);
diff --git a/cypress/utils/attributes.js~HEAD b/cypress/support/api/utils/attributes/attributeUtils.js
similarity index 69%
rename from cypress/utils/attributes.js~HEAD
rename to cypress/support/api/utils/attributes/attributeUtils.js
index 4c5fc1c70..59ac0091b 100644
--- a/cypress/utils/attributes.js~HEAD
+++ b/cypress/support/api/utils/attributes/attributeUtils.js
@@ -1,4 +1,4 @@
-import { deleteAttribute, getAttributes } from "../apiRequests/Attribute";
+import { deleteAttribute, getAttributes } from "../../requests/Attribute";
export function deleteAttributesStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteAttribute, getAttributes, startsWith);
diff --git a/cypress/utils/attributes/checkAttributeData.js b/cypress/support/api/utils/attributes/checkAttributeData.js
similarity index 100%
rename from cypress/utils/attributes/checkAttributeData.js
rename to cypress/support/api/utils/attributes/checkAttributeData.js
diff --git a/cypress/utils/categoryUtils.js b/cypress/support/api/utils/categoryUtils.js
similarity index 64%
rename from cypress/utils/categoryUtils.js
rename to cypress/support/api/utils/categoryUtils.js
index 7080d16e3..7fa5afaa3 100644
--- a/cypress/utils/categoryUtils.js
+++ b/cypress/support/api/utils/categoryUtils.js
@@ -1,4 +1,4 @@
-import { deleteCategory, getCategories } from "../apiRequests/Category";
+import { deleteCategory, getCategories } from "../requests/Category";
export function deleteCategoriesStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteCategory, getCategories, startsWith);
diff --git a/cypress/utils/channelsUtils.js b/cypress/support/api/utils/channelsUtils.js
similarity index 95%
rename from cypress/utils/channelsUtils.js
rename to cypress/support/api/utils/channelsUtils.js
index 4590d3ef7..0fdb147ec 100644
--- a/cypress/utils/channelsUtils.js
+++ b/cypress/support/api/utils/channelsUtils.js
@@ -1,4 +1,4 @@
-import * as channels from "../apiRequests/Channels";
+import * as channels from "../requests/Channels";
export function deleteChannelsStartsWith(nameStartsWith) {
channels.getChannels().then(resp => {
diff --git a/cypress/utils/collectionsUtils.js b/cypress/support/api/utils/collectionsUtils.js
similarity index 63%
rename from cypress/utils/collectionsUtils.js
rename to cypress/support/api/utils/collectionsUtils.js
index 36f72a652..24152ee48 100644
--- a/cypress/utils/collectionsUtils.js
+++ b/cypress/support/api/utils/collectionsUtils.js
@@ -1,4 +1,4 @@
-import { deleteCollection, getCollections } from "../apiRequests/Collections";
+import { deleteCollection, getCollections } from "../requests/Collections";
export function deleteCollectionsStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteCollection, getCollections, startsWith);
diff --git a/cypress/utils/discounts/salesUtils.js b/cypress/support/api/utils/discounts/salesUtils.js
similarity index 61%
rename from cypress/utils/discounts/salesUtils.js
rename to cypress/support/api/utils/discounts/salesUtils.js
index 15620d37f..3dc537f0b 100644
--- a/cypress/utils/discounts/salesUtils.js
+++ b/cypress/support/api/utils/discounts/salesUtils.js
@@ -1,4 +1,4 @@
-import { deleteSale, getSales } from "../../apiRequests/Discounts/Sales";
+import { deleteSale, getSales } from "../../requests/Discounts/Sales";
export function deleteSalesStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteSale, getSales, startsWith);
diff --git a/cypress/utils/discounts/vouchersUtils.js b/cypress/support/api/utils/discounts/vouchersUtils.js
similarity index 61%
rename from cypress/utils/discounts/vouchersUtils.js
rename to cypress/support/api/utils/discounts/vouchersUtils.js
index 083099965..1a2e2c1be 100644
--- a/cypress/utils/discounts/vouchersUtils.js
+++ b/cypress/support/api/utils/discounts/vouchersUtils.js
@@ -1,7 +1,4 @@
-import {
- deleteVouchers,
- getVouchers
-} from "../../apiRequests/Discounts/Vouchers";
+import { deleteVouchers, getVouchers } from "../../requests/Discounts/Vouchers";
export function deleteVouchersStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteVouchers, getVouchers, startsWith, "code");
diff --git a/cypress/utils/homePageUtils.js b/cypress/support/api/utils/homePageUtils.js
similarity index 94%
rename from cypress/utils/homePageUtils.js
rename to cypress/support/api/utils/homePageUtils.js
index 8d259b6c7..178ccb8ee 100644
--- a/cypress/utils/homePageUtils.js
+++ b/cypress/support/api/utils/homePageUtils.js
@@ -1,4 +1,4 @@
-import * as homePage from "../apiRequests/HomePage";
+import * as homePage from "../requests/HomePage";
import { getDatePeriod } from "./misc";
export function getOrdersReadyToFulfill(channelSlug) {
diff --git a/cypress/utils/misc.js b/cypress/support/api/utils/misc.js
similarity index 100%
rename from cypress/utils/misc.js
rename to cypress/support/api/utils/misc.js
diff --git a/cypress/utils/navigationUtils.js b/cypress/support/api/utils/navigationUtils.js
similarity index 66%
rename from cypress/utils/navigationUtils.js
rename to cypress/support/api/utils/navigationUtils.js
index 5334053cf..27a6b8bd7 100644
--- a/cypress/utils/navigationUtils.js
+++ b/cypress/support/api/utils/navigationUtils.js
@@ -1,4 +1,4 @@
-import { deleteMenu, getMenus } from "../apiRequests/Menu";
+import { deleteMenu, getMenus } from "../requests/Menu";
export function deleteMenusStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteMenu, getMenus, startsWith);
diff --git a/cypress/utils/ordersUtils.js b/cypress/support/api/utils/ordersUtils.js
similarity index 97%
rename from cypress/utils/ordersUtils.js
rename to cypress/support/api/utils/ordersUtils.js
index 2bea53e90..5282f0433 100644
--- a/cypress/utils/ordersUtils.js
+++ b/cypress/support/api/utils/ordersUtils.js
@@ -1,5 +1,5 @@
-import * as checkoutRequest from "../apiRequests/Checkout";
-import * as orderRequest from "../apiRequests/Order";
+import * as checkoutRequest from "../requests/Checkout";
+import * as orderRequest from "../requests/Order";
import { createProductInChannel } from "./products/productsUtils";
export function createWaitingForCaptureOrder({
diff --git a/cypress/utils/pageTypeUtils.js b/cypress/support/api/utils/pageTypeUtils.js
similarity index 64%
rename from cypress/utils/pageTypeUtils.js
rename to cypress/support/api/utils/pageTypeUtils.js
index 5cec78965..6e96a5912 100644
--- a/cypress/utils/pageTypeUtils.js
+++ b/cypress/support/api/utils/pageTypeUtils.js
@@ -1,4 +1,4 @@
-import { deletePageType, getPageTypes } from "../apiRequests/PageTypes";
+import { deletePageType, getPageTypes } from "../requests/PageType";
export function deletePageTypesStartsWith(startsWith) {
cy.deleteElementsStartsWith(deletePageType, getPageTypes, startsWith);
diff --git a/cypress/utils/permissionGroupUtils.js b/cypress/support/api/utils/permissionGroupUtils.js
similarity index 84%
rename from cypress/utils/permissionGroupUtils.js
rename to cypress/support/api/utils/permissionGroupUtils.js
index f103b964e..abd8f570f 100644
--- a/cypress/utils/permissionGroupUtils.js
+++ b/cypress/support/api/utils/permissionGroupUtils.js
@@ -1,7 +1,7 @@
import {
deletePermissionGroup,
getPermissionGroups
-} from "../apiRequests/PermissionGroup";
+} from "../requests/PermissionGroup";
export function deletePermissionGroupsStartsWith(startsWith) {
cy.deleteElementsStartsWith(
diff --git a/cypress/utils/products/checkProductInfo.js b/cypress/support/api/utils/products/checkProductInfo.js
similarity index 100%
rename from cypress/utils/products/checkProductInfo.js
rename to cypress/support/api/utils/products/checkProductInfo.js
diff --git a/cypress/utils/products/productsListUtils.js b/cypress/support/api/utils/products/productsListUtils.js
similarity index 95%
rename from cypress/utils/products/productsListUtils.js
rename to cypress/support/api/utils/products/productsListUtils.js
index a5ed573e6..65c6f72b9 100644
--- a/cypress/utils/products/productsListUtils.js
+++ b/cypress/support/api/utils/products/productsListUtils.js
@@ -1,4 +1,4 @@
-import { PRODUCTS_LIST } from "../../elements/catalog/products/products-list";
+import { PRODUCTS_LIST } from "../../../../elements/catalog/products/products-list";
export function getDisplayedColumnArray(columnName) {
let productsList = new Array();
return cy
diff --git a/cypress/utils/products/productsUtils.js b/cypress/support/api/utils/products/productsUtils.js
similarity index 86%
rename from cypress/utils/products/productsUtils.js
rename to cypress/support/api/utils/products/productsUtils.js
index 0e8b969c9..2735c15cc 100644
--- a/cypress/utils/products/productsUtils.js
+++ b/cypress/support/api/utils/products/productsUtils.js
@@ -1,11 +1,11 @@
-import * as attributeRequest from "../../apiRequests/Attribute";
-import * as categoryRequest from "../../apiRequests/Category";
-import * as productRequest from "../../apiRequests/Product";
+import * as attributeRequest from "../../requests/Attribute";
+import * as categoryRequest from "../../requests/Category";
+import * as productRequest from "../../requests/Product";
import {
createTypeProduct,
deleteProductType,
getProductTypes
-} from "../../apiRequests/productType";
+} from "../../requests/ProductType";
import { deleteAttributesStartsWith } from "../attributes/attributeUtils";
export function createProductInChannel({
@@ -91,10 +91,14 @@ export function createTypeAttributeAndCategoryForProduct(
export function deleteProductsStartsWith(startsWith) {
deleteAttributesStartsWith(startsWith);
cy.deleteElementsStartsWith(deleteProductType, getProductTypes, startsWith);
- deleteAttributesStartsWith(startsWith);
cy.deleteElementsStartsWith(
categoryRequest.deleteCategory,
categoryRequest.getCategories,
startsWith
);
+ cy.deleteElementsStartsWith(
+ productRequest.deleteProduct,
+ productRequest.getFirstProducts,
+ startsWith
+ );
}
diff --git a/cypress/utils/shippingUtils.js b/cypress/support/api/utils/shippingUtils.js
similarity index 89%
rename from cypress/utils/shippingUtils.js
rename to cypress/support/api/utils/shippingUtils.js
index 922ad2b3a..40e726c2f 100644
--- a/cypress/utils/shippingUtils.js
+++ b/cypress/support/api/utils/shippingUtils.js
@@ -1,5 +1,5 @@
-import * as shippingMethodRequest from "../apiRequests/ShippingMethod";
-import * as warehouseRequest from "../apiRequests/Warehouse";
+import * as shippingMethodRequest from "../requests/ShippingMethod";
+import * as warehouseRequest from "../requests/Warehouse";
export function createShipping({
channelId,
@@ -51,8 +51,7 @@ export function deleteShippingStartsWith(startsWith) {
shippingMethodRequest.deleteShippingZone,
shippingMethodRequest.getShippingZones,
startsWith
- );
- cy.deleteElementsStartsWith(
+ ).deleteElementsStartsWith(
warehouseRequest.deleteWarehouse,
warehouseRequest.getWarehouses,
startsWith
diff --git a/cypress/utils/storeFront/checkoutUtils.js b/cypress/support/api/utils/storeFront/checkoutUtils.js
similarity index 100%
rename from cypress/utils/storeFront/checkoutUtils.js
rename to cypress/support/api/utils/storeFront/checkoutUtils.js
diff --git a/cypress/utils/storeFront/collectionsUtils.js b/cypress/support/api/utils/storeFront/collectionsUtils.js
similarity index 100%
rename from cypress/utils/storeFront/collectionsUtils.js
rename to cypress/support/api/utils/storeFront/collectionsUtils.js
diff --git a/cypress/utils/storeFront/storeFrontProductUtils.js b/cypress/support/api/utils/storeFront/storeFrontProductUtils.js
similarity index 92%
rename from cypress/utils/storeFront/storeFrontProductUtils.js
rename to cypress/support/api/utils/storeFront/storeFrontProductUtils.js
index a3c1d274c..10581f92d 100644
--- a/cypress/utils/storeFront/storeFrontProductUtils.js
+++ b/cypress/support/api/utils/storeFront/storeFrontProductUtils.js
@@ -1,4 +1,4 @@
-import { getProductDetails } from "../../apiRequests/storeFront/ProductDetails";
+import { getProductDetails } from "../../requests/storeFront/ProductDetails";
export const isProductVisible = (resp, name) => {
const product = resp.body.data.product;
diff --git a/cypress/utils/users.js b/cypress/support/api/utils/users.js
similarity index 92%
rename from cypress/utils/users.js
rename to cypress/support/api/utils/users.js
index 083bf7634..78a3afad9 100644
--- a/cypress/utils/users.js
+++ b/cypress/support/api/utils/users.js
@@ -1,5 +1,5 @@
-import { getPermissionsArray } from "../apiRequests/permissions";
-import { inviteStaffMember } from "../apiRequests/StaffMembers";
+import { getPermissionsArray } from "../requests/Permissions";
+import { inviteStaffMember } from "../requests/StaffMembers";
export function inviteStaffMemberWithFirstPermission({
email,
diff --git a/cypress/support/customCommands/basicOperations/index.js b/cypress/support/customCommands/basicOperations/index.js
new file mode 100644
index 000000000..a2e0a7256
--- /dev/null
+++ b/cypress/support/customCommands/basicOperations/index.js
@@ -0,0 +1,16 @@
+Cypress.Commands.add("getTextFromElement", element =>
+ cy.get(element).invoke("text")
+);
+
+Cypress.Commands.add("clearAndType", { prevSubject: true }, (subject, text) => {
+ cy.wrap(subject)
+ .clear()
+ .type(text);
+});
+
+Cypress.Commands.add("waitForRequestAndCheckIfNoErrors", alias => {
+ cy.wait(alias).then(resp => {
+ expect(resp.response.body.errors).to.be.undefined;
+ return resp;
+ });
+});
diff --git a/cypress/support/deleteElement/index.js b/cypress/support/customCommands/deleteElementsViaApi.js
similarity index 100%
rename from cypress/support/deleteElement/index.js
rename to cypress/support/customCommands/deleteElementsViaApi.js
diff --git a/cypress/steps/shared/addressForm.js b/cypress/support/customCommands/sharedElementsOperations/addressForm.js
similarity index 50%
rename from cypress/steps/shared/addressForm.js
rename to cypress/support/customCommands/sharedElementsOperations/addressForm.js
index 8349a93c8..8410f7b8f 100644
--- a/cypress/steps/shared/addressForm.js
+++ b/cypress/support/customCommands/sharedElementsOperations/addressForm.js
@@ -1,21 +1,7 @@
-import { ADDRESS_SELECTORS } from "../../elements/shared/addressForm";
-import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
-import { fillAutocompleteSelect } from "./selects";
+import { ADDRESS_SELECTORS } from "../../../elements/shared/addressForm";
+import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
-export function fillUpAddressFormAndSubmit(address) {
- fillUpAddressForm();
- cy.get(BUTTON_SELECTORS.submit).click();
-}
-
-export function fillUpAddressForm(address) {
- cy.get(ADDRESS_SELECTORS.firstName)
- .type(address.firstName)
- .get(ADDRESS_SELECTORS.lastName)
- .type(address.lastName);
- fillUpBasicAddress(address);
-}
-
-export function fillUpBasicAddress(address) {
+Cypress.Commands.add("fillUpBasicAddress", address => {
cy.get(ADDRESS_SELECTORS.companyName)
.clearAndType(address.companyName)
.get(ADDRESS_SELECTORS.phone)
@@ -27,7 +13,21 @@ export function fillUpBasicAddress(address) {
.get(ADDRESS_SELECTORS.city)
.clearAndType(address.city)
.get(ADDRESS_SELECTORS.postalCode)
- .clearAndType(address.postalCode);
- fillAutocompleteSelect(ADDRESS_SELECTORS.country, address.countryFullName);
+ .clearAndType(address.postalCode)
+ .fillAutocompleteSelect(ADDRESS_SELECTORS.country, address.countryFullName);
cy.get(ADDRESS_SELECTORS.countryArea).clearAndType(address.countryArea);
-}
+});
+
+Cypress.Commands.add("fillUpAddressForm", address => {
+ cy.get(ADDRESS_SELECTORS.firstName)
+ .type(address.firstName)
+ .get(ADDRESS_SELECTORS.lastName)
+ .type(address.lastName)
+ .fillUpBasicAddress(address);
+});
+
+Cypress.Commands.add("fillUpAddressFormAndSubmit", address => {
+ cy.fillUpAddressForm(address)
+ .get(BUTTON_SELECTORS.submit)
+ .click();
+});
diff --git a/cypress/support/customCommands/sharedElementsOperations/assignElementsForm.js b/cypress/support/customCommands/sharedElementsOperations/assignElementsForm.js
new file mode 100644
index 000000000..883162b19
--- /dev/null
+++ b/cypress/support/customCommands/sharedElementsOperations/assignElementsForm.js
@@ -0,0 +1,27 @@
+import { ASSIGN_ELEMENTS_SELECTORS } from "../../../elements/shared/assign-elements-selectors";
+
+// export function assignElements(name, withLoader = true) {
+// cy.get(ASSIGN_ELEMENTS_SELECTORS.searchInput).type(name);
+// if (withLoader) {
+// cy.get(ASSIGN_ELEMENTS_SELECTORS.dialogContent);
+// waitForProgressBarToNotBeVisible();
+// }
+// cy.contains(ASSIGN_ELEMENTS_SELECTORS.tableRow, name)
+// .find(ASSIGN_ELEMENTS_SELECTORS.checkbox)
+// .click()
+// .get(ASSIGN_ELEMENTS_SELECTORS.submitButton)
+// .click();
+// }
+
+Cypress.Commands.add("assignElements", (name, withLoader = true) => {
+ cy.get(ASSIGN_ELEMENTS_SELECTORS.searchInput).type(name);
+ if (withLoader) {
+ cy.get(ASSIGN_ELEMENTS_SELECTORS.dialogContent);
+ cy.waitForProgressBarToNotBeVisible();
+ }
+ cy.contains(ASSIGN_ELEMENTS_SELECTORS.tableRow, name)
+ .find(ASSIGN_ELEMENTS_SELECTORS.checkbox)
+ .click()
+ .get(ASSIGN_ELEMENTS_SELECTORS.submitButton)
+ .click();
+});
diff --git a/cypress/support/customCommands/sharedElementsOperations/confirmationMessages.js b/cypress/support/customCommands/sharedElementsOperations/confirmationMessages.js
new file mode 100644
index 000000000..095f636a8
--- /dev/null
+++ b/cypress/support/customCommands/sharedElementsOperations/confirmationMessages.js
@@ -0,0 +1,15 @@
+import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
+
+// export function confirmationMessageShouldDisappear() {
+// cy.get(SHARED_ELEMENTS.notificationSuccess)
+// .should("be.visible")
+// .get(SHARED_ELEMENTS.notificationSuccess)
+// .should("not.exist");
+// }
+
+Cypress.Commands.add("confirmationMessageShouldDisappear", () => {
+ cy.get(SHARED_ELEMENTS.notificationSuccess)
+ .should("be.visible")
+ .get(SHARED_ELEMENTS.notificationSuccess)
+ .should("not.exist");
+});
diff --git a/cypress/support/customCommands/sharedElementsOperations/progressBar.js b/cypress/support/customCommands/sharedElementsOperations/progressBar.js
new file mode 100644
index 000000000..f0ebc329e
--- /dev/null
+++ b/cypress/support/customCommands/sharedElementsOperations/progressBar.js
@@ -0,0 +1,26 @@
+import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
+
+// export function visitAndWaitForProgressBarToDisappear(url) {
+// cy.visit(url);
+// return waitForProgressBarToNotBeVisible();
+// }
+
+// export function waitForProgressBarToNotBeVisible() {
+// return cy.get(SHARED_ELEMENTS.progressBar).should("be.not.visible");
+// }
+
+// export function waitForProgressBarToNotExist() {
+// return cy.get(SHARED_ELEMENTS.progressBar).should("not.exist");
+// }
+
+Cypress.Commands.add("visitAndWaitForProgressBarToDisappear", url => {
+ cy.visit(url).waitForProgressBarToNotBeVisible();
+});
+
+Cypress.Commands.add("waitForProgressBarToNotBeVisible", () => {
+ cy.get(SHARED_ELEMENTS.progressBar).should("be.not.visible");
+});
+
+Cypress.Commands.add("waitForProgressBarToNotExist", () => {
+ cy.get(SHARED_ELEMENTS.progressBar).should("not.exist");
+});
diff --git a/cypress/steps/shared/selects.js b/cypress/support/customCommands/sharedElementsOperations/selects.js
similarity index 64%
rename from cypress/steps/shared/selects.js
rename to cypress/support/customCommands/sharedElementsOperations/selects.js
index 628f58611..f2aaa4bd6 100644
--- a/cypress/steps/shared/selects.js
+++ b/cypress/support/customCommands/sharedElementsOperations/selects.js
@@ -1,10 +1,33 @@
-import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import {
selectorWithDataValue,
SHARED_ELEMENTS
-} from "../../elements/shared/sharedElements";
+} from "../../../elements/shared/sharedElements";
-export function fillAutocompleteSelect(selectSelector, option) {
+Cypress.Commands.add("createNewOption", (selectSelector, newOption) => {
+ cy.get(selectSelector).type(newOption);
+ cy.contains(BUTTON_SELECTORS.selectOption, newOption)
+ .should("be.visible")
+ .click();
+});
+
+Cypress.Commands.add("fillMultiSelect", (selectSelector, option) => {
+ cy.fillAutocompleteSelect(selectSelector, option).then(returnedOption => {
+ cy.get(SHARED_ELEMENTS.header)
+ .first()
+ .click({ force: true });
+ return cy.wrap(returnedOption);
+ });
+});
+
+Cypress.Commands.add("fillBaseSelect", (selectSelector, value) => {
+ cy.get(selectSelector)
+ .click()
+ .get(selectorWithDataValue(value))
+ .click();
+});
+
+Cypress.Commands.add("fillAutocompleteSelect", (selectSelector, option) => {
cy.get(selectSelector)
.click()
.get(BUTTON_SELECTORS.selectOption)
@@ -24,27 +47,4 @@ export function fillAutocompleteSelect(selectSelector, option) {
.click();
}
return cy.get("@option");
-}
-
-export function fillMultiSelect(selectSelector, option) {
- fillAutocompleteSelect(selectSelector, option).then(returnedOption => {
- cy.get(SHARED_ELEMENTS.header)
- .first()
- .click({ force: true });
- return cy.wrap(returnedOption);
- });
-}
-
-export function fillBaseSelect(selectSelector, value) {
- cy.get(selectSelector)
- .click()
- .get(selectorWithDataValue(value))
- .click();
-}
-
-export function createNewOption(selectSelector, newOption) {
- cy.get(selectSelector).type(newOption);
- cy.contains(BUTTON_SELECTORS.selectOption, newOption)
- .should("be.visible")
- .click();
-}
+});
diff --git a/cypress/support/customCommands/sharedElementsOperations/tables.js b/cypress/support/customCommands/sharedElementsOperations/tables.js
new file mode 100644
index 000000000..b5b6df3f2
--- /dev/null
+++ b/cypress/support/customCommands/sharedElementsOperations/tables.js
@@ -0,0 +1,20 @@
+import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
+import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
+
+Cypress.Commands.add("findElementOnTable", elementName => {
+ cy.getTextFromElement(SHARED_ELEMENTS.table).then(tableText => {
+ if (tableText.includes(elementName)) {
+ cy.contains(SHARED_ELEMENTS.tableRow, elementName).click({ force: true });
+ } else {
+ cy.get(BUTTON_SELECTORS.nextPaginationButton)
+ .click()
+ .findElementOnTable(elementName);
+ }
+ });
+});
+
+Cypress.Commands.add("searchInTable", query => {
+ cy.get(SHARED_ELEMENTS.searchInput)
+ .type(query)
+ .waitForProgressBarToNotExist();
+});
diff --git a/cypress/support/softAssertions/index.js b/cypress/support/customCommands/softAssertions/index.js
similarity index 86%
rename from cypress/support/softAssertions/index.js
rename to cypress/support/customCommands/softAssertions/index.js
index 811d290e5..ba3025e0c 100644
--- a/cypress/support/softAssertions/index.js
+++ b/cypress/support/customCommands/softAssertions/index.js
@@ -1,3 +1,5 @@
+import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
+
let isSoftAssertion = false;
let errors = [];
@@ -128,3 +130,18 @@ Cypress.Commands.add(
cy.expectCorrectBasicAddress(responseAddress, expectedAddress);
}
);
+
+Cypress.Commands.add("softExpectSkeletonIsVisible", () => {
+ cy.get(SHARED_ELEMENTS.circularProgress).should("not.exist");
+ cy.get("body").then($body => {
+ if ($body.find(SHARED_ELEMENTS.skeleton).length) {
+ cy.softAssertVisibility(SHARED_ELEMENTS.skeleton);
+ } else {
+ chai
+ .softExpect(
+ $body.find(SHARED_ELEMENTS.skeleton, "skeleton should exist").length
+ )
+ .to.be.eq(1);
+ }
+ });
+});
diff --git a/cypress/support/user/index.js b/cypress/support/customCommands/user/index.js
similarity index 87%
rename from cypress/support/user/index.js
rename to cypress/support/customCommands/user/index.js
index a87f31502..e437f8f5a 100644
--- a/cypress/support/user/index.js
+++ b/cypress/support/customCommands/user/index.js
@@ -1,5 +1,5 @@
-import { TEST_ADMIN_USER } from "../../Data/users";
-import { LOGIN_SELECTORS } from "../../elements/account/login-selectors";
+import { LOGIN_SELECTORS } from "../../../elements/account/login-selectors";
+import { TEST_ADMIN_USER } from "../../../fixtures/users";
Cypress.Commands.add("loginUser", () =>
cy
diff --git a/cypress/support/elements/index.js b/cypress/support/elements/index.js
deleted file mode 100644
index 6a41e2d4d..000000000
--- a/cypress/support/elements/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
-
-Cypress.Commands.add("getTextFromElement", element =>
- cy.get(element).invoke("text")
-);
-
-Cypress.Commands.add("clearAndType", { prevSubject: true }, (subject, text) => {
- cy.wrap(subject)
- .clear()
- .type(text);
-});
-
-Cypress.Commands.add("softExpectSkeletonIsVisible", () => {
- cy.get(SHARED_ELEMENTS.circularProgress).should("not.exist");
- cy.get("body").then($body => {
- if ($body.find(SHARED_ELEMENTS.skeleton).length) {
- cy.softAssertVisibility(SHARED_ELEMENTS.skeleton);
- } else {
- chai
- .softExpect(
- $body.find(SHARED_ELEMENTS.skeleton, "skeleton should exist").length
- )
- .to.be.eq(1);
- }
- });
-});
diff --git a/cypress/support/filterTests.js b/cypress/support/filterTests.js
index 80c03dd17..3d087b95a 100644
--- a/cypress/support/filterTests.js
+++ b/cypress/support/filterTests.js
@@ -1,22 +1,37 @@
// /
-
/**
* Filter Cypress tests based on a given tag or tags. If no tags are present, run tests.
*
* @param {[string]} definedTags An array of tags
* @param {Function} runTest All tests captured within a Cypress run
* @example npm run open --env tags=api
+ * version:
+ * dev -run all
+ * 3.1 -run eq or lower than 3.1
*/
-const filterTests = (definedTags, runTest) => {
+const filterTests = ({ definedTags = ["all"], version = "1.0.0" }, runTest) => {
+ let isTestAvailableInVersion = false;
+ const shopVersion = Cypress.env("SHOP");
+ if (shopVersion === "dev") {
+ isTestAvailableInVersion = true;
+ } else {
+ const tagVersion = version.match("^\\d\\.\\d\\.\\d")[0].replaceAll(".", "");
+ const numberVersion = shopVersion
+ .match("^\\d\\.\\d\\.\\d")[0]
+ .replaceAll(".", "");
+ if (tagVersion <= numberVersion) {
+ isTestAvailableInVersion = true;
+ }
+ }
if (Cypress.env("tags")) {
const tags = Cypress.env("tags").split("/");
- const found = definedTags.some($definedTag => tags.includes($definedTag));
+ const isFound = definedTags.some($definedTag => tags.includes($definedTag));
- if (found) {
+ if (isFound && isTestAvailableInVersion) {
runTest();
}
- } else {
+ } else if (isTestAvailableInVersion) {
runTest();
}
};
diff --git a/cypress/support/formatData/dataDependingOnVersion.js b/cypress/support/formatData/dataDependingOnVersion.js
new file mode 100644
index 000000000..1660ce396
--- /dev/null
+++ b/cypress/support/formatData/dataDependingOnVersion.js
@@ -0,0 +1,10 @@
+export function returnValueDependsOnShopVersion(
+ version,
+ equalOrGreaterValue,
+ lessThenValue = ""
+) {
+ return Cypress.env("SHOP") === "dev" ||
+ Cypress.env("SHOP").replaceAll(".", "") >= version.replaceAll(".", "")
+ ? equalOrGreaterValue
+ : lessThenValue;
+}
diff --git a/cypress/support/format/formatCurrencyAmount.js b/cypress/support/formatData/formatCurrencyAmount.js
similarity index 74%
rename from cypress/support/format/formatCurrencyAmount.js
rename to cypress/support/formatData/formatCurrencyAmount.js
index 4a229ad34..2c470969f 100644
--- a/cypress/support/format/formatCurrencyAmount.js
+++ b/cypress/support/formatData/formatCurrencyAmount.js
@@ -1,10 +1,9 @@
export function getFormattedCurrencyAmount(amount, currency) {
const language = window.navigator.userLanguage || window.navigator.language;
- const formattedCurrencyAmount = amount.toLocaleString(language, {
+ return amount.toLocaleString(language, {
currency,
style: "currency"
});
- return formattedCurrencyAmount;
}
export function getCurrencyAndAmountInString(amount, currency) {
diff --git a/cypress/support/format/formatDate.js b/cypress/support/formatData/formatDate.js
similarity index 100%
rename from cypress/support/format/formatDate.js
rename to cypress/support/formatData/formatDate.js
diff --git a/cypress/support/format/formatJson.js b/cypress/support/formatData/formatJson.js
similarity index 100%
rename from cypress/support/format/formatJson.js
rename to cypress/support/formatData/formatJson.js
diff --git a/cypress/support/index.d.ts b/cypress/support/index.d.ts
new file mode 100644
index 000000000..56916ff8d
--- /dev/null
+++ b/cypress/support/index.d.ts
@@ -0,0 +1,52 @@
+declare namespace Cypress {
+ interface Chainable {
+ clearSessionData(): Chainable;
+ handleDeleteElement(
+ element: {},
+ deleteFunction: function,
+ startsWith: string,
+ name: string
+ ): Chainable;
+ deleteElementsStartsWith(
+ deleteFunction: function,
+ getFunction: function,
+ startsWith: string,
+ name? = string
+ ): Chainable;
+ softExpectSkeletonIsVisible(): Chainable;
+ expectCorrectFullAddress(
+ responseAddress: string,
+ expectedAddress: string
+ ): Chainable;
+ expectCorrectBasicAddress(
+ responseAddress: string,
+ expectedAddress: string
+ ): Chainable;
+ softAssertVisibility(selector: string): Chainable;
+ softAssertMatch(selector: string, regexp: string): Chainable;
+ getTextFromElement(element: {}): Chainable;
+ clearAndType(subject: {}, text: string): Chainable;
+ loginUser(): Chainable;
+ loginInShop(): Chainable;
+ loginUserViaRequest(authorization?: string, user?: {}): Chainable;
+ assignElements(name: string, withLoader?: boolean): Chainable;
+ fillUpAddressFormAndSubmit(address: {}): Chainable;
+ fillUpAddressForm(address: {}): Chainable;
+ fillUpBasicAddress(address: {}): Chainable;
+ confirmationMessageShouldDisappear(): Chainable;
+ waitForProgressBarToNotExist(): Chainable;
+ waitForProgressBarToNotBeVisible(): Chainable;
+ visitAndWaitForProgressBarToDisappear(url: string): Chainable;
+ fillBaseSelect(selectSelector: string, value: string): Chainable;
+ fillAutocompleteSelect(
+ selectSelector: string,
+ option?: string
+ ): Chainable;
+ addAliasToGraphRequest(alias: string): Chainable;
+ sendRequestWithQuery(query: string): Chainable;
+ fillMultiSelect(selectSelector: string, option: string): Chainable;
+ createNewOption(selectSelector: string, newOption: string): Chainable;
+ findElementOnTable(elementName: string): Chainable;
+ searchInTable(query: string): Chainable;
+ }
+}
diff --git a/cypress/support/index.js b/cypress/support/index.js
index 700e0885f..1892e4bdf 100644
--- a/cypress/support/index.js
+++ b/cypress/support/index.js
@@ -1,10 +1,18 @@
-import "./user";
-import "./softAssertions";
-import "./deleteElement/index.js";
-import "./elements/index";
+// /
+
+import "./customCommands/user";
+import "./customCommands/basicOperations";
+import "./customCommands/deleteElementsViaApi";
+import "./customCommands/softAssertions";
+import "./customCommands/sharedElementsOperations/addressForm.js";
+import "./customCommands/sharedElementsOperations/assignElementsForm.js";
+import "./customCommands/sharedElementsOperations/confirmationMessages.js";
+import "./customCommands/sharedElementsOperations/progressBar.js";
+import "./customCommands/sharedElementsOperations/selects.js";
+import "./customCommands/sharedElementsOperations/tables";
import "cypress-mailhog";
-import { urlList } from "../url/urlList";
+import { urlList } from "../fixtures/urlList";
Cypress.Commands.add("clearSessionData", () => {
// Because of known cypress bug, not all local storage data are cleared.
diff --git a/cypress/steps/attributesSteps.js b/cypress/support/pages/attributesPage.js
similarity index 75%
rename from cypress/steps/attributesSteps.js
rename to cypress/support/pages/attributesPage.js
index 4b5c21536..859b653c6 100644
--- a/cypress/steps/attributesSteps.js
+++ b/cypress/support/pages/attributesPage.js
@@ -1,8 +1,6 @@
-import { ATTRIBUTES_DETAILS } from "../elements/attribute/attributes_details";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { attributeDetailsUrl } from "../url/urlList";
-import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
-import { waitForProgressBarToNotBeVisible } from "./shared/progressBar";
+import { ATTRIBUTES_DETAILS } from "../../elements/attribute/attributes_details";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { attributeDetailsUrl } from "../../fixtures/urlList";
export function createAttributeWithInputType({
name,
@@ -45,12 +43,15 @@ export function fillUpAttributeCreateFields({
export function saveAttribute() {
cy.addAliasToGraphRequest("AttributeCreate");
submitAttribute();
- return cy.wait("@AttributeCreate").its("response.body.data.attributeCreate");
+ return cy
+ .waitForRequestAndCheckIfNoErrors("@AttributeCreate")
+ .its("response.body.data.attributeCreate");
}
export function submitAttribute() {
- cy.get(BUTTON_SELECTORS.confirm).click();
- confirmationMessageShouldDisappear();
+ cy.get(BUTTON_SELECTORS.confirm)
+ .click()
+ .confirmationMessageShouldDisappear();
}
export function addSingleValue(valueName) {
@@ -87,8 +88,9 @@ export function selectNumericSystem({ unitSystem, unitsOf, unit }) {
}
export function enterAttributeAndChanegeIsFilterableInDashbord(attributeId) {
- cy.visit(attributeDetailsUrl(attributeId));
- waitForProgressBarToNotBeVisible();
- cy.get(ATTRIBUTES_DETAILS.dashboardProperties.useInFilteringCheckbox).click();
+ cy.visit(attributeDetailsUrl(attributeId))
+ .waitForProgressBarToNotBeVisible()
+ .get(ATTRIBUTES_DETAILS.dashboardProperties.useInFilteringCheckbox)
+ .click();
submitAttribute();
}
diff --git a/cypress/support/pages/catalog/categoriesPage.js b/cypress/support/pages/catalog/categoriesPage.js
new file mode 100644
index 000000000..f55ddf538
--- /dev/null
+++ b/cypress/support/pages/catalog/categoriesPage.js
@@ -0,0 +1,15 @@
+import { CATEGORY_DETAILS } from "../../../elements/catalog/categories/category-details";
+import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
+
+export function createCategory({ name, description }) {
+ return cy
+ .get(CATEGORY_DETAILS.nameInput)
+ .type(name)
+ .get(CATEGORY_DETAILS.descriptionInput)
+ .type(description)
+ .addAliasToGraphRequest("CategoryCreate")
+ .get(BUTTON_SELECTORS.confirm)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@CategoryCreate");
+}
diff --git a/cypress/steps/collectionsSteps.js b/cypress/support/pages/catalog/collectionsPage.js
similarity index 61%
rename from cypress/steps/collectionsSteps.js
rename to cypress/support/pages/catalog/collectionsPage.js
index d023343e0..d3b732978 100644
--- a/cypress/steps/collectionsSteps.js
+++ b/cypress/support/pages/catalog/collectionsPage.js
@@ -1,9 +1,8 @@
-import { COLLECTION_SELECTORS } from "../elements/catalog/collection-selectors";
-import { AVAILABLE_CHANNELS_FORM } from "../elements/channels/available-channels-form";
-import { SELECT_CHANNELS_TO_ASSIGN } from "../elements/channels/select-channels-to-assign";
-import { ASSIGN_ELEMENTS_SELECTORS } from "../elements/shared/assign-elements-selectors";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
+import { COLLECTION_SELECTORS } from "../../../elements/catalog/collection-selectors";
+import { AVAILABLE_CHANNELS_FORM } from "../../../elements/channels/available-channels-form";
+import { SELECT_CHANNELS_TO_ASSIGN } from "../../../elements/channels/select-channels-to-assign";
+import { ASSIGN_ELEMENTS_SELECTORS } from "../../../elements/shared/assign-elements-selectors";
+import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
export function createCollection(collectionName, isPublished, channel) {
const publishedSelector = isPublished
@@ -18,7 +17,8 @@ export function createCollection(collectionName, isPublished, channel) {
.click()
.get(SELECT_CHANNELS_TO_ASSIGN.allChannelsCheckbox)
.click();
- cy.contains(SELECT_CHANNELS_TO_ASSIGN.channelRow, channel.name)
+ return cy
+ .contains(SELECT_CHANNELS_TO_ASSIGN.channelRow, channel.name)
.find(SELECT_CHANNELS_TO_ASSIGN.channelCheckbox)
.click()
.get(BUTTON_SELECTORS.submit)
@@ -26,12 +26,12 @@ export function createCollection(collectionName, isPublished, channel) {
.get(AVAILABLE_CHANNELS_FORM.availableChannel)
.click()
.get(`${AVAILABLE_CHANNELS_FORM.publishedRadioButtons}${publishedSelector}`)
- .click();
- cy.addAliasToGraphRequest("CreateCollection");
- cy.get(COLLECTION_SELECTORS.saveButton).click();
- confirmationMessageShouldDisappear();
- return cy
- .wait("@CreateCollection")
+ .click()
+ .addAliasToGraphRequest("CreateCollection")
+ .get(COLLECTION_SELECTORS.saveButton)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@CreateCollection")
.its("response.body.data.collectionCreate.collection");
}
@@ -45,5 +45,5 @@ export function assignProductsToCollection(productName) {
.click();
cy.addAliasToGraphRequest("CollectionAssignProduct");
cy.get(ASSIGN_ELEMENTS_SELECTORS.submitButton).click();
- cy.wait("@CollectionAssignProduct");
+ cy.waitForRequestAndCheckIfNoErrors("@CollectionAssignProduct");
}
diff --git a/cypress/steps/giftCardSteps.js b/cypress/support/pages/catalog/giftCardPage.js
similarity index 76%
rename from cypress/steps/giftCardSteps.js
rename to cypress/support/pages/catalog/giftCardPage.js
index 0a1fa8363..e796ebafb 100644
--- a/cypress/steps/giftCardSteps.js
+++ b/cypress/support/pages/catalog/giftCardPage.js
@@ -1,8 +1,7 @@
-import { GIFT_CARD_DIALOG } from "../elements/giftCard/giftCardDialog";
-import { GIFT_CARD_LIST } from "../elements/giftCard/giftCardList";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { urlList } from "../url/urlList";
-import { createNewOption } from "./shared/selects";
+import { GIFT_CARD_DIALOG } from "../../../elements/giftCard/giftCardDialog";
+import { GIFT_CARD_LIST } from "../../../elements/giftCard/giftCardList";
+import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
+import { urlList } from "../../../fixtures/urlList";
export function openAndFillUpCreateGiftCardDialog({
note,
@@ -18,9 +17,10 @@ export function openAndFillUpCreateGiftCardDialog({
cy.contains(GIFT_CARD_DIALOG.currenciesOptions, currency)
.click()
.get(GIFT_CARD_DIALOG.amountInput)
- .clearAndType(amount);
- createNewOption(GIFT_CARD_DIALOG.tagInput, tag);
- cy.get(GIFT_CARD_DIALOG.noteInput).type(note);
+ .clearAndType(amount)
+ .createNewOption(GIFT_CARD_DIALOG.tagInput, tag)
+ .get(GIFT_CARD_DIALOG.noteInput)
+ .type(note);
}
export function saveGiftCard() {
diff --git a/cypress/steps/catalog/metadataSteps.js b/cypress/support/pages/catalog/metadataComponent.js
similarity index 84%
rename from cypress/steps/catalog/metadataSteps.js
rename to cypress/support/pages/catalog/metadataComponent.js
index 24be76360..e9f9fca31 100644
--- a/cypress/steps/catalog/metadataSteps.js
+++ b/cypress/support/pages/catalog/metadataComponent.js
@@ -1,4 +1,4 @@
-import { METADATA_FORM } from "../../elements/shared/metadata/metadata-form";
+import { METADATA_FORM } from "../../../elements/shared/metadata/metadata-form";
export const metadataForms = {
private: METADATA_FORM.privateMetadataForm,
diff --git a/cypress/steps/catalog/products/VariantsSteps.js b/cypress/support/pages/catalog/products/VariantsPage.js
similarity index 56%
rename from cypress/steps/catalog/products/VariantsSteps.js
rename to cypress/support/pages/catalog/products/VariantsPage.js
index 06603a80b..3c57ac59e 100644
--- a/cypress/steps/catalog/products/VariantsSteps.js
+++ b/cypress/support/pages/catalog/products/VariantsPage.js
@@ -1,18 +1,16 @@
-import { PRICE_LIST } from "../../../elements/catalog/products/price-list";
-import { PRODUCT_DETAILS } from "../../../elements/catalog/products/product-details";
-import { VARIANTS_SELECTORS } from "../../../elements/catalog/products/variants-selectors";
-import { AVAILABLE_CHANNELS_FORM } from "../../../elements/channels/available-channels-form";
-import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
-import { selectChannelVariantInDetailsPage } from "../../channelsSteps";
-import { waitForProgressBarToNotBeVisible } from "../../shared/progressBar";
-import { fillUpPriceList } from "./priceList";
+import { PRICE_LIST } from "../../../../elements/catalog/products/price-list";
+import { PRODUCT_DETAILS } from "../../../../elements/catalog/products/product-details";
+import { VARIANTS_SELECTORS } from "../../../../elements/catalog/products/variants-selectors";
+import { AVAILABLE_CHANNELS_FORM } from "../../../../elements/channels/available-channels-form";
+import { BUTTON_SELECTORS } from "../../../../elements/shared/button-selectors";
+import { selectChannelVariantInDetailsPage } from "../../channelsPage";
+import { fillUpPriceList } from "./priceListComponent";
export function variantsShouldBeVisible({ name, price }) {
cy.contains(PRODUCT_DETAILS.variantRow, name).should("be.visible");
cy.contains(PRODUCT_DETAILS.variantPrice, price);
- // .invoke("text")
- // .then(text => expect(text).to.includes(price));
}
+
export function createFirstVariant({ sku, warehouseId, price, attribute }) {
cy.get(PRODUCT_DETAILS.addVariantsButton).click();
cy.get(PRODUCT_DETAILS.addVariantsOptionDialog.optionMultiple).click();
@@ -29,14 +27,16 @@ export function createFirstVariant({ sku, warehouseId, price, attribute }) {
.get(VARIANTS_SELECTORS.nextButton)
.click()
.get(VARIANTS_SELECTORS.skuInput)
- .type(sku);
- cy.addAliasToGraphRequest("ProductVariantBulkCreate");
- cy.get(VARIANTS_SELECTORS.nextButton).click();
- cy.wait("@ProductVariantBulkCreate");
- waitForProgressBarToNotBeVisible()
+ .type(sku)
+ .addAliasToGraphRequest("ProductVariantBulkCreate")
+ .get(VARIANTS_SELECTORS.nextButton)
+ .click()
+ .waitForRequestAndCheckIfNoErrors("@ProductVariantBulkCreate")
+ .waitForProgressBarToNotBeVisible()
.get(AVAILABLE_CHANNELS_FORM.menageChannelsButton)
.should("be.visible");
}
+
export function createVariant({
sku,
warehouseName,
@@ -59,20 +59,25 @@ export function createVariant({
cy.contains(VARIANTS_SELECTORS.warehouseOption, warehouseName).click({
force: true
});
- cy.get(VARIANTS_SELECTORS.saveButton).click();
- cy.get(BUTTON_SELECTORS.back).click();
+ cy.get(VARIANTS_SELECTORS.saveButton)
+ .click()
+ .get(BUTTON_SELECTORS.back)
+ .click();
selectChannelVariantInDetailsPage(channelName, attributeName);
cy.get(BUTTON_SELECTORS.confirm).click();
- cy.contains(PRODUCT_DETAILS.variantRow, attributeName).click();
- cy.get(PRICE_LIST.priceInput)
+ cy.contains(PRODUCT_DETAILS.variantRow, attributeName)
+ .click()
+ .get(PRICE_LIST.priceInput)
.type(price)
.get(PRICE_LIST.costPriceInput)
- .type(costPrice);
- cy.addAliasToGraphRequest("ProductVariantChannelListingUpdate");
- cy.get(VARIANTS_SELECTORS.saveButton).click();
- cy.wait("@ProductVariantChannelListingUpdate");
- cy.get(BUTTON_SELECTORS.back).click();
- waitForProgressBarToNotBeVisible()
+ .type(costPrice)
+ .addAliasToGraphRequest("ProductVariantChannelListingUpdate")
+ .get(VARIANTS_SELECTORS.saveButton)
+ .click()
+ .waitForRequestAndCheckIfNoErrors("@ProductVariantChannelListingUpdate")
+ .get(BUTTON_SELECTORS.back)
+ .click()
+ .waitForProgressBarToNotBeVisible()
.get(AVAILABLE_CHANNELS_FORM.menageChannelsButton)
.should("be.visible");
}
diff --git a/cypress/steps/catalog/products/priceList.js b/cypress/support/pages/catalog/products/priceListComponent.js
similarity index 79%
rename from cypress/steps/catalog/products/priceList.js
rename to cypress/support/pages/catalog/products/priceListComponent.js
index 2d80f15cd..8f033a038 100644
--- a/cypress/steps/catalog/products/priceList.js
+++ b/cypress/support/pages/catalog/products/priceListComponent.js
@@ -1,9 +1,10 @@
-import { PRICE_LIST } from "../../../elements/catalog/products/price-list";
+import { PRICE_LIST } from "../../../../elements/catalog/products/price-list";
export const priceInputLists = {
sellingPrice: PRICE_LIST.priceInput,
costPrice: PRICE_LIST.costPriceInput
};
+
export function fillUpPriceList(
price = 1,
priceTypeInput = priceInputLists.sellingPrice
diff --git a/cypress/steps/catalog/products/productSteps.js b/cypress/support/pages/catalog/products/productDetailsPage.js
similarity index 83%
rename from cypress/steps/catalog/products/productSteps.js
rename to cypress/support/pages/catalog/products/productDetailsPage.js
index bf8fa35a8..57fa170d4 100644
--- a/cypress/steps/catalog/products/productSteps.js
+++ b/cypress/support/pages/catalog/products/productDetailsPage.js
@@ -1,9 +1,8 @@
-import { PRODUCT_DETAILS } from "../../../elements/catalog/products/product-details";
-import { AVAILABLE_CHANNELS_FORM } from "../../../elements/channels/available-channels-form";
-import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
-import { fillAutocompleteSelect, fillMultiSelect } from "../../shared/selects";
-import { addMetadataField } from "../metadataSteps";
-import { editSeoSettings } from "../seoSteps";
+import { PRODUCT_DETAILS } from "../../../../elements/catalog/products/product-details";
+import { AVAILABLE_CHANNELS_FORM } from "../../../../elements/channels/available-channels-form";
+import { BUTTON_SELECTORS } from "../../../../elements/shared/button-selectors";
+import { addMetadataField } from "../metadataComponent";
+import { editSeoSettings } from "../seoComponent";
const valueTrue = AVAILABLE_CHANNELS_FORM.radioButtonsValueTrue;
const valueFalse = AVAILABLE_CHANNELS_FORM.radioButtonsValueFalse;
@@ -18,17 +17,20 @@ export function updateProductIsAvailableForPurchase(
const availableForPurchaseSelector = `${AVAILABLE_CHANNELS_FORM.availableForPurchaseRadioButtons}${isAvailableForPurchaseSelector}`;
updateProductMenageInChannel(productUrl, availableForPurchaseSelector);
}
+
export function updateProductPublish(productUrl, isPublished) {
const isPublishedSelector = isPublished ? valueTrue : valueFalse;
const publishedSelector = `${AVAILABLE_CHANNELS_FORM.publishedRadioButtons}${isPublishedSelector}`;
updateProductMenageInChannel(productUrl, publishedSelector);
}
+
export function updateProductVisibleInListings(productUrl) {
updateProductMenageInChannel(
productUrl,
AVAILABLE_CHANNELS_FORM.visibleInListingsButton
);
}
+
function updateProductMenageInChannel(productUrl, menageSelector) {
cy.visit(productUrl)
.get(AVAILABLE_CHANNELS_FORM.assignedChannels)
@@ -40,6 +42,7 @@ function updateProductMenageInChannel(productUrl, menageSelector) {
.click()
.wait("@ProductChannelListingUpdate");
}
+
export function fillUpCommonFieldsForAllProductTypes(
{ generalInfo, seo, metadata, productOrganization },
createMode = true
@@ -57,6 +60,7 @@ export function fillUpCommonFieldsForAllProductTypes(
})
.then(productOrgResp => productOrgResp);
}
+
export function fillUpAllCommonFieldsInCreateAndUpdate({
generalInfo,
seo,
@@ -73,6 +77,7 @@ export function fillUpAllCommonFieldsInCreateAndUpdate({
addMetadataField(metadata.private);
});
}
+
export function fillUpProductGeneralInfo({ name, description, rating }) {
return cy
.get(PRODUCT_DETAILS.productNameInput)
@@ -83,13 +88,15 @@ export function fillUpProductGeneralInfo({ name, description, rating }) {
.get(PRODUCT_DETAILS.ratingInput)
.clearAndType(rating);
}
+
export function fillUpProductOrganization({
productType,
category,
collection
}) {
const organization = {};
- return fillAutocompleteSelect(PRODUCT_DETAILS.productTypeInput, productType)
+ return cy
+ .fillAutocompleteSelect(PRODUCT_DETAILS.productTypeInput, productType)
.then(selected => {
organization.productType = selected;
fillUpCollectionAndCategory({ category, collection });
@@ -100,12 +107,14 @@ export function fillUpProductOrganization({
return organization;
});
}
+
export function fillUpCollectionAndCategory({ category, collection }) {
const organization = {};
- return fillAutocompleteSelect(PRODUCT_DETAILS.categoryInput, category)
+ return cy
+ .fillAutocompleteSelect(PRODUCT_DETAILS.categoryInput, category)
.then(selected => {
organization.category = selected;
- fillMultiSelect(PRODUCT_DETAILS.collectionInput, collection);
+ cy.fillMultiSelect(PRODUCT_DETAILS.collectionInput, collection);
})
.then(selected => {
organization.collection = selected;
diff --git a/cypress/steps/catalog/products/productsListSteps.js b/cypress/support/pages/catalog/products/productsListPage.js
similarity index 82%
rename from cypress/steps/catalog/products/productsListSteps.js
rename to cypress/support/pages/catalog/products/productsListPage.js
index fe6620a48..38a9f6ee2 100644
--- a/cypress/steps/catalog/products/productsListSteps.js
+++ b/cypress/support/pages/catalog/products/productsListPage.js
@@ -1,11 +1,10 @@
-import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list";
-import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
+import { PRODUCTS_LIST } from "../../../../elements/catalog/products/products-list";
+import { BUTTON_SELECTORS } from "../../../../elements/shared/button-selectors";
import {
getElementByDataTestId,
SHARED_ELEMENTS
-} from "../../../elements/shared/sharedElements";
-import { urlList } from "../../../url/urlList";
-import { waitForProgressBarToNotExist } from "../../shared/progressBar";
+} from "../../../../elements/shared/sharedElements";
+import { urlList } from "../../../../fixtures/urlList";
export function isNumberOfProductsSameAsInSelectResultsOnPage() {
let numberOfResults;
@@ -40,12 +39,14 @@ export function getDisplayedColumnArray(columnName) {
})
.then(() => productsList);
}
+
export function selectFilterOption(filter, optionName) {
selectFilterBy(filter)
.get(PRODUCTS_LIST.filters.filterField[filter])
.find(PRODUCTS_LIST.filters.filterBySearchInput)
.type(optionName);
- cy.contains(PRODUCTS_LIST.filters.filterOption, optionName)
+ cy.get(PRODUCTS_LIST.filters.filterField[filter])
+ .contains(PRODUCTS_LIST.filters.filterOption, optionName)
.find(BUTTON_SELECTORS.checkbox)
.click();
submitFilters();
@@ -101,13 +102,15 @@ export function selectChannel(channelSlug) {
}
function submitFilters() {
- cy.get(BUTTON_SELECTORS.submit).click();
- waitForProgressBarToNotExist()
+ cy.get(BUTTON_SELECTORS.submit)
+ .click()
+ .waitForProgressBarToNotExist()
.get(PRODUCTS_LIST.emptyProductRow)
.should("not.exist");
}
export function enterProductListPage() {
- cy.visit(urlList.products).softExpectSkeletonIsVisible();
- waitForProgressBarToNotExist();
+ cy.visit(urlList.products)
+ .softExpectSkeletonIsVisible()
+ .waitForProgressBarToNotExist();
}
diff --git a/cypress/steps/catalog/seoSteps.js b/cypress/support/pages/catalog/seoComponent.js
similarity index 80%
rename from cypress/steps/catalog/seoSteps.js
rename to cypress/support/pages/catalog/seoComponent.js
index 22da400bc..e71a156c8 100644
--- a/cypress/steps/catalog/seoSteps.js
+++ b/cypress/support/pages/catalog/seoComponent.js
@@ -1,4 +1,4 @@
-import { SEO_FORM } from "../../elements/shared/seo/seo-form-selectors";
+import { SEO_FORM } from "../../../elements/shared/seo/seo-form-selectors";
export function editSeoSettings({ slug, title, description }) {
cy.get(SEO_FORM.editSeoSettings)
.click()
diff --git a/cypress/steps/channelsSteps.js b/cypress/support/pages/channelsPage.js
similarity index 76%
rename from cypress/steps/channelsSteps.js
rename to cypress/support/pages/channelsPage.js
index abeb593ed..0e070d4b0 100644
--- a/cypress/steps/channelsSteps.js
+++ b/cypress/support/pages/channelsPage.js
@@ -1,13 +1,12 @@
-import { ADD_CHANNEL_FORM_SELECTORS } from "../elements/channels/add-channel-form-selectors";
-import { AVAILABLE_CHANNELS_FORM } from "../elements/channels/available-channels-form";
-import { CHANNEL_FORM_SELECTORS } from "../elements/channels/channel-form-selectors";
-import { CHANNELS_SELECTORS } from "../elements/channels/channels-selectors";
-import { SELECT_CHANNELS_TO_ASSIGN } from "../elements/channels/select-channels-to-assign";
-import { HEADER_SELECTORS } from "../elements/header/header-selectors";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
-import { urlList } from "../url/urlList";
-import { fillAutocompleteSelect } from "./shared/selects";
+import { ADD_CHANNEL_FORM_SELECTORS } from "../../elements/channels/add-channel-form-selectors";
+import { AVAILABLE_CHANNELS_FORM } from "../../elements/channels/available-channels-form";
+import { CHANNEL_FORM_SELECTORS } from "../../elements/channels/channel-form-selectors";
+import { CHANNELS_SELECTORS } from "../../elements/channels/channels-selectors";
+import { SELECT_CHANNELS_TO_ASSIGN } from "../../elements/channels/select-channels-to-assign";
+import { HEADER_SELECTORS } from "../../elements/header/header-selectors";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
+import { urlList } from "../../fixtures/urlList";
export function createChannelByView({
name,
@@ -33,7 +32,7 @@ export function createChannelByView({
cy.get(ADD_CHANNEL_FORM_SELECTORS.currencyAutocompleteDropdown).click();
}
});
- fillAutocompleteSelect(
+ cy.fillAutocompleteSelect(
ADD_CHANNEL_FORM_SELECTORS.countryAutocompleteInput,
defaultCountry
);
@@ -47,11 +46,11 @@ export function addShippingZone(shippingZone) {
cy.get(BUTTON_SELECTORS.expandIcon)
.click()
.get(ADD_CHANNEL_FORM_SELECTORS.addShippingZoneButton)
- .click();
- fillAutocompleteSelect(
- ADD_CHANNEL_FORM_SELECTORS.shippingAutocompleteSelect,
- shippingZone
- );
+ .click()
+ .fillAutocompleteSelect(
+ ADD_CHANNEL_FORM_SELECTORS.shippingAutocompleteSelect,
+ shippingZone
+ );
}
export function selectChannelInPicker(channelName) {
diff --git a/cypress/steps/discounts/salesSteps.js b/cypress/support/pages/discounts/salesPage.js
similarity index 53%
rename from cypress/steps/discounts/salesSteps.js
rename to cypress/support/pages/discounts/salesPage.js
index df1fb9c34..c6b368438 100644
--- a/cypress/steps/discounts/salesSteps.js
+++ b/cypress/support/pages/discounts/salesPage.js
@@ -1,10 +1,8 @@
-import { SALES_SELECTORS } from "../../elements/discounts/sales";
-import { ASSIGN_ELEMENTS_SELECTORS } from "../../elements/shared/assign-elements-selectors";
-import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
-import { formatDate } from "../../support/format/formatDate";
-import { selectChannelInDetailsPages } from "../channelsSteps";
-import { confirmationMessageShouldDisappear } from "../shared/confirmationMessages";
-import { waitForProgressBarToNotBeVisible } from "../shared/progressBar";
+import { SALES_SELECTORS } from "../../../elements/discounts/sales";
+import { ASSIGN_ELEMENTS_SELECTORS } from "../../../elements/shared/assign-elements-selectors";
+import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
+import { formatDate } from "../../../support/formatData/formatDate";
+import { selectChannelInDetailsPages } from "../channelsPage";
export const discountOptions = {
PERCENTAGE: SALES_SELECTORS.percentageOption,
@@ -19,8 +17,9 @@ export function createSale({
}) {
const todaysDate = formatDate(new Date());
- cy.get(SALES_SELECTORS.createSaleButton).click();
- waitForProgressBarToNotBeVisible()
+ cy.get(SALES_SELECTORS.createSaleButton)
+ .click()
+ .waitForProgressBarToNotBeVisible()
.get(SALES_SELECTORS.nameInput)
.type(saleName)
.get(discountOption)
@@ -29,15 +28,16 @@ export function createSale({
cy.get(SALES_SELECTORS.discountValue)
.type(discountValue)
.get(SALES_SELECTORS.startDateInput)
- .type(todaysDate);
- cy.addAliasToGraphRequest("SaleCreate");
- cy.get(SALES_SELECTORS.saveButton).click();
- confirmationMessageShouldDisappear();
- cy.wait("@SaleCreate");
+ .type(todaysDate)
+ .addAliasToGraphRequest("SaleCreate")
+ .get(SALES_SELECTORS.saveButton)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@SaleCreate");
}
export function assignProducts(productName) {
- waitForProgressBarToNotBeVisible()
+ cy.waitForProgressBarToNotBeVisible()
.get(SALES_SELECTORS.productsTab)
.click()
.get(SALES_SELECTORS.assignProducts)
@@ -49,5 +49,5 @@ export function assignProducts(productName) {
.click();
cy.addAliasToGraphRequest("SaleCataloguesAdd");
cy.get(BUTTON_SELECTORS.submit).click();
- cy.wait("@SaleCataloguesAdd");
+ cy.waitForRequestAndCheckIfNoErrors("@SaleCataloguesAdd");
}
diff --git a/cypress/steps/discounts/vouchersSteps.js b/cypress/support/pages/discounts/vouchersPage.js
similarity index 63%
rename from cypress/steps/discounts/vouchersSteps.js
rename to cypress/support/pages/discounts/vouchersPage.js
index 58c1bd268..8afb1e4f4 100644
--- a/cypress/steps/discounts/vouchersSteps.js
+++ b/cypress/support/pages/discounts/vouchersPage.js
@@ -1,7 +1,6 @@
-import { VOUCHERS_SELECTORS } from "../../elements/discounts/vouchers";
-import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
-import { selectChannelInDetailsPages } from "../channelsSteps";
-import { confirmationMessageShouldDisappear } from "../shared/confirmationMessages";
+import { VOUCHERS_SELECTORS } from "../../../elements/discounts/vouchers";
+import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
+import { selectChannelInDetailsPages } from "../channelsPage";
export const discountOptions = {
PERCENTAGE: VOUCHERS_SELECTORS.percentageDiscountRadioButton,
@@ -24,6 +23,7 @@ export function createVoucher({
if (discountOption !== discountOptions.SHIPPING) {
cy.get(VOUCHERS_SELECTORS.discountValueInputs).type(voucherValue);
}
- cy.get(BUTTON_SELECTORS.confirm).click();
- confirmationMessageShouldDisappear();
+ cy.get(BUTTON_SELECTORS.confirm)
+ .click()
+ .confirmationMessageShouldDisappear();
}
diff --git a/cypress/support/pages/draftOrderPage.js b/cypress/support/pages/draftOrderPage.js
new file mode 100644
index 000000000..3b38d53f9
--- /dev/null
+++ b/cypress/support/pages/draftOrderPage.js
@@ -0,0 +1,41 @@
+import { DRAFT_ORDER_SELECTORS } from "../../elements/orders/draft-order-selectors";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
+import { SELECT_SHIPPING_METHOD_FORM } from "../../elements/shipping/select-shipping-method-form";
+
+export function finalizeDraftOrder(name, address) {
+ cy.get(DRAFT_ORDER_SELECTORS.addProducts)
+ .click()
+ .assignElements(name)
+ .get(DRAFT_ORDER_SELECTORS.editCustomerButton)
+ .click()
+ .get(DRAFT_ORDER_SELECTORS.selectCustomer)
+ .type(name);
+ return cy
+ .contains(DRAFT_ORDER_SELECTORS.selectCustomerOption, name)
+ .click()
+ .get(DRAFT_ORDER_SELECTORS.customerEmail)
+ .should("be.visible")
+ .get(SHARED_ELEMENTS.skeleton)
+ .should("not.exist")
+ .get(BUTTON_SELECTORS.submit)
+ .click()
+ .get(DRAFT_ORDER_SELECTORS.addShippingCarrierLink)
+ .click()
+ .get(SELECT_SHIPPING_METHOD_FORM.selectShippingMethod)
+ .click()
+ .get(SELECT_SHIPPING_METHOD_FORM.shippingMethodOption)
+ .first()
+ .click()
+ .addAliasToGraphRequest("OrderShippingMethodUpdate")
+ .get(SELECT_SHIPPING_METHOD_FORM.submitButton)
+ .click()
+ .wait("@OrderShippingMethodUpdate")
+ .getTextFromElement(DRAFT_ORDER_SELECTORS.pageHeader)
+ .as("draftOrderNumber")
+ .addAliasToGraphRequest("OrderDraftFinalize")
+ .get(DRAFT_ORDER_SELECTORS.finalizeButton)
+ .click()
+ .waitForRequestAndCheckIfNoErrors("@OrderDraftFinalize")
+ .get("@draftOrderNumber");
+}
diff --git a/cypress/support/pages/homePage.js b/cypress/support/pages/homePage.js
new file mode 100644
index 000000000..443f0298a
--- /dev/null
+++ b/cypress/support/pages/homePage.js
@@ -0,0 +1,20 @@
+import { HEADER_SELECTORS } from "../../elements/header/header-selectors";
+import { HOMEPAGE_SELECTORS } from "../../elements/homePage/homePage-selectors";
+
+export function changeChannel(channelName) {
+ cy.get(HEADER_SELECTORS.channelSelect)
+ .click()
+ .addAliasToGraphRequest("Home")
+ .get(HEADER_SELECTORS.channelSelectList)
+ .contains(channelName)
+ .click()
+ .wait("@Home");
+}
+
+export function expectWelcomeMessageIncludes(name) {
+ cy.get(HOMEPAGE_SELECTORS.welcomeMessage)
+ .invoke("text")
+ .then(text => {
+ expect(text, `welcome message should contains ${name}`).to.contains(name);
+ });
+}
diff --git a/cypress/steps/navigationSteps.js b/cypress/support/pages/navigationPage.js
similarity index 58%
rename from cypress/steps/navigationSteps.js
rename to cypress/support/pages/navigationPage.js
index aa93aae83..358565174 100644
--- a/cypress/steps/navigationSteps.js
+++ b/cypress/support/pages/navigationPage.js
@@ -1,21 +1,22 @@
-import { MENU_DETAILS } from "../elements/navigation/menu-details";
-import { MENU_LIST } from "../elements/navigation/menu-list";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
-import { menuDetailsUrl, urlList } from "../url/urlList";
-import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
+import { MENU_DETAILS } from "../../elements/navigation/menu-details";
+import { MENU_LIST } from "../../elements/navigation/menu-list";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
+import { menuDetailsUrl, urlList } from "../../fixtures/urlList";
export function createMenu(name) {
- cy.visit(urlList.navigation)
+ return cy
+ .visit(urlList.navigation)
.get(MENU_LIST.addMenuButton)
.click()
.get(MENU_LIST.createMenuForm.nameInput)
.type(name)
.addAliasToGraphRequest("MenuCreate")
.get(BUTTON_SELECTORS.submit)
- .click();
- confirmationMessageShouldDisappear();
- return cy.wait("@MenuCreate").its("response.body.data.menuCreate.menu");
+ .click()
+ .confirmationMessageShouldDisappear()
+ .wait("@MenuCreate")
+ .its("response.body.data.menuCreate.menu");
}
export function createNewMenuItem({ menuId, name, menuItemType }) {
@@ -34,17 +35,16 @@ export function createNewMenuItem({ menuId, name, menuItemType }) {
.should("be.not.visible")
.get(MENU_DETAILS.newMenuItemForm[menuItemType])
.click()
- .get(MENU_DETAILS.newMenuItemForm[menuItemType])
- .first()
+ .get(MENU_DETAILS.newMenuItemForm.anyMenuItem)
.click()
.invoke("text")
.then(text => {
selectedItem = text;
cy.addAliasToGraphRequest("MenuItemCreate")
.get(BUTTON_SELECTORS.submit)
- .click();
- confirmationMessageShouldDisappear();
- cy.wait("@MenuItemCreate");
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@MenuItemCreate");
})
.then(() => selectedItem);
}
diff --git a/cypress/steps/pageSteps.js b/cypress/support/pages/pagesPage.js
similarity index 68%
rename from cypress/steps/pageSteps.js
rename to cypress/support/pages/pagesPage.js
index dffae49a7..8359eee0d 100644
--- a/cypress/steps/pageSteps.js
+++ b/cypress/support/pages/pagesPage.js
@@ -1,10 +1,8 @@
-import { PAGE_DETAILS } from "../elements/pages/page-details";
-import { PAGES_LIST } from "../elements/pages/pages-list";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
-import { urlList } from "../url/urlList";
-import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
-import { fillAutocompleteSelect } from "./shared/selects";
+import { PAGE_DETAILS } from "../../elements/pages/page-details";
+import { PAGES_LIST } from "../../elements/pages/pages-list";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
+import { urlList } from "../../fixtures/urlList";
export const attributesTypes = {
DROPDOWN: addSelectAttributeValue,
@@ -26,7 +24,7 @@ export function createPage({
}
export function addSelectAttributeValue(attributeValue) {
- fillAutocompleteSelect(PAGE_DETAILS.attributeValues, attributeValue);
+ cy.fillAutocompleteSelect(PAGE_DETAILS.attributeValues, attributeValue);
}
export function addRichTextAttributeValue(attributeValue) {
@@ -60,16 +58,18 @@ function openCreatePageAndFillUpGeneralFields({
if (isPublished) {
cy.get(PAGE_DETAILS.isPublishedCheckbox).click();
}
- fillAutocompleteSelect(
+ cy.fillAutocompleteSelect(
PAGE_DETAILS.pageTypesAutocompleteSelect,
pageTypeName
);
}
function savePage() {
- cy.addAliasToGraphRequest("PageCreate")
+ return cy
+ .addAliasToGraphRequest("PageCreate")
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- return cy.wait("@PageCreate").its("response.body.data.pageCreate.page");
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@PageCreate")
+ .its("response.body.data.pageCreate.page");
}
diff --git a/cypress/steps/permissions.js b/cypress/support/pages/permissionsPage.js
similarity index 90%
rename from cypress/steps/permissions.js
rename to cypress/support/pages/permissionsPage.js
index 0ac9962c7..9a4ce2095 100644
--- a/cypress/steps/permissions.js
+++ b/cypress/support/pages/permissionsPage.js
@@ -1,6 +1,6 @@
-import { LEFT_MENU_SELECTORS } from "../elements/account/left-menu/left-menu-selectors";
-import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
-import { urlList } from "../url/urlList";
+import { LEFT_MENU_SELECTORS } from "../../elements/account/left-menu/left-menu-selectors";
+import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
+import { urlList } from "../../fixtures/urlList";
export function navigateToAllAvailablePageAndCheckIfDisplayed({
user,
diff --git a/cypress/steps/productTypeSteps.js b/cypress/support/pages/productTypePage.js
similarity index 51%
rename from cypress/steps/productTypeSteps.js
rename to cypress/support/pages/productTypePage.js
index dd21f37ab..a358e3f41 100644
--- a/cypress/steps/productTypeSteps.js
+++ b/cypress/support/pages/productTypePage.js
@@ -1,11 +1,11 @@
-import { PRODUCT_TYPE_DETAILS } from "../elements/productTypes/productTypeDetails";
-import { PRODUCT_TYPES_LIST } from "../elements/productTypes/productTypesList";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { waitForProgressBarToNotBeVisible } from "./shared/progressBar";
+import { PRODUCT_TYPE_DETAILS } from "../../elements/productTypes/productTypeDetails";
+import { PRODUCT_TYPES_LIST } from "../../elements/productTypes/productTypesList";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
export function createProductType(name, shippingWeight) {
- cy.get(PRODUCT_TYPES_LIST.addProductTypeButton).click();
- waitForProgressBarToNotBeVisible()
+ cy.get(PRODUCT_TYPES_LIST.addProductTypeButton)
+ .click()
+ .waitForProgressBarToNotBeVisible()
.get(PRODUCT_TYPE_DETAILS.nameInput)
.type(name);
if (shippingWeight) {
@@ -18,6 +18,6 @@ export function createProductType(name, shippingWeight) {
.addAliasToGraphRequest("ProductTypeCreate")
.get(BUTTON_SELECTORS.confirm)
.click()
- .wait("@ProductTypeCreate")
+ .waitForRequestAndCheckIfNoErrors("@ProductTypeCreate")
.its("response.body.data.productTypeCreate.productType");
}
diff --git a/cypress/steps/shippingMethodSteps.js b/cypress/support/pages/shippingMethodPage.js
similarity index 68%
rename from cypress/steps/shippingMethodSteps.js
rename to cypress/support/pages/shippingMethodPage.js
index f4118ff1a..119c028b6 100644
--- a/cypress/steps/shippingMethodSteps.js
+++ b/cypress/support/pages/shippingMethodPage.js
@@ -1,11 +1,8 @@
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
-import { SHIPPING_RATE_DETAILS } from "../elements/shipping/shipping-rate-details";
-import { SHIPPING_ZONE_DETAILS } from "../elements/shipping/shipping-zone-details";
-import { SHIPPING_ZONES_LIST } from "../elements/shipping/shipping-zones-list";
-import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
-import { waitForProgressBarToNotBeVisible } from "./shared/progressBar";
-import { fillBaseSelect } from "./shared/selects";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
+import { SHIPPING_RATE_DETAILS } from "../../elements/shipping/shipping-rate-details";
+import { SHIPPING_ZONE_DETAILS } from "../../elements/shipping/shipping-zone-details";
+import { SHIPPING_ZONES_LIST } from "../../elements/shipping/shipping-zones-list";
export function createShippingZone(
shippingName,
@@ -27,9 +24,9 @@ export function createShippingZone(
.get(SHIPPING_ZONE_DETAILS.submitAssignCountry)
.click()
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- cy.get(SHIPPING_ZONE_DETAILS.warehouseSelector)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .get(SHIPPING_ZONE_DETAILS.warehouseSelector)
.click()
.get(SHIPPING_ZONE_DETAILS.warehouseSelector)
.type(warehouseName)
@@ -41,19 +38,22 @@ export function createShippingZone(
.click()
.get(SHIPPING_ZONE_DETAILS.option)
.contains(channelName)
- .click();
- cy.addAliasToGraphRequest("UpdateShippingZone");
- cy.get(BUTTON_SELECTORS.confirm).click();
- confirmationMessageShouldDisappear();
- cy.wait("@UpdateShippingZone");
+ .click()
+ .addAliasToGraphRequest("UpdateShippingZone")
+ .get(BUTTON_SELECTORS.confirm)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@UpdateShippingZone");
}
export function changeWeightUnit(weightUnit) {
- fillBaseSelect(SHIPPING_ZONES_LIST.unitSelect, weightUnit);
- cy.addAliasToGraphRequest("UpdateDefaultWeightUnit");
- cy.get(SHIPPING_ZONES_LIST.saveUnit).click();
- confirmationMessageShouldDisappear();
- cy.wait("@UpdateDefaultWeightUnit").wait(5000);
+ cy.fillBaseSelect(SHIPPING_ZONES_LIST.unitSelect, weightUnit)
+ .addAliasToGraphRequest("UpdateDefaultWeightUnit")
+ .get(SHIPPING_ZONES_LIST.saveUnit)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors("@UpdateDefaultWeightUnit")
+ .wait(5000);
}
export function createShippingRate({
@@ -80,9 +80,10 @@ export function enterAndFillUpShippingRate({
weightLimits,
deliveryTime
}) {
- cy.get(rateOption).click();
- waitForProgressBarToNotBeVisible();
- cy.get(SHARED_ELEMENTS.richTextEditor.empty)
+ cy.get(rateOption)
+ .click()
+ .waitForProgressBarToNotBeVisible()
+ .get(SHARED_ELEMENTS.richTextEditor.empty)
.should("exist")
.get(SHIPPING_RATE_DETAILS.inputName)
.type(rateName);
@@ -120,14 +121,14 @@ export function createRateWithPostalCode({
}
export function saveRate() {
- cy.addAliasToGraphRequest("ShippingMethodChannelListingUpdate")
+ return cy
+ .addAliasToGraphRequest("ShippingMethodChannelListingUpdate")
.addAliasToGraphRequest("ShippingZone")
.get(BUTTON_SELECTORS.confirm)
- .click();
- confirmationMessageShouldDisappear();
- return cy
- .wait(`@ShippingMethodChannelListingUpdate`)
- .wait(`@ShippingZone`)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .waitForRequestAndCheckIfNoErrors(`@ShippingMethodChannelListingUpdate`)
+ .waitForRequestAndCheckIfNoErrors(`@ShippingZone`)
.its("response.body.0.data.shippingZone");
}
diff --git a/cypress/support/pages/userPage.js b/cypress/support/pages/userPage.js
new file mode 100644
index 000000000..abd44f13a
--- /dev/null
+++ b/cypress/support/pages/userPage.js
@@ -0,0 +1,43 @@
+import { SET_PASSWORD } from "../../elements/account/setPassword";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { INVITE_STAFF_MEMBER_FORM } from "../../elements/staffMembers/inviteStaffMemberForm";
+import { STAFF_MEMBER_DETAILS } from "../../elements/staffMembers/staffMemberDetails";
+import { userDetailsUrl } from "../../fixtures/urlList";
+
+export function fillUpSetPassword(password) {
+ cy.get(SET_PASSWORD.confirmPasswordInput)
+ .type(password)
+ .get(SET_PASSWORD.passwordInput)
+ .type(password)
+ .addAliasToGraphRequest("SetPassword")
+ .get(BUTTON_SELECTORS.confirm)
+ .click()
+ .waitForRequestAndCheckIfNoErrors("@SetPassword");
+}
+
+export function fillUpUserDetails(firstName, lastName, email) {
+ cy.get(INVITE_STAFF_MEMBER_FORM.firstNameInput)
+ .type(firstName)
+ .get(INVITE_STAFF_MEMBER_FORM.lastNameInput)
+ .type(lastName)
+ .get(INVITE_STAFF_MEMBER_FORM.emailInput)
+ .type(email)
+ .get(BUTTON_SELECTORS.submit)
+ .click()
+ .confirmationMessageShouldDisappear()
+ .fillAutocompleteSelect(STAFF_MEMBER_DETAILS.permissionsSelect)
+ .addAliasToGraphRequest("StaffMemberUpdate")
+ .get(BUTTON_SELECTORS.confirm)
+ .click()
+ .waitForRequestAndCheckIfNoErrors("@StaffMemberUpdate");
+}
+
+export function updateUserActiveFlag(userId) {
+ cy.visitAndWaitForProgressBarToDisappear(userDetailsUrl(userId))
+ .get(STAFF_MEMBER_DETAILS.isActiveCheckBox)
+ .click()
+ .addAliasToGraphRequest("StaffMemberUpdate")
+ .get(BUTTON_SELECTORS.confirm)
+ .click()
+ .waitForRequestAndCheckIfNoErrors("@StaffMemberUpdate");
+}
diff --git a/cypress/utils/attributes/attributeUtils.js b/cypress/utils/attributes/attributeUtils.js
deleted file mode 100644
index 442717b14..000000000
--- a/cypress/utils/attributes/attributeUtils.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import { deleteAttribute, getAttributes } from "../../apiRequests/Attribute";
-
-export function deleteAttributesStartsWith(startsWith) {
- cy.deleteElementsStartsWith(deleteAttribute, getAttributes, startsWith);
-}
diff --git a/package-lock.json b/package-lock.json
index f36014fe8..626331617 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1678,9 +1678,9 @@
}
},
"@cypress/request": {
- "version": "2.88.5",
- "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.5.tgz",
- "integrity": "sha512-TzEC1XMi1hJkywWpRfD2clreTa/Z+lOrXDCxxBTBPEcY5azdPi56A6Xw+O4tWJnaJH3iIE7G5aDXZC6JgRZLcA==",
+ "version": "2.88.6",
+ "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.6.tgz",
+ "integrity": "sha512-z0UxBE/+qaESAHY9p9sM2h8Y4XqtsbDCt0/DPOrqA/RZgKi4PkxdpXyK4wCCnSk1xHqWHZZAE+gV6aDAR6+caQ==",
"dev": true,
"requires": {
"aws-sign2": "~0.7.0",
@@ -1696,13 +1696,12 @@
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.19",
- "oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.2",
"safe-buffer": "^5.1.2",
"tough-cookie": "~2.5.0",
"tunnel-agent": "^0.6.0",
- "uuid": "^3.3.2"
+ "uuid": "^8.3.2"
},
"dependencies": {
"qs": {
@@ -1710,6 +1709,12 @@
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
"dev": true
+ },
+ "uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
+ "dev": true
}
}
},
@@ -12010,7 +12015,6 @@
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz",
"integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==",
- "dev": true,
"requires": {
"node-fetch": "2.6.1"
}
@@ -12295,12 +12299,12 @@
"dev": true
},
"cypress": {
- "version": "8.3.0",
- "resolved": "https://registry.npmjs.org/cypress/-/cypress-8.3.0.tgz",
- "integrity": "sha512-zA5Rcq8AZIfRfPXU0CCcauofF+YpaU9HYbfqkunFTmFV0Kdlo14tNjH2E3++MkjXKFnv3/pXq+HgxWtw8CSe8Q==",
+ "version": "8.4.1",
+ "resolved": "https://registry.npmjs.org/cypress/-/cypress-8.4.1.tgz",
+ "integrity": "sha512-itJXq0Vx3sXCUrDyBi2IUrkxVu/gTTp1VhjB5tzGgkeCR8Ae+/T8WV63rsZ7fS8Tpq7LPPXiyoM/sEdOX7cR6A==",
"dev": true,
"requires": {
- "@cypress/request": "^2.88.5",
+ "@cypress/request": "^2.88.6",
"@cypress/xvfb": "^1.2.4",
"@types/node": "^14.14.31",
"@types/sinonjs__fake-timers": "^6.0.2",
@@ -12406,6 +12410,12 @@
"string-width": "^4.2.0"
}
},
+ "colorette": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz",
+ "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==",
+ "dev": true
+ },
"commander": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz",
@@ -12468,13 +12478,13 @@
}
},
"listr2": {
- "version": "3.11.0",
- "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.11.0.tgz",
- "integrity": "sha512-XLJVe2JgXCyQTa3FbSv11lkKExYmEyA4jltVo8z4FX10Vt1Yj8IMekBfwim0BSOM9uj1QMTJvDQQpHyuPbB/dQ==",
+ "version": "3.12.1",
+ "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.12.1.tgz",
+ "integrity": "sha512-oB1DlXlCzGPbvWhqYBZUQEPJKqsmebQWofXG6Mpbe3uIvoNl8mctBEojyF13ZyqwQ91clCWXpwsWp+t98K4FOQ==",
"dev": true,
"requires": {
"cli-truncate": "^2.1.0",
- "colorette": "^1.2.2",
+ "colorette": "^1.4.0",
"log-update": "^4.0.0",
"p-map": "^4.0.0",
"rxjs": "^6.6.7",
@@ -12649,9 +12659,9 @@
"integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw=="
},
"dayjs": {
- "version": "1.10.6",
- "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.6.tgz",
- "integrity": "sha512-AztC/IOW4L1Q41A86phW5Thhcrco3xuAA+YX/BLpLWWjRcTj5TOt/QImBLmCKlrF7u7k47arTnOyL6GnbG8Hvw==",
+ "version": "1.10.7",
+ "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz",
+ "integrity": "sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig==",
"dev": true
},
"debounce": {
@@ -16521,7 +16531,6 @@
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-3.5.0.tgz",
"integrity": "sha512-Io89QpfU4rqiMbqM/KwMBzKaDLOppi8FU8sEccCE4JqCgz95W9Q8bvxQ4NfPALLSMvg9nafgg8AkYRmgKSlukA==",
- "dev": true,
"requires": {
"cross-fetch": "^3.0.6",
"extract-files": "^9.0.0",
@@ -16531,14 +16540,12 @@
"extract-files": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz",
- "integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==",
- "dev": true
+ "integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ=="
},
"form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
- "dev": true,
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
diff --git a/package.json b/package.json
index 6909b1b73..174c46514 100644
--- a/package.json
+++ b/package.json
@@ -54,6 +54,7 @@
"fast-array-diff": "^0.2.0",
"fuzzaldrin": "^2.1.0",
"graphql": "^15.4.0",
+ "graphql-request": "^3.5.0",
"graphql-tag": "^2.11.0",
"hotkeys-js": "^3.8.1",
"is-url": "^1.2.4",
@@ -145,7 +146,7 @@
"codecov": "^3.7.1",
"core-js": "^3.7.0",
"cross-env": "^6.0.3",
- "cypress": "^8.3.0",
+ "cypress": "^8.4.1",
"cypress-file-upload": "^5.0.8",
"dotenv": "^10.0.0",
"enzyme": "^3.11.0",
diff --git a/src/components/Filter/FilterContent/FilterContent.tsx b/src/components/Filter/FilterContent/FilterContent.tsx
index c65c64de5..657378fd0 100644
--- a/src/components/Filter/FilterContent/FilterContent.tsx
+++ b/src/components/Filter/FilterContent/FilterContent.tsx
@@ -212,6 +212,7 @@ const FilterContent: React.FC = ({
key={filter.name}
classes={expanderClasses}
data-test="channel-availability-item"
+ data-test-id={filter.name}
expanded={filter.name === openedFilter?.name}
>