Saleor 4437 refactor tests (#1389)

* reference type cypress working

* refactor

* remove screenshots

* add reference

* add slash marker

* run tests based on shop version

* fix run tests based on shop version

* fix run tests based on shop version

* change base url to localhost

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix yml

* fix yml

* chage file names

* fix files names

* fix broken imports add checking for errors in grpah responses

* fix broken imports add checking for errors in grpah responses

* update jest

* fix snapshot
This commit is contained in:
Karolina Rakoczy 2021-09-27 12:04:21 +02:00 committed by GitHub
parent b98f069aab
commit 2c64a966cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 1629 additions and 1294 deletions

View file

@ -167,7 +167,7 @@
"sort-imports": "off", // imports are handled by simple-import-sort/sort "sort-imports": "off", // imports are handled by simple-import-sort/sort
"sort-keys": "off", "sort-keys": "off",
"space-before-function-paren": "off", "space-before-function-paren": "off",
"spaced-comment": "error", "spaced-comment": ["error", "always", { "markers": ["/"] }],
"use-isnan": "error", "use-isnan": "error",
"valid-typeof": "off", "valid-typeof": "off",
"no-restricted-imports": [ "no-restricted-imports": [

View file

@ -8,7 +8,7 @@ on:
jobs: jobs:
cypress-run: 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'))) 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: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1

View file

@ -5,6 +5,7 @@ export const MENU_DETAILS = {
autocompleteSelectReference: '[data-test-id="containerAutocompleteSelect"]', autocompleteSelectReference: '[data-test-id="containerAutocompleteSelect"]',
categoryItem: '[data-test-id="category"]', categoryItem: '[data-test-id="category"]',
collectionItem: '[data-test-id="collection"]', collectionItem: '[data-test-id="collection"]',
pageItem: '[data-test-id="page"]' pageItem: '[data-test-id="page"]',
anyMenuItem: '[id="downshift-0-item-2"]'
} }
}; };

View file

@ -1,17 +1,19 @@
/// <reference types="cypress"/>
/// <reference types="../support"/>
import faker from "faker"; 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 { APP_DETAILS } from "../elements/apps/appDetails";
import { APPS_LIST } from "../elements/apps/appsList"; import { APPS_LIST } from "../elements/apps/appsList";
import { WEBHOOK_DETAILS } from "../elements/apps/webhookDetails"; import { WEBHOOK_DETAILS } from "../elements/apps/webhookDetails";
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
import { 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 filterTests from "../support/filterTests";
import { appDetailsUrl, urlList } from "../url/urlList";
import { deleteAppsStartsWith } from "../utils/appUtils";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Tests for apps", () => { describe("Tests for apps", () => {
const startsWith = "Apps"; const startsWith = "Apps";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
@ -45,9 +47,9 @@ filterTests(["all"], () => {
.click() .click()
.addAliasToGraphRequest("AppCreate") .addAliasToGraphRequest("AppCreate")
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear()
cy.wait("@AppCreate") .waitForRequestAndCheckIfNoErrors("@AppCreate")
.its("response.body.data.appCreate.app") .its("response.body.data.appCreate.app")
.then(app => { .then(app => {
getApp(app.id); getApp(app.id);
@ -71,8 +73,8 @@ filterTests(["all"], () => {
.get(WEBHOOK_DETAILS.targetUrlInput) .get(WEBHOOK_DETAILS.targetUrlInput)
.type(targetUrl) .type(targetUrl)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
getApp(createdApp.id).then(({ webhooks }) => { getApp(createdApp.id).then(({ webhooks }) => {
expect(webhooks[0].name).to.eq(randomName); expect(webhooks[0].name).to.eq(randomName);
expect(webhooks[0].targetUrl).to.eq(targetUrl); expect(webhooks[0].targetUrl).to.eq(targetUrl);

View file

@ -1,21 +1,22 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { getCategory } from "../apiRequests/Category"; import { CATEGORIES_LIST } from "../../elements/catalog/categories/categories-list";
import { CATEGORIES_LIST } from "../elements/catalog/categories/categories-list"; import { CATEGORY_DETAILS } from "../../elements/catalog/categories/category-details";
import { CATEGORY_DETAILS } from "../elements/catalog/categories/category-details"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { SHARED_ELEMENTS } from "../elements/shared/sharedElements"; import { categoryDetailsUrl, urlList } from "../../fixtures/urlList";
import { createCategory } from "../steps/categoriesSteps"; import { getCategory } from "../../support/api/requests/Category";
import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages"; import { deleteCategoriesStartsWith } from "../../support/api/utils/categoryUtils";
import filterTests from "../support/filterTests"; import * as channelsUtils from "../../support/api/utils/channelsUtils";
import { categoryDetailsUrl, urlList } from "../url/urlList"; import * as productsUtils from "../../support/api/utils/products/productsUtils";
import { deleteCategoriesStartsWith } from "../utils/categoryUtils"; import { deleteShippingStartsWith } from "../../support/api/utils/shippingUtils";
import * as channelsUtils from "../utils/channelsUtils"; import filterTests from "../../support/filterTests";
import * as productsUtils from "../utils/products/productsUtils"; import { createCategory } from "../../support/pages/catalog/categoriesPage";
import { deleteShippingStartsWith } from "../utils/shippingUtils";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Categories", () => { describe("Categories", () => {
const startsWith = "CyCollections"; const startsWith = "CyCollections";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
@ -118,11 +119,11 @@ filterTests(["all"], () => {
.click() .click()
.addAliasToGraphRequest("productBulkDelete") .addAliasToGraphRequest("productBulkDelete")
.get(BUTTON_SELECTORS.submit) .get(BUTTON_SELECTORS.submit)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
cy.contains(CATEGORY_DETAILS.productRow, product.name) cy.contains(CATEGORY_DETAILS.productRow, product.name)
.should("not.exist") .should("not.exist")
.wait("@productBulkDelete"); .waitForRequestAndCheckIfNoErrors("@productBulkDelete");
getCategory(category.id).then(categoryResp => { getCategory(category.id).then(categoryResp => {
expect(categoryResp.products.edges.length).to.be.eq(0); expect(categoryResp.products.edges.length).to.be.eq(0);
}); });

View file

@ -1,27 +1,29 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { createChannel } from "../apiRequests/Channels"; import { urlList } from "../../fixtures/urlList";
import { updateChannelInProduct } from "../apiRequests/Product"; import { createChannel } from "../../support/api/requests/Channels";
import { getCollection } from "../apiRequests/storeFront/Collections"; import { updateChannelInProduct } from "../../support/api/requests/Product";
import { searchInShop } from "../apiRequests/storeFront/Search"; import { getCollection } from "../../support/api/requests/storeFront/Collections";
import { import { searchInShop } from "../../support/api/requests/storeFront/Search";
assignProductsToCollection, import * as channelsUtils from "../../support/api/utils/channelsUtils";
createCollection import { deleteCollectionsStartsWith } from "../../support/api/utils/collectionsUtils";
} from "../steps/collectionsSteps"; import * as productsUtils from "../../support/api/utils/products/productsUtils";
import filterTests from "../support/filterTests"; import { deleteShippingStartsWith } from "../../support/api/utils/shippingUtils";
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 { import {
isCollectionVisible, isCollectionVisible,
isProductInCollectionVisible isProductInCollectionVisible
} from "../utils/storeFront/collectionsUtils"; } from "../../support/api/utils/storeFront/collectionsUtils";
import { isProductVisibleInSearchResult } from "../utils/storeFront/storeFrontProductUtils"; 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", () => { describe("Collections", () => {
const startsWith = "CyCollections-"; const startsWith = "CyCollections-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,7 +1,11 @@
// <reference types="cypress" /> /// <reference types="cypress" />
/// <reference types="../../support"/>
import faker from "faker"; 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 { import {
expiryPeriods, expiryPeriods,
openAndFillUpCreateGiftCardDialog, openAndFillUpCreateGiftCardDialog,
@ -9,11 +13,9 @@ import {
setExpiryDate, setExpiryDate,
setExpiryPeriod, setExpiryPeriod,
setNeverExpire setNeverExpire
} from "../steps/giftCardSteps"; } from "../../support/pages/catalog/giftCardPage";
import filterTests from "../support/filterTests";
import { formatDate } from "../support/format/formatDate";
filterTests(["all"], () => { filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
describe("Tests for gift cards", () => { describe("Tests for gift cards", () => {
const startsWith = "GiftCards"; const startsWith = "GiftCards";
const amount = 50; const amount = 50;

View file

@ -1,25 +1,26 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { createChannel } from "../../apiRequests/Channels"; import { createChannel } from "../../support/api/requests/Channels";
import { import {
addProductsToCheckout, addProductsToCheckout,
addShippingMethod, addShippingMethod,
createCheckout createCheckout
} from "../../apiRequests/Checkout"; } from "../../support/api/requests/Checkout";
import filterTests from "../../support/filterTests";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../utils/products/productsUtils"; } from "../../support/api/utils/products/productsUtils";
import { import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../utils/shippingUtils"; } from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Products without shipment option", () => { describe("Products without shipment option", () => {
const startsWith = "WithoutShipmentCheckout-"; const startsWith = "WithoutShipmentCheckout-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,33 +1,36 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { createAttribute } from "../../apiRequests/Attribute"; import { createAttribute } from "../../support/api/requests/Attribute";
import { createCategory } from "../../apiRequests/Category"; import { createCategory } from "../../support/api/requests/Category";
import { import {
checkoutShippingAddressUpdate, checkoutShippingAddressUpdate,
checkoutShippingMethodUpdate, checkoutShippingMethodUpdate,
checkoutVariantsUpdate, checkoutVariantsUpdate,
completeCheckout, completeCheckout,
createCheckout createCheckout
} from "../../apiRequests/Checkout"; } from "../../support/api/requests/Checkout";
import { getOrder } from "../../apiRequests/Order"; import { getOrder } from "../../support/api/requests/Order";
import { createTypeProduct } from "../../apiRequests/productType"; import { createTypeProduct } from "../../support/api/requests/ProductType";
import filterTests from "../../support/filterTests"; import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import { getDefaultChannel } from "../../utils/channelsUtils";
import { import {
addPayment, addPayment,
createAndCompleteCheckoutWithoutShipping, createAndCompleteCheckoutWithoutShipping,
createWaitingForCaptureOrder createWaitingForCaptureOrder
} from "../../utils/ordersUtils"; } from "../../support/api/utils/ordersUtils";
import { import {
createProductInChannel, createProductInChannel,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../utils/products/productsUtils"; } from "../../support/api/utils/products/productsUtils";
import { import {
createShipping, createShipping,
deleteShippingStartsWith 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", () => { describe("Purchase products with all products types", () => {
const startsWith = `CyPurchaseByType`; const startsWith = `CyPurchaseByType`;
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,24 +1,27 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { import {
addProductsToCheckout, addProductsToCheckout,
createCheckout createCheckout
} from "../../apiRequests/Checkout"; } from "../../support/api/requests/Checkout";
import { getVariants } from "../../apiRequests/Product"; import { getVariants } from "../../support/api/requests/Product";
import filterTests from "../../support/filterTests"; import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import { getDefaultChannel } from "../../utils/channelsUtils"; import { createOrderWithNewProduct } from "../../support/api/utils/ordersUtils";
import { createOrderWithNewProduct } from "../../utils/ordersUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../utils/products/productsUtils"; } from "../../support/api/utils/products/productsUtils";
import { import {
createShipping, createShipping,
deleteShippingStartsWith 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", () => { describe("Products stocks in checkout", () => {
const startsWith = "CyStocksCheckout-"; const startsWith = "CyStocksCheckout-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,19 +1,22 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { createCheckout } from "../../apiRequests/Checkout"; import { createCheckout } from "../../support/api/requests/Checkout";
import filterTests from "../../support/filterTests"; import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import { getDefaultChannel } from "../../utils/channelsUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../utils/products/productsUtils"; } from "../../support/api/utils/products/productsUtils";
import { import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../utils/shippingUtils"; } from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Warehouses in checkout", () => { describe("Warehouses in checkout", () => {
const startsWith = `CyWarehouseCheckout`; const startsWith = `CyWarehouseCheckout`;
let defaultChannel; let defaultChannel;

View file

@ -1,16 +1,17 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { getAttribute } from "../../../apiRequests/Attribute";
import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list"; 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 filterTests from "../../../support/filterTests";
import { urlList } from "../../../url/urlList"; import { createAttributeWithInputType } from "../../../support/pages/attributesPage";
import { deleteAttributesStartsWith } from "../../../utils/attributes/attributeUtils";
import { expectCorrectDataInAttribute } from "../../../utils/attributes/checkAttributeData";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Create attribute with type", () => { describe("Create attribute with type", () => {
const startsWith = "AttrCreate"; const startsWith = "AttrCreate";
const attributesTypes = [ const attributesTypes = [

View file

@ -1,15 +1,18 @@
/// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { getAttribute } from "../../../apiRequests/Attribute";
import { ATTRIBUTES_DETAILS } from "../../../elements/attribute/attributes_details"; import { ATTRIBUTES_DETAILS } from "../../../elements/attribute/attributes_details";
import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list"; import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list";
import { 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 filterTests from "../../../support/filterTests";
import { urlList } from "../../../url/urlList"; import { createAttributeWithInputType } from "../../../support/pages/attributesPage";
import { deleteAttributesStartsWith } from "../../../utils/attributes/attributeUtils";
import { expectCorrectDataInAttribute } from "../../../utils/attributes/checkAttributeData";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Create content attribute", () => { describe("Create content attribute", () => {
const startsWith = "AttrCont"; const startsWith = "AttrCont";
const attributesTypes = [ const attributesTypes = [

View file

@ -1,17 +1,25 @@
import { updateAttribute } from "../../../apiRequests/Attribute"; /// <reference types="cypress"/>
import { createProduct } from "../../../apiRequests/Product"; /// <reference types="../../../support"/>
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 { import {
enterProductListPage, enterProductListPage,
selectAttributeFilter, selectAttributeFilter,
showFilters showFilters
} from "../../../steps/catalog/products/productsListSteps"; } from "../../../support/pages/catalog/products/productsListPage";
import {
createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith
} from "../../../utils/products/productsUtils";
filterTests({ definedTags: ["all"] }, () => {
describe("Tests for using attributes in filters", () => { describe("Tests for using attributes in filters", () => {
const startsWith = "AttrFilter"; const startsWith = "AttrFilter";
@ -42,16 +50,20 @@ describe("Tests for using attributes in filters", () => {
enterAttributeAndChanegeIsFilterableInDashbord(attribute.id); enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
enterProductListPage(); enterProductListPage();
selectAttributeFilter(attribute.slug, attribute.name); selectAttributeFilter(attribute.slug, attribute.name);
cy.contains(SHARED_ELEMENTS.tableRow, attribute.name).should("be.visible"); cy.contains(SHARED_ELEMENTS.tableRow, attribute.name).should(
"be.visible"
);
}); });
it("should remove attribute from filters", () => { it("should remove attribute from filters", () => {
updateAttribute({ attributeId: attribute.id, filterableInDashboard: true }); updateAttribute({
attributeId: attribute.id,
filterableInDashboard: true
});
enterAttributeAndChanegeIsFilterableInDashbord(attribute.id); enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
enterProductListPage(); enterProductListPage();
showFilters(); showFilters();
cy.contains(SHARED_ELEMENTS.filters.filterRow, attribute.name).should( cy.get(getElementByDataTestId(attribute.name)).should("not.exist");
"not.exist" });
);
}); });
}); });

View file

@ -1,27 +1,27 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; 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 { import {
createShippingZone, createShippingZone,
getShippingZone getShippingZone
} from "../../apiRequests/ShippingMethod"; } from "../../../support/api/requests/ShippingMethod";
import { ONE_PERMISSION_USERS } from "../../Data/users"; import { deleteChannelsStartsWith } from "../../../support/api/utils/channelsUtils";
import { PRODUCTS_LIST } from "../../elements/catalog/products/products-list"; import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
import { ADD_CHANNEL_FORM_SELECTORS } from "../../elements/channels/add-channel-form-selectors"; import filterTests from "../../../support/filterTests";
import { AVAILABLE_CHANNELS_FORM } from "../../elements/channels/available-channels-form"; import { createChannelByView } from "../../../support/pages/channelsPage";
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";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Channels", () => { describe("Channels", () => {
const channelStartsWith = `CyChannels`; const channelStartsWith = `CyChannels`;
const randomName = `${channelStartsWith} ${faker.datatype.number()}`; const randomName = `${channelStartsWith} ${faker.datatype.number()}`;
@ -50,9 +50,9 @@ filterTests(["all"], () => {
cy.addAliasToGraphRequest("Channels"); cy.addAliasToGraphRequest("Channels");
cy.visit(urlList.channels); cy.visit(urlList.channels);
cy.softExpectSkeletonIsVisible(); cy.softExpectSkeletonIsVisible();
cy.wait("@Channels"); cy.waitForRequestAndCheckIfNoErrors("@Channels");
createChannelByView({ name: randomChannel, currency }); createChannelByView({ name: randomChannel, currency });
cy.wait("@Channel"); cy.waitForRequestAndCheckIfNoErrors("@Channel");
// New channel should be visible in channels list // New channel should be visible in channels list
cy.get(ADD_CHANNEL_FORM_SELECTORS.backToChannelsList) cy.get(ADD_CHANNEL_FORM_SELECTORS.backToChannelsList)
@ -71,11 +71,12 @@ filterTests(["all"], () => {
// new channel should be visible at product availability form // new channel should be visible at product availability form
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
cy.addAliasToGraphRequest("InitialProductFilterAttributes"); cy.addAliasToGraphRequest("InitialProductFilterAttributes");
cy.visit(urlList.products); cy.visit(urlList.products)
cy.wait("@InitialProductFilterAttributes"); .waitForRequestAndCheckIfNoErrors("@InitialProductFilterAttributes")
waitForProgressBarToNotExist(); .waitForProgressBarToNotExist()
cy.get(PRODUCTS_LIST.emptyProductRow).should("not.exist"); .get(PRODUCTS_LIST.emptyProductRow)
cy.get(PRODUCTS_LIST.productsList) .should("not.exist")
.get(PRODUCTS_LIST.productsList)
.first() .first()
.click() .click()
.get(AVAILABLE_CHANNELS_FORM.menageChannelsButton) .get(AVAILABLE_CHANNELS_FORM.menageChannelsButton)
@ -98,7 +99,7 @@ filterTests(["all"], () => {
currency, currency,
shippingZone: shippingZone.name shippingZone: shippingZone.name
}); });
cy.wait("@Channel"); cy.waitForRequestAndCheckIfNoErrors("@Channel");
getShippingZone(shippingZone.id).then(shippingZoneResp => { getShippingZone(shippingZone.id).then(shippingZoneResp => {
const assignedChannel = shippingZoneResp.channels.find( const assignedChannel = shippingZoneResp.channels.find(
channel => channel.name === randomChannel channel => channel.name === randomChannel
@ -154,7 +155,7 @@ filterTests(["all"], () => {
.click(); .click();
cy.addAliasToGraphRequest("Channels"); cy.addAliasToGraphRequest("Channels");
cy.get(BUTTON_SELECTORS.submit).click(); cy.get(BUTTON_SELECTORS.submit).click();
cy.wait("@Channels"); cy.waitForRequestAndCheckIfNoErrors("@Channels");
cy.get(CHANNELS_SELECTORS.channelName) cy.get(CHANNELS_SELECTORS.channelName)
.contains(randomChannelToDelete) .contains(randomChannelToDelete)

View file

@ -1,26 +1,31 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { activateChannel, createChannel } from "../../apiRequests/Channels"; import { CHANNEL_FORM_SELECTORS } from "../../../elements/channels/channel-form-selectors";
import { createCheckout } from "../../apiRequests/Checkout"; import { DRAFT_ORDER_SELECTORS } from "../../../elements/orders/draft-order-selectors";
import { getProductDetails } from "../../apiRequests/storeFront/ProductDetails"; import { ORDERS_SELECTORS } from "../../../elements/orders/orders-selectors";
import { CHANNEL_FORM_SELECTORS } from "../../elements/channels/channel-form-selectors"; import { urlList } from "../../../fixtures/urlList";
import { DRAFT_ORDER_SELECTORS } from "../../elements/orders/draft-order-selectors"; import {
import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors"; activateChannel,
import filterTests from "../../support/filterTests"; createChannel
import { urlList } from "../../url/urlList"; } from "../../../support/api/requests/Channels";
import { createCheckout } from "../../../support/api/requests/Checkout";
import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails";
import { import {
deleteChannelsStartsWith, deleteChannelsStartsWith,
getDefaultChannel getDefaultChannel
} from "../../utils/channelsUtils"; } from "../../../support/api/utils/channelsUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../utils/products/productsUtils"; } from "../../../support/api/utils/products/productsUtils";
import { isProductVisible } from "../../utils/storeFront/storeFrontProductUtils"; import { isProductVisible } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import filterTests from "../../../support/filterTests";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Tests on inactive channel", () => { describe("Tests on inactive channel", () => {
const channelStartsWith = `InactiveChannel`; const channelStartsWith = `InactiveChannel`;
const randomName = `${channelStartsWith}${faker.datatype.number()}`; const randomName = `${channelStartsWith}${faker.datatype.number()}`;

View file

@ -1,17 +1,18 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; 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 { CUSTOMER_DETAILS } from "../../elements/customer/customer-details";
import { CUSTOMERS_LIST } from "../../elements/customer/customers-list"; import { CUSTOMERS_LIST } from "../../elements/customer/customers-list";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { fillUpAddressForm } from "../../steps/shared/addressForm"; import { urlList } from "../../fixtures/urlList";
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages"; import { ONE_PERMISSION_USERS } from "../../fixtures/users";
import { getCustomer } from "../../support/api/requests/Customer";
import filterTests from "../../support/filterTests"; import filterTests from "../../support/filterTests";
import { urlList } from "../../url/urlList";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Tests for customer", () => { describe("Tests for customer", () => {
const channelStartsWith = `Customers`; const channelStartsWith = `Customers`;
@ -37,15 +38,15 @@ filterTests(["all"], () => {
.fixture("addresses") .fixture("addresses")
.then(({ usAddress }) => { .then(({ usAddress }) => {
address = usAddress; address = usAddress;
fillUpAddressForm(address); cy.fillUpAddressForm(address);
}) })
.get(CUSTOMER_DETAILS.noteInput) .get(CUSTOMER_DETAILS.noteInput)
.type(note) .type(note)
.addAliasToGraphRequest("CreateCustomer") .addAliasToGraphRequest("CreateCustomer")
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear()
cy.wait("@CreateCustomer") .waitForRequestAndCheckIfNoErrors("@CreateCustomer")
.its("response.body.data.customerCreate.user") .its("response.body.data.customerCreate.user")
.then(customer => { .then(customer => {
getCustomer(customer.id); getCustomer(customer.id);

View file

@ -1,18 +1,21 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { import {
createMenu as createMenuViaApi, createMenu as createMenuViaApi,
getMenu getMenu
} from "../../apiRequests/Menu"; } from "../../support/api/requests/Menu";
import { deleteMenusStartsWith } from "../../support/api/utils/navigationUtils";
import filterTests from "../../support/filterTests";
import { import {
createMenu, createMenu,
createNewMenuItem, createNewMenuItem,
MENU_ITEM_TYPES MENU_ITEM_TYPES
} from "../../steps/navigationSteps"; } from "../../support/pages/navigationPage";
import filterTests from "../../support/filterTests";
import { deleteMenusStartsWith } from "../../utils/navigationUtils";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Tests for menu navigation", () => { describe("Tests for menu navigation", () => {
const startsWith = "Navigation"; const startsWith = "Navigation";
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,25 +1,27 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; 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_DETAILS } from "../../elements/permissionGroup/permissionGroupDetails";
import { PERMISSION_GROUP_LIST } from "../../elements/permissionGroup/permissionGroupsList"; import { PERMISSION_GROUP_LIST } from "../../elements/permissionGroup/permissionGroupsList";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { waitForProgressBarToNotExist } from "../../steps/shared/progressBar.js";
import filterTests from "../../support/filterTests.js";
import { import {
permissionGroupDetails, permissionGroupDetails,
staffMemberDetailsUrl, staffMemberDetailsUrl,
urlList urlList
} from "../../url/urlList"; } from "../../fixtures/urlList";
import { deletePermissionGroupsStartsWith } from "../../utils/permissionGroupUtils.js"; 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", () => { describe("Permissions groups", () => {
const startsWith = "CyPermissions-"; const startsWith = "CyPermissions-";
@ -51,8 +53,8 @@ filterTests(["all"], () => {
.get(PERMISSION_GROUP_DETAILS.assignMemberButton) .get(PERMISSION_GROUP_DETAILS.assignMemberButton)
.should("be.visible") .should("be.visible")
.get(BUTTON_SELECTORS.back) .get(BUTTON_SELECTORS.back)
.click(); .click()
waitForProgressBarToNotExist(); .waitForProgressBarToNotExist();
cy.contains( cy.contains(
PERMISSION_GROUP_LIST.permissionGroupRow, PERMISSION_GROUP_LIST.permissionGroupRow,
permissionName permissionName
@ -110,7 +112,7 @@ filterTests(["all"], () => {
.addAliasToGraphRequest("PermissionGroupUpdate") .addAliasToGraphRequest("PermissionGroupUpdate")
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click() .click()
.wait("@PermissionGroupUpdate"); .waitForRequestAndCheckIfNoErrors("@PermissionGroupUpdate");
getPermissionGroup(group.id); getPermissionGroup(group.id);
}) })
.then(resp => { .then(resp => {
@ -141,7 +143,7 @@ filterTests(["all"], () => {
.addAliasToGraphRequest("PermissionGroupUpdate") .addAliasToGraphRequest("PermissionGroupUpdate")
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click() .click()
.wait("@PermissionGroupUpdate"); .waitForRequestAndCheckIfNoErrors("@PermissionGroupUpdate");
cy.visit(staffMemberDetailsUrl(staffMember.id)); cy.visit(staffMemberDetailsUrl(staffMember.id));
cy.get(SHARED_ELEMENTS.header).should("be.visible"); cy.get(SHARED_ELEMENTS.header).should("be.visible");
cy.contains(permissionName).should("not.exist"); cy.contains(permissionName).should("not.exist");

View file

@ -1,25 +1,28 @@
/// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { import {
addShippingMethod, addShippingMethod,
completeCheckout, completeCheckout,
createCheckout createCheckout
} from "../apiRequests/Checkout"; } from "../../../support/api/requests/Checkout";
import { getOrder } from "../apiRequests/Order"; import { getOrder } from "../../../support/api/requests/Order";
import filterTests from "../support/filterTests"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
import { getDefaultChannel } from "../utils/channelsUtils"; import { addAdyenPayment } from "../../../support/api/utils/ordersUtils";
import { addAdyenPayment } from "../utils/ordersUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith deleteProductsStartsWith
} from "../utils/products/productsUtils"; } from "../../../support/api/utils/products/productsUtils";
import { import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../utils/shippingUtils"; } from "../../../support/api/utils/shippingUtils";
import filterTests from "../../../support/filterTests";
filterTests(["stagedOnly"], () => { filterTests({ definedTags: ["stagedOnly"] }, () => {
describe("Adyen payments", () => { describe("Adyen payments", () => {
const startsWith = "CyChannelInDraftOrders-"; const startsWith = "CyChannelInDraftOrders-";
const name = startsWith + faker.datatype.number(); const name = startsWith + faker.datatype.number();

View file

@ -1,21 +1,23 @@
/// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; 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 { import {
customerRegistration, customerRegistration,
deleteCustomersStartsWith, deleteCustomersStartsWith,
requestPasswordReset requestPasswordReset
} from "../apiRequests/Customer"; } from "../../../support/api/requests/Customer";
import { PLUGINS_DETAILS } from "../elements/plugins/pluginDetails"; import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
import { PLUGINS_LIST } from "../elements/plugins/pluginsList"; import { getMailsForUser } from "../../../support/api/utils/users";
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors"; import filterTests from "../../../support/filterTests";
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";
filterTests(["stagedOnly"], () => { filterTests({ definedTags: ["stagedOnly"], version: "3.1.1" }, () => {
describe("Plugins", () => { describe("Plugins", () => {
const startsWith = "Plugins"; const startsWith = "Plugins";
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
@ -43,8 +45,8 @@ filterTests(["stagedOnly"], () => {
.get(PLUGINS_DETAILS.accountConfirmationSubjectInput) .get(PLUGINS_DETAILS.accountConfirmationSubjectInput)
.clearAndType(randomName) .clearAndType(randomName)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
customerRegistration({ customerRegistration({
email: customerEmail, email: customerEmail,
channel: defaultChannel.slug channel: defaultChannel.slug
@ -66,8 +68,8 @@ filterTests(["stagedOnly"], () => {
.clear() .clear()
.clearAndType(randomName) .clearAndType(randomName)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
requestPasswordReset(Cypress.env("USER_NAME"), defaultChannel.slug) requestPasswordReset(Cypress.env("USER_NAME"), defaultChannel.slug)
.then(() => { .then(() => {
getMailsForUser(customerEmail); getMailsForUser(customerEmail);

View file

@ -1,20 +1,20 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; 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 { import {
createTypeProduct, createTypeProduct,
getProductType getProductType
} from "../../apiRequests/productType"; } from "../../support/api/requests/ProductType";
import { PRODUCT_TYPE_DETAILS } from "../../elements/productTypes/productTypeDetails"; import { deleteProductsStartsWith } from "../../support/api/utils/products/productsUtils";
import { createProductType } from "../../steps/productTypeSteps";
import { assignElements } from "../../steps/shared/assignElements";
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
import { visitAndWaitForProgressBarToDisappear } from "../../steps/shared/progressBar";
import filterTests from "../../support/filterTests"; import filterTests from "../../support/filterTests";
import { productTypeDetailsUrl, urlList } from "../../url/urlList"; import { createProductType } from "../../support/pages/productTypePage";
import { deleteProductsStartsWith } from "../../utils/products/productsUtils";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Tests for product types", () => { describe("Tests for product types", () => {
const startsWith = "ProductType"; const startsWith = "ProductType";
@ -64,15 +64,15 @@ filterTests(["all"], () => {
createTypeProduct({ name }) createTypeProduct({ name })
.then(productType => { .then(productType => {
visitAndWaitForProgressBarToDisappear( cy.visitAndWaitForProgressBarToDisappear(
productTypeDetailsUrl(productType.id) productTypeDetailsUrl(productType.id)
) )
.get(PRODUCT_TYPE_DETAILS.assignProductAttributeButton) .get(PRODUCT_TYPE_DETAILS.assignProductAttributeButton)
.click(); .click()
cy.addAliasToGraphRequest("AssignProductAttribute"); .addAliasToGraphRequest("AssignProductAttribute")
assignElements(startsWith, false); .assignElements(startsWith, false)
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear()
cy.wait("@AssignProductAttribute"); .waitForRequestAndCheckIfNoErrors("@AssignProductAttribute");
getProductType(productType.id); getProductType(productType.id);
}) })
.then(productType => { .then(productType => {
@ -85,17 +85,17 @@ filterTests(["all"], () => {
createTypeProduct({ name, hasVariants: false }) createTypeProduct({ name, hasVariants: false })
.then(productType => { .then(productType => {
visitAndWaitForProgressBarToDisappear( cy.visitAndWaitForProgressBarToDisappear(
productTypeDetailsUrl(productType.id) productTypeDetailsUrl(productType.id)
) )
.get(PRODUCT_TYPE_DETAILS.hasVariantsButton) .get(PRODUCT_TYPE_DETAILS.hasVariantsButton)
.click() .click()
.get(PRODUCT_TYPE_DETAILS.assignVariantAttributeButton) .get(PRODUCT_TYPE_DETAILS.assignVariantAttributeButton)
.click(); .click()
cy.addAliasToGraphRequest("AssignProductAttribute"); .addAliasToGraphRequest("AssignProductAttribute")
assignElements(startsWith, false); .assignElements(startsWith, false)
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear()
cy.wait("@AssignProductAttribute"); .wait("@AssignProductAttribute");
getProductType(productType.id); getProductType(productType.id);
}) })
.then(productType => { .then(productType => {

View file

@ -1,27 +1,25 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; 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 { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
import { SHIPPING_ZONE_DETAILS } from "../../../elements/shipping/shipping-zone-details"; import { SHIPPING_ZONE_DETAILS } from "../../../elements/shipping/shipping-zone-details";
import { enterHomePageChangeChannelAndReturn } from "../../../steps/channelsSteps"; import { urlList } from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { createChannel } from "../../../support/api/requests/Channels";
import { import {
waitForProgressBarToNotBeVisible, addChannelToShippingMethod,
waitForProgressBarToNotExist addChannelToShippingZone
} from "../../../steps/shared/progressBar"; } 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 filterTests from "../../../support/filterTests";
import { getCurrencyAndAmountInString } from "../../../support/format/formatCurrencyAmount"; import { getCurrencyAndAmountInString } from "../../../support/formatData/formatCurrencyAmount";
import { urlList } from "../../../url/urlList"; import { enterHomePageChangeChannelAndReturn } from "../../../support/pages/channelsPage";
import * as channelsUtils from "../../../utils/channelsUtils";
import * as shippingUtils from "../../../utils/shippingUtils";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Channels in shippingMethod", () => { describe("Channels in shippingMethod", () => {
const startsWith = "ChannelShippingMethod"; const startsWith = "ChannelShippingMethod";
let defaultChannel; let defaultChannel;
@ -90,21 +88,23 @@ filterTests(["all"], () => {
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping) .loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping)
.visit(urlList.shippingMethods) .visit(urlList.shippingMethods)
.get(SHARED_ELEMENTS.header) .get(SHARED_ELEMENTS.header)
.should("be.visible"); .should("be.visible")
waitForProgressBarToNotExist(); .waitForProgressBarToNotExist()
cy.addAliasToGraphRequest("ShippingZone"); .addAliasToGraphRequest("ShippingZone")
cy.getTextFromElement(SHARED_ELEMENTS.table); .getTextFromElement(SHARED_ELEMENTS.table);
}) })
.then(tableText => { .then(tableText => {
if (!tableText.includes(shippingZone.name)) { if (!tableText.includes(shippingZone.name)) {
cy.get(BUTTON_SELECTORS.nextPaginationButton).click(); cy.get(BUTTON_SELECTORS.nextPaginationButton).click();
} }
cy.contains(shippingZone.name).click(); cy.contains(shippingZone.name)
cy.wait("@ShippingZone"); .click()
.waitForRequestAndCheckIfNoErrors("@ShippingZone");
enterHomePageChangeChannelAndReturn(defaultChannel.name); enterHomePageChangeChannelAndReturn(defaultChannel.name);
waitForProgressBarToNotBeVisible(); cy.waitForProgressBarToNotBeVisible()
cy.get(SHARED_ELEMENTS.skeleton).should("not.exist"); .get(SHARED_ELEMENTS.skeleton)
cy.getTextFromElement( .should("not.exist")
.getTextFromElement(
SHIPPING_ZONE_DETAILS.shippingRatePriceTableCell SHIPPING_ZONE_DETAILS.shippingRatePriceTableCell
) )
.then(text => { .then(text => {
@ -115,8 +115,9 @@ filterTests(["all"], () => {
expect(text).to.be.eq(expectedValue); expect(text).to.be.eq(expectedValue);
enterHomePageChangeChannelAndReturn(createdChannel.name); enterHomePageChangeChannelAndReturn(createdChannel.name);
waitForProgressBarToNotBeVisible(); cy.waitForProgressBarToNotBeVisible()
cy.get(SHARED_ELEMENTS.skeleton).should("not.exist"); .get(SHARED_ELEMENTS.skeleton)
.should("not.exist");
}) })
.then(() => { .then(() => {
cy.getTextFromElement( cy.getTextFromElement(

View file

@ -1,22 +1,24 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { createCheckout } from "../../../apiRequests/Checkout"; import { urlList } from "../../../fixtures/urlList";
import { createWarehouse } from "../../../apiRequests/Warehouse"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { ONE_PERMISSION_USERS } from "../../../Data/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 { import {
createShippingRate, createShippingRate,
createShippingZone, createShippingZone,
rateOptions rateOptions
} from "../../../steps/shippingMethodSteps"; } from "../../../support/pages/shippingMethodPage";
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";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Create shipping method", () => { describe("Create shipping method", () => {
const startsWith = "CreateShippingMethods-"; const startsWith = "CreateShippingMethods-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,26 +1,28 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { createCheckout } from "../../../apiRequests/Checkout"; import { shippingZoneDetailsUrl } from "../../../fixtures/urlList";
import { createShippingZone } from "../../../apiRequests/ShippingMethod"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { createWarehouse } from "../../../apiRequests/Warehouse"; import { createCheckout } from "../../../support/api/requests/Checkout";
import { ONE_PERMISSION_USERS } from "../../../Data/users"; import { createShippingZone } from "../../../support/api/requests/ShippingMethod";
import { import { createWarehouse } from "../../../support/api/requests/Warehouse";
createRateWithPostalCode, import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
postalCodesOptions
} from "../../../steps/shippingMethodSteps";
import filterTests from "../../../support/filterTests";
import { shippingZoneDetailsUrl } from "../../../url/urlList";
import { getDefaultChannel } from "../../../utils/channelsUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../../utils/products/productsUtils"; } from "../../../support/api/utils/products/productsUtils";
import { deleteShippingStartsWith } from "../../../utils/shippingUtils"; import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
import { isShippingAvailableInCheckout } from "../../../utils/storeFront/checkoutUtils"; 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", () => { describe("Postal codes in shipping", () => {
const startsWith = "CyShippingMethods-"; const startsWith = "CyShippingMethods-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,26 +1,28 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../../../support"/>
import faker from "faker"; import faker from "faker";
import { createCheckout } from "../../../../apiRequests/Checkout"; import { shippingZoneDetailsUrl } from "../../../../fixtures/urlList";
import { createShippingZone } from "../../../../apiRequests/ShippingMethod"; import { ONE_PERMISSION_USERS } from "../../../../fixtures/users";
import { createWarehouse } from "../../../../apiRequests/Warehouse"; import { createCheckout } from "../../../../support/api/requests/Checkout";
import { ONE_PERMISSION_USERS } from "../../../../Data/users"; import { createShippingZone } from "../../../../support/api/requests/ShippingMethod";
import { import { createWarehouse } from "../../../../support/api/requests/Warehouse";
createShippingRate, import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils";
rateOptions
} from "../../../../steps/shippingMethodSteps";
import filterTests from "../../../../support/filterTests";
import { shippingZoneDetailsUrl } from "../../../../url/urlList";
import { getDefaultChannel } from "../../../../utils/channelsUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../../../utils/products/productsUtils"; } from "../../../../support/api/utils/products/productsUtils";
import { deleteShippingStartsWith } from "../../../../utils/shippingUtils"; import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils";
import { isShippingAvailableInCheckout } from "../../../../utils/storeFront/checkoutUtils"; 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", () => { describe("Shipping weight limits", () => {
const startsWith = "CyWeightRates-"; const startsWith = "CyWeightRates-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,22 +1,23 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../../../support"/>
import faker from "faker"; 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 { import {
createShippingRate as createShippingRateViaApi, createShippingRate as createShippingRateViaApi,
createShippingZone createShippingZone
} from "../../../../apiRequests/ShippingMethod"; } from "../../../../support/api/requests/ShippingMethod";
import { updateShopWeightUnit } from "../../../../apiRequests/shopSettings"; import { updateShopWeightUnit } from "../../../../support/api/requests/ShopSettings";
import { SHARED_ELEMENTS } from "../../../../elements/shared/sharedElements"; import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils";
import { SHIPPING_RATE_DETAILS } from "../../../../elements/shipping/shipping-rate-details"; import { deleteProductsStartsWith } from "../../../../support/api/utils/products/productsUtils";
import { waitForProgressBarToNotBeVisible } from "../../../../steps/shared/progressBar"; import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils";
import { changeWeightUnit } from "../../../../steps/shippingMethodSteps";
import filterTests from "../../../../support/filterTests"; import filterTests from "../../../../support/filterTests";
import { urlList, weightRateUrl } from "../../../../url/urlList"; import { changeWeightUnit } from "../../../../support/pages/shippingMethodPage";
import { getDefaultChannel } from "../../../../utils/channelsUtils";
import { deleteProductsStartsWith } from "../../../../utils/products/productsUtils";
import { deleteShippingStartsWith } from "../../../../utils/shippingUtils";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Recalculate weights", () => { describe("Recalculate weights", () => {
const startsWith = "RecalculateWeight"; const startsWith = "RecalculateWeight";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
@ -83,7 +84,7 @@ filterTests(["all"], () => {
const rate = shippingMethods.find( const rate = shippingMethods.find(
element => element.id === shippingMethod.id element => element.id === shippingMethod.id
); );
waitForProgressBarToNotBeVisible(); cy.waitForProgressBarToNotBeVisible();
expect(rate.minimumOrderWeight.unit).to.eq("G"); expect(rate.minimumOrderWeight.unit).to.eq("G");
cy.get(SHIPPING_RATE_DETAILS.minWeightInput).invoke("val"); cy.get(SHIPPING_RATE_DETAILS.minWeightInput).invoke("val");
}) })

View file

@ -1,14 +1,18 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { getShopInfo, updateShopAddress } from "../../apiRequests/shopSettings";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SITE_SETTINGS_DETAILS } from "../../elements/siteSettings/site-settings-details"; import { SITE_SETTINGS_DETAILS } from "../../elements/siteSettings/site-settings-details";
import { fillUpBasicAddress } from "../../steps/shared/addressForm"; import { urlList } from "../../fixtures/urlList";
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages"; import {
getShopInfo,
updateShopAddress
} from "../../support/api/requests/ShopSettings";
import filterTests from "../../support/filterTests"; import filterTests from "../../support/filterTests";
import { urlList } from "../../url/urlList";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Tests for site settings", () => { describe("Tests for site settings", () => {
let address; let address;
@ -33,8 +37,8 @@ filterTests(["all"], () => {
cy.get(SITE_SETTINGS_DETAILS.nameInput) cy.get(SITE_SETTINGS_DETAILS.nameInput)
.clearAndType(name) .clearAndType(name)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
getShopInfo().then(shopInfo => { getShopInfo().then(shopInfo => {
expect(shopInfo.name).to.eq(name); expect(shopInfo.name).to.eq(name);
}); });
@ -46,8 +50,8 @@ filterTests(["all"], () => {
cy.get(SITE_SETTINGS_DETAILS.urlInput) cy.get(SITE_SETTINGS_DETAILS.urlInput)
.clearAndType(url) .clearAndType(url)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
getShopInfo().then(shopInfo => { getShopInfo().then(shopInfo => {
expect(shopInfo.domain.host).to.eq(url); expect(shopInfo.domain.host).to.eq(url);
}); });
@ -59,17 +63,18 @@ filterTests(["all"], () => {
cy.get(SITE_SETTINGS_DETAILS.descriptionInput) cy.get(SITE_SETTINGS_DETAILS.descriptionInput)
.clearAndType(description) .clearAndType(description)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
getShopInfo().then(shopInfo => { getShopInfo().then(shopInfo => {
expect(shopInfo.description).to.eq(description); expect(shopInfo.description).to.eq(description);
}); });
}); });
it("should change store address", () => { it("should change store address", () => {
fillUpBasicAddress(address); cy.fillUpBasicAddress(address)
cy.get(BUTTON_SELECTORS.confirm).click(); .get(BUTTON_SELECTORS.confirm)
confirmationMessageShouldDisappear(); .click()
.confirmationMessageShouldDisappear();
getShopInfo().then(({ companyAddress }) => { getShopInfo().then(({ companyAddress }) => {
expect(companyAddress.companyName).to.eq(address.companyName); expect(companyAddress.companyName).to.eq(address.companyName);
cy.expectCorrectBasicAddress(companyAddress, address); cy.expectCorrectBasicAddress(companyAddress, address);

View file

@ -1,17 +1,21 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { createCategory, getCategory } from "../../apiRequests/Category";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { ELEMENT_TRANSLATION } from "../../elements/translations/element-translation"; import { ELEMENT_TRANSLATION } from "../../elements/translations/element-translation";
import { LANGUAGES_LIST } from "../../elements/translations/languages-list"; import { LANGUAGES_LIST } from "../../elements/translations/languages-list";
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages"; import { urlList } from "../../fixtures/urlList";
import { findElementOnTable } from "../../steps/shared/tables"; import {
createCategory,
getCategory
} from "../../support/api/requests/Category";
import { deleteCategoriesStartsWith } from "../../support/api/utils/categoryUtils";
import filterTests from "../../support/filterTests"; 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", () => { describe("Tests for translations", () => {
const startsWith = "Translations"; const startsWith = "Translations";
const randomNumber = faker.datatype.number(); const randomNumber = faker.datatype.number();
@ -32,8 +36,8 @@ filterTests(["all"], () => {
it("should create translation", () => { it("should create translation", () => {
cy.visit(urlList.translations) cy.visit(urlList.translations)
.get(LANGUAGES_LIST.polishLanguageButton) .get(LANGUAGES_LIST.polishLanguageButton)
.click(); .click()
findElementOnTable(category.name); .findElementOnTable(category.name);
cy.get(ELEMENT_TRANSLATION.editNameButton) cy.get(ELEMENT_TRANSLATION.editNameButton)
.click() .click()
.get(SHARED_ELEMENTS.skeleton) .get(SHARED_ELEMENTS.skeleton)
@ -41,9 +45,9 @@ filterTests(["all"], () => {
.get(ELEMENT_TRANSLATION.translationInputField) .get(ELEMENT_TRANSLATION.translationInputField)
.type(`TranslatedName${randomNumber}`) .type(`TranslatedName${randomNumber}`)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear()
cy.get(ELEMENT_TRANSLATION.editDescriptionButton) .get(ELEMENT_TRANSLATION.editDescriptionButton)
.click() .click()
.get(SHARED_ELEMENTS.richTextEditor.loader) .get(SHARED_ELEMENTS.richTextEditor.loader)
.should("not.exist") .should("not.exist")
@ -51,22 +55,22 @@ filterTests(["all"], () => {
.type(`TranslatedDescription${randomNumber}`) .type(`TranslatedDescription${randomNumber}`)
.wait(500) .wait(500)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear()
cy.get(ELEMENT_TRANSLATION.editSeoTitleButton) .get(ELEMENT_TRANSLATION.editSeoTitleButton)
.click() .click()
.get(ELEMENT_TRANSLATION.translationInputField) .get(ELEMENT_TRANSLATION.translationInputField)
.type(`TranslatedSeoTitle${randomNumber}`) .type(`TranslatedSeoTitle${randomNumber}`)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear()
cy.get(ELEMENT_TRANSLATION.editSeoDescriptionButton) .get(ELEMENT_TRANSLATION.editSeoDescriptionButton)
.click() .click()
.get(ELEMENT_TRANSLATION.translationInputField) .get(ELEMENT_TRANSLATION.translationInputField)
.type(`TranslatedSeoDescription${randomNumber}`) .type(`TranslatedSeoDescription${randomNumber}`)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
getCategory(category.id, "PL").then(({ translation }) => { getCategory(category.id, "PL").then(({ translation }) => {
expect(translation.name).to.eq(`TranslatedName${randomNumber}`); expect(translation.name).to.eq(`TranslatedName${randomNumber}`);
expect(translation.description).to.includes( expect(translation.description).to.includes(

View file

@ -1,24 +1,27 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { createShippingZone } from "../../apiRequests/ShippingMethod";
import { createWarehouse, getWarehouse } from "../../apiRequests/Warehouse";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHIPPING_ZONE_DETAILS } from "../../elements/shipping/shipping-zone-details"; import { SHIPPING_ZONE_DETAILS } from "../../elements/shipping/shipping-zone-details";
import { WAREHOUSES_DETAILS } from "../../elements/warehouses/warehouse-details"; import { WAREHOUSES_DETAILS } from "../../elements/warehouses/warehouse-details";
import { WAREHOUSES_LIST } from "../../elements/warehouses/warehouses-list"; import { WAREHOUSES_LIST } from "../../elements/warehouses/warehouses-list";
import { fillUpBasicAddress } from "../../steps/shared/addressForm";
import { fillAutocompleteSelect } from "../../steps/shared/selects";
import filterTests from "../../support/filterTests";
import { import {
shippingZoneDetailsUrl, shippingZoneDetailsUrl,
urlList, urlList,
warehouseDetailsUrl warehouseDetailsUrl
} from "../../url/urlList"; } from "../../fixtures/urlList";
import { getDefaultChannel } from "../../utils/channelsUtils"; import { createShippingZone } from "../../support/api/requests/ShippingMethod";
import { deleteShippingStartsWith } from "../../utils/shippingUtils"; 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", () => { describe("Warehouse settings", () => {
const startsWith = "CyWarehouse"; const startsWith = "CyWarehouse";
let usAddress; let usAddress;
@ -39,13 +42,14 @@ filterTests(["all"], () => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.visit(urlList.warehouses) cy.visit(urlList.warehouses)
.get(WAREHOUSES_LIST.createNewButton) .get(WAREHOUSES_LIST.createNewButton)
.click(); .click()
cy.get(WAREHOUSES_DETAILS.nameInput).type(name); .get(WAREHOUSES_DETAILS.nameInput)
fillUpBasicAddress(usAddress); .type(name)
cy.addAliasToGraphRequest("WarehouseCreate") .fillUpBasicAddress(usAddress)
.addAliasToGraphRequest("WarehouseCreate")
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click() .click()
.wait("@WarehouseCreate") .waitForRequestAndCheckIfNoErrors("@WarehouseCreate")
.its("response.body.data.createWarehouse.warehouse") .its("response.body.data.createWarehouse.warehouse")
.then(warehouse => { .then(warehouse => {
getWarehouse(warehouse.id); getWarehouse(warehouse.id);
@ -77,15 +81,15 @@ filterTests(["all"], () => {
}) })
.then(shippingZoneResp => { .then(shippingZoneResp => {
shippingZone = shippingZoneResp; shippingZone = shippingZoneResp;
cy.visit(shippingZoneDetailsUrl(shippingZone.id)); cy.visit(shippingZoneDetailsUrl(shippingZone.id))
fillAutocompleteSelect( .fillAutocompleteSelect(
SHIPPING_ZONE_DETAILS.warehouseSelector, SHIPPING_ZONE_DETAILS.warehouseSelector,
warehouse.name warehouse.name
); )
cy.addAliasToGraphRequest("UpdateShippingZone") .addAliasToGraphRequest("UpdateShippingZone")
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click() .click()
.wait("@UpdateShippingZone"); .waitForRequestAndCheckIfNoErrors("@UpdateShippingZone");
getWarehouse(warehouse.id); getWarehouse(warehouse.id);
}) })
.then(warehouseResp => { .then(warehouseResp => {
@ -107,7 +111,7 @@ filterTests(["all"], () => {
.addAliasToGraphRequest("WarehouseDelete") .addAliasToGraphRequest("WarehouseDelete")
.get(BUTTON_SELECTORS.submit) .get(BUTTON_SELECTORS.submit)
.click() .click()
.wait("@WarehouseDelete"); .waitForRequestAndCheckIfNoErrors("@WarehouseDelete");
getWarehouse(warehouse.id).should("be.null"); getWarehouse(warehouse.id).should("be.null");
}); });
}); });

View file

@ -1,17 +1,19 @@
/// <reference types="cypress"/>
/// <reference types="../support"/>
import faker from "faker"; 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 { import {
confirmAccount, confirmAccount,
customerRegistration, customerRegistration,
deleteCustomersStartsWith deleteCustomersStartsWith
} from "../apiRequests/Customer"; } from "../support/api/requests/Customer";
import { CUSTOMER_DETAILS } from "../elements/customers/customer-details"; import { getDefaultChannel } from "../support/api/utils/channelsUtils";
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors"; import { getMailActivationLinkForUser } from "../support/api/utils/users";
import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages";
import filterTests from "../support/filterTests"; 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", () => { describe("Tests for customer registration", () => {
const startsWith = "Registration"; const startsWith = "Registration";
@ -27,7 +29,7 @@ describe("Tests for customer registration", () => {
}); });
}); });
filterTests(["stagedOnly"], () => { filterTests({ definedTags: ["stagedOnly"] }, () => {
it("should register customer", () => { it("should register customer", () => {
const email = `${startsWith}${faker.datatype.number()}@example.com`; const email = `${startsWith}${faker.datatype.number()}@example.com`;
customerRegistration({ email, channel: defaultChannel.slug }); customerRegistration({ email, channel: defaultChannel.slug });
@ -72,9 +74,9 @@ describe("Tests for customer registration", () => {
.get(CUSTOMER_DETAILS.isActiveCheckbox) .get(CUSTOMER_DETAILS.isActiveCheckbox)
.click() .click()
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear()
cy.clearSessionData() .clearSessionData()
.loginUserViaRequest("token", { .loginUserViaRequest("token", {
email, email,
password: Cypress.env("USER_PASSWORD") password: Cypress.env("USER_PASSWORD")

View file

@ -1,26 +1,27 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { createChannel } from "../../apiRequests/Channels"; import { urlList } from "../../fixtures/urlList";
import { updateChannelInProduct } from "../../apiRequests/Product"; 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 { import {
assignProducts, assignProducts,
createSale, createSale,
discountOptions discountOptions
} from "../../steps/discounts/salesSteps"; } from "../../support/pages/discounts/salesPage";
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";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Sales discounts", () => { describe("Sales discounts", () => {
const startsWith = "CySales-"; const startsWith = "CySales-";

View file

@ -1,24 +1,26 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { createChannel } from "../../apiRequests/Channels"; import { urlList } from "../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../Data/users"; import { ONE_PERMISSION_USERS } from "../../fixtures/users";
import { import { createChannel } from "../../support/api/requests/Channels";
createVoucher, import * as channelsUtils from "../../support/api/utils/channelsUtils";
discountOptions import { deleteVouchersStartsWith } from "../../support/api/utils/discounts/vouchersUtils";
} from "../../steps/discounts/vouchersSteps"; import { createCheckoutWithVoucher } from "../../support/api/utils/ordersUtils";
import filterTests from "../../support/filterTests"; import * as productsUtils from "../../support/api/utils/products/productsUtils";
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 { import {
createShipping, createShipping,
deleteShippingStartsWith 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", () => { describe("Vouchers discounts", () => {
const startsWith = "CyVou-"; const startsWith = "CyVou-";
const productPrice = 100; const productPrice = 100;

View file

@ -1,9 +1,12 @@
import { TEST_ADMIN_USER, USER_WITHOUT_NAME } from "../../Data/users"; /// <reference types="cypress"/>
import { expectWelcomeMessageIncludes } from "../../steps/homePageSteps"; /// <reference types="../../support"/>
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", () => { describe("Displaying welcome message on home page", () => {
it("should display user name on home page", () => { it("should display user name on home page", () => {
cy.loginUserViaRequest(); cy.loginUserViaRequest();

View file

@ -1,25 +1,28 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { HOMEPAGE_SELECTORS } from "../../elements/homePage/homePage-selectors";
import { urlList } from "../../fixtures/urlList";
import { import {
createCustomer, createCustomer,
deleteCustomersStartsWith deleteCustomersStartsWith
} from "../../apiRequests/Customer"; } from "../../support/api/requests/Customer";
import { HOMEPAGE_SELECTORS } from "../../elements/homePage/homePage-selectors"; import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import { changeChannel } from "../../steps/homePageSteps"; import * as homePageUtils from "../../support/api/utils/homePageUtils";
import filterTests from "../../support/filterTests";
import { urlList } from "../../url/urlList";
import { getDefaultChannel } from "../../utils/channelsUtils";
import * as homePageUtils from "../../utils/homePageUtils";
import { import {
createReadyToFulfillOrder, createReadyToFulfillOrder,
createWaitingForCaptureOrder createWaitingForCaptureOrder
} from "../../utils/ordersUtils"; } from "../../support/api/utils/ordersUtils";
import * as productsUtils from "../../utils/products/productsUtils"; import * as productsUtils from "../../support/api/utils/products/productsUtils";
import * as shippingUtils from "../../utils/shippingUtils"; import * as shippingUtils from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
import { changeChannel } from "../../support/pages/homePage";
// <reference types="cypress" /> // <reference types="cypress" />
filterTests(["all", "critical"], () => { filterTests({ definedTags: ["all", "critical"] }, () => {
describe("Homepage analytics", () => { describe("Homepage analytics", () => {
const startsWith = "CyHomeAnalytics"; const startsWith = "CyHomeAnalytics";

View file

@ -1,9 +1,11 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
import { LOGIN_SELECTORS } from "../elements/account/login-selectors"; /// <reference types="../support"/>
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", () => { describe("User authorization", () => {
beforeEach(() => { beforeEach(() => {
cy.clearSessionData(); cy.clearSessionData();

View file

@ -1,16 +1,21 @@
/// <reference types="cypress"/>
/// <reference types="../support"/>
import faker from "faker"; import faker from "faker";
import { updateMetadata, updatePrivateMetadata } from "../apiRequests/Metadata"; import {
import { createDraftOrder, getOrder } from "../apiRequests/Order"; updateMetadata,
import { getProductMetadata } from "../apiRequests/storeFront/ProductDetails"; updatePrivateMetadata
import filterTests from "../support/filterTests"; } from "../support/api/requests/Metadata";
import { getDefaultChannel } from "../utils/channelsUtils"; import { createDraftOrder, getOrder } from "../support/api/requests/Order";
import { getProductMetadata } from "../support/api/requests/storeFront/ProductDetails";
import { getDefaultChannel } from "../support/api/utils/channelsUtils";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct 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", () => { describe("Test for metadata", () => {
const startsWith = "Metadata"; const startsWith = "Metadata";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,11 +1,14 @@
import { PERMISSIONS_OPTIONS } from "../Data/permissionsUsers"; /// <reference types="cypress"/>
import * as permissionsSteps from "../steps/permissions"; /// <reference types="../support"/>
import { PERMISSIONS_OPTIONS } from "../fixtures/permissionsUsers";
import filterTests from "../support/filterTests"; import filterTests from "../support/filterTests";
import * as permissionsSteps from "../support/pages/permissionsPage";
describe("Navigation for users with different permissions", () => { describe("Navigation for users with different permissions", () => {
Object.keys(PERMISSIONS_OPTIONS).forEach(key => { Object.keys(PERMISSIONS_OPTIONS).forEach(key => {
const tags = key === "all" ? ["critical", "all"] : ["all"]; const tags = key === "all" ? ["critical", "all"] : ["all"];
filterTests(tags, () => { filterTests({ definedTags: tags }, () => {
it(`should navigate as an user with ${key} permission`, () => { it(`should navigate as an user with ${key} permission`, () => {
const permissionOption = PERMISSIONS_OPTIONS[key]; const permissionOption = PERMISSIONS_OPTIONS[key];
const permissions = permissionOption.permissions; const permissions = permissionOption.permissions;

View file

@ -1,20 +1,22 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { createChannel } from "../../apiRequests/Channels";
import { CHANNEL_FORM_SELECTORS } from "../../elements/channels/channel-form-selectors"; import { CHANNEL_FORM_SELECTORS } from "../../elements/channels/channel-form-selectors";
import { HEADER_SELECTORS } from "../../elements/header/header-selectors"; import { HEADER_SELECTORS } from "../../elements/header/header-selectors";
import { DRAFT_ORDER_SELECTORS } from "../../elements/orders/draft-order-selectors"; import { DRAFT_ORDER_SELECTORS } from "../../elements/orders/draft-order-selectors";
import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors"; import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
import { urlList } from "../../fixtures/urlList";
import { createChannel } from "../../support/api/requests/Channels";
import * as channelsUtils from "../../support/api/utils/channelsUtils";
import filterTests from "../../support/filterTests";
import { import {
selectChannelInHeader, selectChannelInHeader,
selectChannelInPicker selectChannelInPicker
} from "../../steps/channelsSteps"; } from "../../support/pages/channelsPage";
import filterTests from "../../support/filterTests";
import { urlList } from "../../url/urlList";
import * as channelsUtils from "../../utils/channelsUtils";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Channels in draft orders", () => { describe("Channels in draft orders", () => {
const startsWith = "CyChannelInDraftOrders-"; const startsWith = "CyChannelInDraftOrders-";
const randomName = startsWith + faker.datatype.number(); const randomName = startsWith + faker.datatype.number();

View file

@ -1,25 +1,27 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; 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 { import {
createCustomer, createCustomer,
deleteCustomersStartsWith deleteCustomersStartsWith
} from "../../apiRequests/Customer"; } from "../../support/api/requests/Customer";
import { updateOrdersSettings } from "../../apiRequests/Order"; import { updateOrdersSettings } from "../../support/api/requests/Order";
import { DRAFT_ORDERS_LIST_SELECTORS } from "../../elements/orders/draft-orders-list-selectors"; import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors"; import * as productsUtils from "../../support/api/utils/products/productsUtils";
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";
import { import {
createShipping, createShipping,
deleteShippingStartsWith 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", () => { describe("Draft orders", () => {
const startsWith = "CyDraftOrders-"; const startsWith = "CyDraftOrders-";
const randomName = startsWith + faker.datatype.number(); const randomName = startsWith + faker.datatype.number();

View file

@ -1,34 +1,38 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; 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 { ORDER_REFUND } from "../../elements/orders/order-refund";
import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors"; import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { selectChannelInPicker } from "../../steps/channelsSteps"; import { urlList } from "../../fixtures/urlList";
import { finalizeDraftOrder } from "../../steps/draftOrderSteps"; import { ONE_PERMISSION_USERS } from "../../fixtures/users";
import { fillAutocompleteSelect } from "../../steps/shared/selects"; import {
import filterTests from "../../support/filterTests"; createCustomer,
import { urlList } from "../../url/urlList"; deleteCustomersStartsWith
import { getDefaultChannel } from "../../utils/channelsUtils"; } from "../../support/api/requests/Customer";
import {
getOrder,
updateOrdersSettings
} from "../../support/api/requests/Order";
import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import { import {
createFulfilledOrder, createFulfilledOrder,
createOrder, createOrder,
createReadyToFulfillOrder createReadyToFulfillOrder
} from "../../utils/ordersUtils"; } from "../../support/api/utils/ordersUtils";
import * as productsUtils from "../../utils/products/productsUtils"; import * as productsUtils from "../../support/api/utils/products/productsUtils";
import { import {
createShipping, createShipping,
deleteShippingStartsWith 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", () => { describe("Orders", () => {
const startsWith = "CyOrders-"; const startsWith = "CyOrders-";
const randomName = startsWith + faker.datatype.number(); const randomName = startsWith + faker.datatype.number();
@ -160,16 +164,15 @@ filterTests(["all"], () => {
cy.get(SHARED_ELEMENTS.skeleton) cy.get(SHARED_ELEMENTS.skeleton)
.should("not.exist") .should("not.exist")
.get(ORDERS_SELECTORS.cancelFulfillment) .get(ORDERS_SELECTORS.cancelFulfillment)
.click(); .click()
}) .fillAutocompleteSelect(
.then(() => {
fillAutocompleteSelect(
ORDERS_SELECTORS.cancelFulfillmentSelectField, ORDERS_SELECTORS.cancelFulfillmentSelectField,
warehouse.name warehouse.name
); )
cy.addAliasToGraphRequest("OrderFulfillmentCancel"); .addAliasToGraphRequest("OrderFulfillmentCancel")
cy.get(BUTTON_SELECTORS.submit).click(); .get(BUTTON_SELECTORS.submit)
cy.wait("@OrderFulfillmentCancel"); .click()
.waitForRequestAndCheckIfNoErrors("@OrderFulfillmentCancel");
getOrder(order.id); getOrder(order.id);
}) })
.then(orderResp => { .then(orderResp => {
@ -198,7 +201,9 @@ filterTests(["all"], () => {
.addAliasToGraphRequest("OrderFulfillmentRefundProducts"); .addAliasToGraphRequest("OrderFulfillmentRefundProducts");
cy.get(BUTTON_SELECTORS.submit) cy.get(BUTTON_SELECTORS.submit)
.click() .click()
.wait("@OrderFulfillmentRefundProducts"); .waitForRequestAndCheckIfNoErrors(
"@OrderFulfillmentRefundProducts"
);
getOrder(order.id); getOrder(order.id);
}) })
.then(orderResp => { .then(orderResp => {

View file

@ -1,17 +1,21 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; 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_TYPE_DETAILS } from "../../elements/pageTypes/pageTypeDetails";
import { PAGE_TYPES_LIST } from "../../elements/pageTypes/pageTypesList"; import { PAGE_TYPES_LIST } from "../../elements/pageTypes/pageTypesList";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { assignElements } from "../../steps/shared/assignElements"; import { pageTypeDetailsUrl, urlList } from "../../fixtures/urlList";
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages"; import { createAttribute } from "../../support/api/requests/Attribute";
import {
createPageType,
getPageType
} from "../../support/api/requests/PageType";
import filterTests from "../../support/filterTests"; import filterTests from "../../support/filterTests";
import { pageTypeDetailsUrl, urlList } from "../../url/urlList";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Tests for page types", () => { describe("Tests for page types", () => {
const startsWith = "PageTypes"; const startsWith = "PageTypes";
@ -29,9 +33,9 @@ filterTests(["all"], () => {
.type(randomName) .type(randomName)
.addAliasToGraphRequest("PageTypeCreate") .addAliasToGraphRequest("PageTypeCreate")
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear()
cy.wait("@PageTypeCreate") .waitForRequestAndCheckIfNoErrors("@PageTypeCreate")
.its("response.body.data.pageTypeCreate.pageType") .its("response.body.data.pageTypeCreate.pageType")
.then(pageType => { .then(pageType => {
getPageType(pageType.id); getPageType(pageType.id);
@ -51,9 +55,9 @@ filterTests(["all"], () => {
.get(SHARED_ELEMENTS.progressBar) .get(SHARED_ELEMENTS.progressBar)
.should("be.not.visible") .should("be.not.visible")
.get(PAGE_TYPE_DETAILS.assignAttributesButton) .get(PAGE_TYPE_DETAILS.assignAttributesButton)
.click(); .click()
assignElements(randomName, false); .assignElements(randomName, false)
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
getPageType(pageType.id); getPageType(pageType.id);
}) })
.then(pageType => { .then(pageType => {

View file

@ -1,12 +1,17 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; import faker from "faker";
import { createAttribute } from "../../apiRequests/Attribute"; import { createAttribute } from "../../support/api/requests/Attribute";
import { getPage } from "../../apiRequests/Page"; import { getPage } from "../../support/api/requests/Page";
import { createPageType } from "../../apiRequests/PageTypes"; import { createPageType } from "../../support/api/requests/PageType";
import { attributesTypes, createPage } from "../../steps/pageSteps"; import { deleteAttributesStartsWith } from "../../support/api/utils/attributes/attributeUtils";
import { deleteAttributesStartsWith } from "../../utils/attributes/attributeUtils"; import { deletePageTypesStartsWith } from "../../support/api/utils/pageTypeUtils";
import { deletePageTypesStartsWith } from "../../utils/pageTypeUtils"; import filterTests from "../../support/filterTests";
import { attributesTypes, createPage } from "../../support/pages/pagesPage";
filterTests({ definedTags: ["all"] }, () => {
describe("Tests for pages", () => { describe("Tests for pages", () => {
const startsWith = `Pages`; const startsWith = `Pages`;
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
@ -53,7 +58,11 @@ describe("Tests for pages", () => {
it("should create published page", () => { it("should create published page", () => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
createPage({ pageName: randomName, pageTypeName: name, isPublished: true }) createPage({
pageName: randomName,
pageTypeName: name,
isPublished: true
})
.then(page => { .then(page => {
getPage(page.id, "token"); getPage(page.id, "token");
}) })
@ -101,3 +110,4 @@ describe("Tests for pages", () => {
}); });
}); });
}); });
});

View file

@ -1,30 +1,30 @@
// <reference types="cypress" /> /// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; 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 { PRODUCT_DETAILS } from "../../elements/catalog/products/product-details";
import { PRODUCTS_LIST } from "../../elements/catalog/products/products-list"; import { PRODUCTS_LIST } from "../../elements/catalog/products/products-list";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { urlList } from "../../fixtures/urlList";
import { metadataForms } from "../../steps/catalog/metadataSteps"; import { ONE_PERMISSION_USERS } from "../../fixtures/users";
import { import { createAttribute } from "../../support/api/requests/Attribute";
fillUpPriceList, import { createTypeProduct } from "../../support/api/requests/ProductType";
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 { import {
expectCorrectProductInformation, expectCorrectProductInformation,
expectCorrectProductVariantInformation expectCorrectProductVariantInformation
} from "../../utils/products/checkProductInfo"; } from "../../support/api/utils/products/checkProductInfo";
import * as productUtils from "../../utils/products/productsUtils"; 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", () => { describe("Create product", () => {
const startsWith = "CyCreateProduct-"; const startsWith = "CyCreateProduct-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
@ -75,11 +75,12 @@ filterTests(["all", "critical"], () => {
createTpeAndFillUpProductFields(randomName, true, productData).then( createTpeAndFillUpProductFields(randomName, true, productData).then(
productOrgResp => (productData.productOrganization = productOrgResp) productOrgResp => (productData.productOrganization = productOrgResp)
); );
cy.addAliasToGraphRequest("ProductDetails"); cy.addAliasToGraphRequest("ProductDetails")
cy.get(BUTTON_SELECTORS.confirm).click(); .get(BUTTON_SELECTORS.confirm)
confirmationMessageShouldDisappear(); .click()
cy.wait("@ProductDetails"); .confirmationMessageShouldDisappear()
cy.get("@ProductDetails") .waitForRequestAndCheckIfNoErrors("@ProductDetails")
.get("@ProductDetails")
.its("response.body") .its("response.body")
.then(resp => { .then(resp => {
const productResp = resp.find(element => element.data.product).data const productResp = resp.find(element => element.data.product).data
@ -105,12 +106,14 @@ filterTests(["all", "critical"], () => {
selectChannelInDetailsPages(); selectChannelInDetailsPages();
fillUpPriceList(prices.sellingPrice); fillUpPriceList(prices.sellingPrice);
fillUpPriceList(prices.costPrice, priceInputLists.costPrice); fillUpPriceList(prices.costPrice, priceInputLists.costPrice);
cy.get(PRODUCT_DETAILS.skuInput).type(randomName); cy.get(PRODUCT_DETAILS.skuInput)
cy.addAliasToGraphRequest("ProductDetails"); .type(randomName)
cy.get(BUTTON_SELECTORS.confirm).click(); .addAliasToGraphRequest("ProductDetails")
confirmationMessageShouldDisappear(); .get(BUTTON_SELECTORS.confirm)
cy.wait("@ProductDetails"); .click()
cy.get("@ProductDetails") .confirmationMessageShouldDisappear()
.wait("@ProductDetails")
.get("@ProductDetails")
.its("response.body") .its("response.body")
.then(resp => { .then(resp => {
const productResp = resp.find(element => element.data.product).data const productResp = resp.find(element => element.data.product).data

View file

@ -1,18 +1,19 @@
/// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { getProductDetails } from "../../../apiRequests/storeFront/ProductDetails"; import { productDetailsUrl } from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../Data/users"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { updateProductIsAvailableForPurchase } from "../../../steps/catalog/products/productSteps"; 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 filterTests from "../../../support/filterTests";
import { productDetailsUrl } from "../../../url/urlList"; import { updateProductIsAvailableForPurchase } from "../../../support/pages/catalog/products/productDetailsPage";
import { getDefaultChannel } from "../../../utils/channelsUtils";
import * as productsUtils from "../../../utils/products/productsUtils";
import * as shippingUtils from "../../../utils/shippingUtils";
import { isProductAvailableForPurchase } from "../../../utils/storeFront/storeFrontProductUtils";
// <reference types="cypress" /> filterTests({ definedTags: ["all"] }, () => {
filterTests(["all"], () => {
describe("Products available in listings", () => { describe("Products available in listings", () => {
const startsWith = "CyAvailForPurchase-"; const startsWith = "CyAvailForPurchase-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,17 +1,18 @@
/// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { getProductDetails } from "../../../apiRequests/storeFront/ProductDetails"; import { productDetailsUrl } from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../Data/users"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { updateProductPublish } from "../../../steps/catalog/products/productSteps"; 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 filterTests from "../../../support/filterTests";
import { productDetailsUrl } from "../../../url/urlList"; import { updateProductPublish } from "../../../support/pages/catalog/products/productDetailsPage";
import { getDefaultChannel } from "../../../utils/channelsUtils";
import * as productsUtils from "../../../utils/products/productsUtils";
import { isProductVisible } from "../../../utils/storeFront/storeFrontProductUtils";
// <reference types="cypress" /> filterTests({ definedTags: ["all"] }, () => {
filterTests(["all"], () => {
describe("Published products", () => { describe("Published products", () => {
const startsWith = "CyPublishedProducts-"; const startsWith = "CyPublishedProducts-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,17 +1,17 @@
/// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { searchInShop } from "../../../apiRequests/storeFront/Search"; import { productDetailsUrl } from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../Data/users"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { updateProductVisibleInListings } from "../../../steps/catalog/products/productSteps"; 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 filterTests from "../../../support/filterTests";
import { productDetailsUrl } from "../../../url/urlList"; import { updateProductVisibleInListings } from "../../../support/pages/catalog/products/productDetailsPage";
import { getDefaultChannel } from "../../../utils/channelsUtils";
import * as productsUtils from "../../../utils/products/productsUtils";
import { isProductVisibleInSearchResult } from "../../../utils/storeFront/storeFrontProductUtils";
// <reference types="cypress" /> filterTests({ definedTags: ["all"] }, () => {
filterTests(["all"], () => {
describe("Products displayed in listings", () => { describe("Products displayed in listings", () => {
const startsWith = "CyVisibleInListings-"; const startsWith = "CyVisibleInListings-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;

View file

@ -1,29 +1,30 @@
/// <reference types="cypress"/>
/// <reference types="../../../support"/>
import faker from "faker"; import faker from "faker";
import { createCollection } from "../../../apiRequests/Collections";
import { updateProduct } from "../../../apiRequests/Product";
import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"; import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list";
import { import { urlList } from "../../../fixtures/urlList";
selectChannel, import { createCollection } from "../../../support/api/requests/Collections";
selectFilterOption, import { updateProduct } from "../../../support/api/requests/Product";
selectProductsOutOfStock import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
} 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 { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../../utils/products/productsUtils"; } from "../../../support/api/utils/products/productsUtils";
import { import {
createShipping, createShipping,
deleteShippingStartsWith 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", () => { describe("Filtering products", () => {
const startsWith = "CyFilterProducts-"; const startsWith = "CyFilterProducts-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
@ -83,16 +84,17 @@ filterTests(["all"], () => {
updateProduct(product.id, { collections: [collection.id] }); updateProduct(product.id, { collections: [collection.id] });
}); });
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest() .loginUserViaRequest()
.visit(urlList.products); .visit(urlList.products);
}); });
const filterProductsBy = ["category", "collection", "productType"]; const filterProductsBy = ["category", "collection", "productType"];
filterProductsBy.forEach(filterBy => { filterProductsBy.forEach(filterBy => {
it(`should filter products by ${filterBy}`, () => { it(`should filter products by ${filterBy}`, () => {
cy.softExpectSkeletonIsVisible(); cy.softExpectSkeletonIsVisible().waitForProgressBarToNotExist();
waitForProgressBarToNotExist();
selectFilterOption(filterBy, name); selectFilterOption(filterBy, name);
cy.getTextFromElement(PRODUCTS_LIST.productsNames).then(product => { cy.getTextFromElement(PRODUCTS_LIST.productsNames).then(product => {
expect(product).to.includes(name); expect(product).to.includes(name);
@ -113,11 +115,14 @@ filterTests(["all"], () => {
categoryId: category.id, categoryId: category.id,
price price
}); });
cy.waitForProgressBarToNotExist();
selectChannel(channel.slug); selectChannel(channel.slug);
selectProductsOutOfStock(); selectProductsOutOfStock();
searchInTable(productOutOfStock); cy.searchInTable(productOutOfStock)
cy.get(PRODUCTS_LIST.productsNames).should("have.length", 1); .get(PRODUCTS_LIST.productsNames)
cy.getTextFromElement(PRODUCTS_LIST.productsNames).then(product => { .should("have.length", 1)
.getTextFromElement(PRODUCTS_LIST.productsNames)
.then(product => {
expect(product).to.includes(productOutOfStock); expect(product).to.includes(productOutOfStock);
}); });
}); });

View file

@ -1,14 +1,16 @@
/// <reference types="cypress"/>
/// <reference types="../../../support"/>
import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"; import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { urlList } from "../../../fixtures/urlList";
import filterTests from "../../../support/filterTests";
import { import {
getDisplayedColumnArray, getDisplayedColumnArray,
isNumberOfProductsSameAsInSelectResultsOnPage isNumberOfProductsSameAsInSelectResultsOnPage
} from "../../../steps/catalog/products/productsListSteps"; } from "../../../support/pages/catalog/products/productsListPage";
import { waitForProgressBarToNotExist } from "../../../steps/shared/progressBar";
import filterTests from "../../../support/filterTests";
import { urlList } from "../../../url/urlList";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Products", () => { describe("Products", () => {
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
@ -26,10 +28,11 @@ filterTests(["all"], () => {
getDisplayedColumnArray("name").then( getDisplayedColumnArray("name").then(
productsList => (firstPageProducts = productsList) productsList => (firstPageProducts = productsList)
); );
cy.addAliasToGraphRequest("ProductList"); cy.addAliasToGraphRequest("ProductList")
cy.get(PRODUCTS_LIST.nextPageButton).click(); .get(PRODUCTS_LIST.nextPageButton)
waitForProgressBarToNotExist(); .click()
cy.wait("@ProductList"); .waitForProgressBarToNotExist()
.wait("@ProductList");
getDisplayedColumnArray("name").then(productList => { getDisplayedColumnArray("name").then(productList => {
expect(productList).to.not.equal(firstPageProducts); expect(productList).to.not.equal(firstPageProducts);
}); });
@ -50,8 +53,8 @@ filterTests(["all"], () => {
`${PRODUCTS_LIST.rowNumberOption}${BUTTON_SELECTORS.notSelectedOption}` `${PRODUCTS_LIST.rowNumberOption}${BUTTON_SELECTORS.notSelectedOption}`
) )
.first() .first()
.click(); .click()
waitForProgressBarToNotExist(); .waitForProgressBarToNotExist();
isNumberOfProductsSameAsInSelectResultsOnPage().then( isNumberOfProductsSameAsInSelectResultsOnPage().then(
isTheSame => isTheSame =>
expect( expect(

View file

@ -1,11 +1,13 @@
/// <reference types="cypress"/>
/// <reference types="../../../support"/>
import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"; import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list";
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
import { waitForProgressBarToNotExist } from "../../../steps/shared/progressBar"; import { urlList } from "../../../fixtures/urlList";
import { expectProductsSortedBy } from "../../../support/api/utils/products/productsListUtils";
import filterTests from "../../../support/filterTests"; import filterTests from "../../../support/filterTests";
import { urlList } from "../../../url/urlList";
import { expectProductsSortedBy } from "../../../utils/products/productsListUtils";
filterTests(["all"], () => { filterTests({ definedTags: ["all"] }, () => {
describe("Sorting products", () => { describe("Sorting products", () => {
const sortByList = ["name", "type"]; const sortByList = ["name", "type"];
sortByList.forEach(sortBy => { sortByList.forEach(sortBy => {
@ -16,14 +18,16 @@ filterTests(["all"], () => {
cy.softExpectSkeletonIsVisible(); cy.softExpectSkeletonIsVisible();
cy.get(SHARED_ELEMENTS.header).should("be.visible"); cy.get(SHARED_ELEMENTS.header).should("be.visible");
if (sortBy !== "name") { if (sortBy !== "name") {
cy.get(PRODUCTS_LIST.tableHeaders[sortBy]).click(); cy.get(PRODUCTS_LIST.tableHeaders[sortBy])
waitForProgressBarToNotExist(); .click()
.waitForProgressBarToNotExist();
} }
expectProductsSortedBy(sortBy); expectProductsSortedBy(sortBy);
cy.addAliasToGraphRequest("ProductList") cy.addAliasToGraphRequest("ProductList")
.get(PRODUCTS_LIST.tableHeaders[sortBy]) .get(PRODUCTS_LIST.tableHeaders[sortBy])
.click(); .click()
waitForProgressBarToNotExist().wait("@ProductList"); .waitForProgressBarToNotExist()
.waitForRequestAndCheckIfNoErrors("@ProductList");
expectProductsSortedBy(sortBy, false); expectProductsSortedBy(sortBy, false);
}); });
}); });

View file

@ -1,29 +1,31 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; 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 { import {
createProduct, createProduct,
updateChannelInProduct updateChannelInProduct
} from "../../apiRequests/Product"; } from "../../support/api/requests/Product";
import { ONE_PERMISSION_USERS } from "../../Data/users"; 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 { import {
createFirstVariant, createFirstVariant,
createVariant, createVariant,
variantsShouldBeVisible variantsShouldBeVisible
} from "../../steps/catalog/products/VariantsSteps"; } from "../../support/pages/catalog/products/VariantsPage";
import { enterHomePageChangeChannelAndReturn } from "../../steps/channelsSteps"; import { enterHomePageChangeChannelAndReturn } from "../../support/pages/channelsPage";
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";
// <reference types="cypress" />
filterTests(["all", "critical"], () => { filterTests({ definedTags: ["all", "critical"] }, () => {
describe("Creating variants", () => { describe("Creating variants", () => {
const startsWith = "CyCreateVariants-"; const startsWith = "CyCreateVariants-";
const attributeValues = ["value1", "value2"]; const attributeValues = ["value1", "value2"];

View file

@ -1,27 +1,28 @@
/// <reference types="cypress"/>
/// <reference types="../../support"/>
import faker from "faker"; 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 { PRODUCT_DETAILS } from "../../elements/catalog/products/product-details";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements"; import { productDetailsUrl } from "../../fixtures/urlList";
import { metadataForms } from "../../steps/catalog/metadataSteps"; import { ONE_PERMISSION_USERS } from "../../fixtures/users";
import { fillUpCommonFieldsForAllProductTypes } from "../../steps/catalog/products/productSteps"; import { createCategory } from "../../support/api/requests/Category";
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages"; import { createCollection } from "../../support/api/requests/Collections";
import filterTests from "../../support/filterTests"; import { getProductDetails } from "../../support/api/requests/storeFront/ProductDetails";
import { productDetailsUrl } from "../../url/urlList"; import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
import { getDefaultChannel } from "../../utils/channelsUtils"; import { deleteCollectionsStartsWith } from "../../support/api/utils/collectionsUtils";
import { deleteCollectionsStartsWith } from "../../utils/collectionsUtils"; import { expectCorrectProductInformation } from "../../support/api/utils/products/checkProductInfo";
import { expectCorrectProductInformation } from "../../utils/products/checkProductInfo";
import { import {
createProductInChannel, createProductInChannel,
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith 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", () => { describe("Update products", () => {
const startsWith = "CyUpdateProducts-"; const startsWith = "CyUpdateProducts-";
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
@ -107,14 +108,15 @@ filterTests(["all"], () => {
.get(PRODUCT_DETAILS.collectionRemoveButtons) .get(PRODUCT_DETAILS.collectionRemoveButtons)
.click(); .click();
fillUpCommonFieldsForAllProductTypes(productData, false); fillUpCommonFieldsForAllProductTypes(productData, false);
cy.addAliasToGraphRequest("UpdatePrivateMetadata"); cy.addAliasToGraphRequest("UpdatePrivateMetadata")
cy.addAliasToGraphRequest("UpdateMetadata"); .addAliasToGraphRequest("UpdateMetadata")
cy.addAliasToGraphRequest("ProductUpdate"); .addAliasToGraphRequest("ProductUpdate")
cy.get(BUTTON_SELECTORS.confirm).click(); .get(BUTTON_SELECTORS.confirm)
confirmationMessageShouldDisappear(); .click()
cy.wait("@ProductUpdate"); .confirmationMessageShouldDisappear()
cy.wait("@UpdateMetadata"); .waitForRequestAndCheckIfNoErrors("@ProductUpdate")
cy.wait("@UpdatePrivateMetadata"); .waitForRequestAndCheckIfNoErrors("@UpdateMetadata")
.waitForRequestAndCheckIfNoErrors("@UpdatePrivateMetadata");
productData.productOrganization.productType = name; productData.productOrganization.productType = name;
productData.attribute = attribute; productData.attribute = attribute;
cy.loginUserViaRequest("token") cy.loginUserViaRequest("token")
@ -138,7 +140,7 @@ filterTests(["all"], () => {
.click() .click()
.get(BUTTON_SELECTORS.submit) .get(BUTTON_SELECTORS.submit)
.click() .click()
.wait("@ProductDelete") .waitForRequestAndCheckIfNoErrors("@ProductDelete")
.loginUserViaRequest("token") .loginUserViaRequest("token")
.then(() => { .then(() => {
getProductDetails(product.id, defaultChannel.slug).its("body.data"); getProductDetails(product.id, defaultChannel.slug).its("body.data");

View file

@ -1,29 +1,31 @@
/// <reference types="cypress"/>
/// <reference types="../support"/>
import faker from "faker"; import faker from "faker";
import {
deleteStaffMembersStartsWith,
updateStaffMember
} from "../apiRequests/StaffMembers";
import { LEFT_MENU_SELECTORS } from "../elements/account/left-menu/left-menu-selectors"; import { LEFT_MENU_SELECTORS } from "../elements/account/left-menu/left-menu-selectors";
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
import { STAFF_MEMBER_DETAILS } from "../elements/staffMembers/staffMemberDetails"; import { STAFF_MEMBER_DETAILS } from "../elements/staffMembers/staffMemberDetails";
import { STAFF_MEMBERS_LIST } from "../elements/staffMembers/staffMembersList"; import { STAFF_MEMBERS_LIST } from "../elements/staffMembers/staffMembersList";
import { expectWelcomeMessageIncludes } from "../steps/homePageSteps"; import { urlList, userDetailsUrl } from "../fixtures/urlList";
import { getDisplayedSelectors } from "../steps/permissions"; import {
import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages"; 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 { import {
fillUpSetPassword, fillUpSetPassword,
fillUpUserDetails, fillUpUserDetails,
updateUserActiveFlag updateUserActiveFlag
} from "../steps/user"; } from "../support/pages/userPage";
import filterTests from "../support/filterTests";
import { urlList, userDetailsUrl } from "../url/urlList";
import {
getMailActivationLinkForUser,
inviteStaffMemberWithFirstPermission
} from "../utils/users";
filterTests(["stagedOnly"], () => { filterTests({ definedTags: ["stagedOnly"] }, () => {
describe("Staff members", () => { describe("Staff members", () => {
const startsWith = "StaffMembers"; const startsWith = "StaffMembers";
const password = Cypress.env("USER_PASSWORD"); const password = Cypress.env("USER_PASSWORD");
@ -99,9 +101,9 @@ filterTests(["stagedOnly"], () => {
.click() .click()
.addAliasToGraphRequest("StaffMemberUpdate") .addAliasToGraphRequest("StaffMemberUpdate")
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click(); .click()
confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear()
cy.wait("@StaffMemberUpdate") .waitForRequestAndCheckIfNoErrors("@StaffMemberUpdate")
.clearSessionData() .clearSessionData()
.loginUserViaRequest("auth", { email, password }) .loginUserViaRequest("auth", { email, password })
.visit(urlList.homePage); .visit(urlList.homePage);

View file

@ -15,11 +15,17 @@
/** /**
* @type {Cypress.PluginConfig} * @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 // make env variables visible for cypress
config.env.API_URI = process.env.API_URI; config.env.API_URI = process.env.API_URI;
config.env.APP_MOUNT_URI = process.env.APP_MOUNT_URI; config.env.APP_MOUNT_URI = process.env.APP_MOUNT_URI;
config.env.mailHogUrl = process.env.CYPRESS_MAILHOG; config.env.mailHogUrl = process.env.CYPRESS_MAILHOG;
config.env.SHOP = await getShopInfo(process.env);
on("before:browser:launch", (browser = {}, launchOptions) => { on("before:browser:launch", (browser = {}, launchOptions) => {
launchOptions.args.push("--proxy-bypass-list=<-loopback>"); launchOptions.args.push("--proxy-bypass-list=<-loopback>");
@ -27,3 +33,34 @@ module.exports = (on, config) => {
}); });
return 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);
});
}

View file

@ -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");
}

View file

@ -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");
}

View file

@ -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);
});
}

View file

@ -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();
}

View file

@ -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");
}

View file

@ -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");
}

View file

@ -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);
}
});
}

View file

@ -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");
}

View file

@ -1,4 +1,4 @@
import { stringify } from "../support/format/formatJson"; import { stringify } from "../.././formatData/formatJson";
import { getValueWithDefault, getVariantsListIds } from "./utils/Utils"; import { getValueWithDefault, getVariantsListIds } from "./utils/Utils";
export function getFirstProducts(first, search) { export function getFirstProducts(first, search) {
@ -18,6 +18,7 @@ export function getFirstProducts(first, search) {
} }
} }
} }
}
}`; }`;
return cy return cy
.sendRequestWithQuery(query) .sendRequestWithQuery(query)

View file

@ -1,3 +1,4 @@
import { returnValueDependsOnShopVersion } from "../../formatData/dataDependingOnVersion";
import { getValueWithDefault } from "./utils/Utils"; import { getValueWithDefault } from "./utils/Utils";
export function createTypeProduct({ export function createTypeProduct({
@ -5,8 +6,10 @@ export function createTypeProduct({
attributeId, attributeId,
hasVariants = true, hasVariants = true,
slug = name, slug = name,
shippable = true shippable = true,
kind = "NORMAL"
}) { }) {
const kindLines = returnValueDependsOnShopVersion("3.1", `kind: ${kind}`);
const productAttributesLine = getValueWithDefault( const productAttributesLine = getValueWithDefault(
attributeId, attributeId,
`productAttributes: "${attributeId}"` `productAttributes: "${attributeId}"`
@ -23,6 +26,7 @@ export function createTypeProduct({
hasVariants: ${hasVariants} hasVariants: ${hasVariants}
${variantAttributesLine} ${variantAttributesLine}
isShippingRequired:${shippable} isShippingRequired:${shippable}
${kindLines}
}){ }){
productErrors{ productErrors{
field field

View file

@ -37,6 +37,7 @@ export function getShopInfo() {
const query = `query{ const query = `query{
shop{ shop{
name name
version
domain{ domain{
host host
} }

View file

@ -1,4 +1,4 @@
import { urlList } from "../url/urlList"; import { urlList } from "../../../fixtures/urlList";
export function getStaffMembersStartsWith(startsWith) { export function getStaffMembersStartsWith(startsWith) {
const query = `query{ const query = `query{

View file

@ -1,4 +1,4 @@
import { deleteApp, getApps } from "../apiRequests/Apps"; import { deleteApp, getApps } from "../requests/Apps";
export function deleteAppsStartsWith(startsWith) { export function deleteAppsStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteApp, getApps, startsWith); cy.deleteElementsStartsWith(deleteApp, getApps, startsWith);

View file

@ -1,4 +1,4 @@
import { deleteAttribute, getAttributes } from "../apiRequests/Attribute"; import { deleteAttribute, getAttributes } from "../../requests/Attribute";
export function deleteAttributesStartsWith(startsWith) { export function deleteAttributesStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteAttribute, getAttributes, startsWith); cy.deleteElementsStartsWith(deleteAttribute, getAttributes, startsWith);

View file

@ -1,4 +1,4 @@
import { deleteCategory, getCategories } from "../apiRequests/Category"; import { deleteCategory, getCategories } from "../requests/Category";
export function deleteCategoriesStartsWith(startsWith) { export function deleteCategoriesStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteCategory, getCategories, startsWith); cy.deleteElementsStartsWith(deleteCategory, getCategories, startsWith);

View file

@ -1,4 +1,4 @@
import * as channels from "../apiRequests/Channels"; import * as channels from "../requests/Channels";
export function deleteChannelsStartsWith(nameStartsWith) { export function deleteChannelsStartsWith(nameStartsWith) {
channels.getChannels().then(resp => { channels.getChannels().then(resp => {

View file

@ -1,4 +1,4 @@
import { deleteCollection, getCollections } from "../apiRequests/Collections"; import { deleteCollection, getCollections } from "../requests/Collections";
export function deleteCollectionsStartsWith(startsWith) { export function deleteCollectionsStartsWith(startsWith) {
cy.deleteElementsStartsWith(deleteCollection, getCollections, startsWith); cy.deleteElementsStartsWith(deleteCollection, getCollections, startsWith);

Some files were not shown because too many files have changed in this diff Show more