From a8a9a5eb3ae03f57747cbcd3cb20e0fecea8ce9c Mon Sep 17 00:00:00 2001 From: Karolina Rakoczy Date: Tue, 2 Mar 2021 09:38:24 +0100 Subject: [PATCH] tests for collections --- .../menage-channel-availability-form.js | 2 +- cypress/integration/channels.js | 3 +-- cypress/integration/products/products.js | 2 +- cypress/steps/productSteps.js | 2 +- cypress/support/user/index.js | 19 ------------------- .../ChannelsAvailabilityContent.tsx | 6 +++++- 6 files changed, 9 insertions(+), 25 deletions(-) diff --git a/cypress/elements/channels/menage-channel-availability-form.js b/cypress/elements/channels/menage-channel-availability-form.js index 873a635f9..dfbc48256 100644 --- a/cypress/elements/channels/menage-channel-availability-form.js +++ b/cypress/elements/channels/menage-channel-availability-form.js @@ -1,7 +1,7 @@ export const MENAGE_CHANNEL_AVAILABILITY_FORM = { channelsMenageButton: "[data-test-id='channels-availiability-manage-button']", allChannelsCheckbox: "[name='allChannels']", - channelRow: "[class*='ChannelsAvailabilityContent-option']", + channelRow: "[data-test-id='channel-row']", channelCheckbox: "[class*='MuiCheckbox']", channelsAvailabilityItem: "[data-test='channel-availability-item']", publishedCheckbox: "[name='isPublished']", diff --git a/cypress/integration/channels.js b/cypress/integration/channels.js index 91999d5e7..9f5e97a38 100644 --- a/cypress/integration/channels.js +++ b/cypress/integration/channels.js @@ -111,8 +111,7 @@ describe("Channels", () => { cy.addAliasToGraphRequest("Channels"); cy.visit(urlList.channels); cy.wait("@Channels"); - cy.get(CHANNELS_SELECTORS.channelName) - .contains(randomChannelToDelete) + cy.contains(CHANNELS_SELECTORS.channelName, randomChannelToDelete) .parentsUntil(CHANNELS_SELECTORS.channelsTable) .find("button") .click(); diff --git a/cypress/integration/products/products.js b/cypress/integration/products/products.js index 87960c269..f594d32d5 100644 --- a/cypress/integration/products/products.js +++ b/cypress/integration/products/products.js @@ -1,6 +1,6 @@ // import { LEFT_MENU_SELECTORS } from "../../elements/account/left-menu/left-menu-selectors"; -import { PRODUCTS_SELECTORS } from "../../elements/catalog/product-selectors"; +import { PRODUCTS_SELECTORS } from "../../elements/catalog/products/product-selectors"; import { urlList } from "../../url/urlList"; describe("Products", () => { diff --git a/cypress/steps/productSteps.js b/cypress/steps/productSteps.js index eec8c3736..355c96d64 100644 --- a/cypress/steps/productSteps.js +++ b/cypress/steps/productSteps.js @@ -1,4 +1,4 @@ -import { PRODUCTS_SELECTORS } from "../elements/catalog/product-selectors"; +import { PRODUCTS_SELECTORS } from "../elements/catalog/products/product-selectors"; class ProductSteps { valueTrue = PRODUCTS_SELECTORS.radioButtonsValueTrue; diff --git a/cypress/support/user/index.js b/cypress/support/user/index.js index 3ba659b6d..33fcc4adc 100644 --- a/cypress/support/user/index.js +++ b/cypress/support/user/index.js @@ -37,22 +37,3 @@ Cypress.Commands.add("loginUserViaRequest", (authorization = "auth") => { ); }); }); -Cypress.Commands.add("loginInShop", () => { - cy.request({ - method: "POST", - url: Cypress.env("API_URI"), - body: [ - { - operationName: "TokenAuth", - variables: { - email: Cypress.env("USER_NAME"), - password: Cypress.env("USER_PASSWORD") - }, - query: - "mutation TokenAuth($email: String!, $password: String!) {\n tokenCreate(email: $email, password: $password) {\n token\n errors: accountErrors {\n code\n field\n message\n __typename\n }\n user {\n id\n __typename\n }\n __typename\n }\n}\n" - } - ] - }).then(resp => { - window.localStorage.setItem("token", resp.body[0].data.tokenCreate.token); - }); -}); diff --git a/src/components/ChannelsAvailabilityContent/ChannelsAvailabilityContent.tsx b/src/components/ChannelsAvailabilityContent/ChannelsAvailabilityContent.tsx index 7b7ef4902..8e799215f 100644 --- a/src/components/ChannelsAvailabilityContent/ChannelsAvailabilityContent.tsx +++ b/src/components/ChannelsAvailabilityContent/ChannelsAvailabilityContent.tsx @@ -83,7 +83,11 @@ export const ChannelsAvailabilityContent: React.FC {filteredChannels?.length ? ( filteredChannels.map(option => ( -
+