tests for collections

This commit is contained in:
Karolina Rakoczy 2021-03-02 09:38:24 +01:00
parent af059da41b
commit a8a9a5eb3a
6 changed files with 9 additions and 25 deletions

View file

@ -1,7 +1,7 @@
export const MENAGE_CHANNEL_AVAILABILITY_FORM = { export const MENAGE_CHANNEL_AVAILABILITY_FORM = {
channelsMenageButton: "[data-test-id='channels-availiability-manage-button']", channelsMenageButton: "[data-test-id='channels-availiability-manage-button']",
allChannelsCheckbox: "[name='allChannels']", allChannelsCheckbox: "[name='allChannels']",
channelRow: "[class*='ChannelsAvailabilityContent-option']", channelRow: "[data-test-id='channel-row']",
channelCheckbox: "[class*='MuiCheckbox']", channelCheckbox: "[class*='MuiCheckbox']",
channelsAvailabilityItem: "[data-test='channel-availability-item']", channelsAvailabilityItem: "[data-test='channel-availability-item']",
publishedCheckbox: "[name='isPublished']", publishedCheckbox: "[name='isPublished']",

View file

@ -111,8 +111,7 @@ describe("Channels", () => {
cy.addAliasToGraphRequest("Channels"); cy.addAliasToGraphRequest("Channels");
cy.visit(urlList.channels); cy.visit(urlList.channels);
cy.wait("@Channels"); cy.wait("@Channels");
cy.get(CHANNELS_SELECTORS.channelName) cy.contains(CHANNELS_SELECTORS.channelName, randomChannelToDelete)
.contains(randomChannelToDelete)
.parentsUntil(CHANNELS_SELECTORS.channelsTable) .parentsUntil(CHANNELS_SELECTORS.channelsTable)
.find("button") .find("button")
.click(); .click();

View file

@ -1,6 +1,6 @@
// <reference types="cypress" /> // <reference types="cypress" />
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 { PRODUCTS_SELECTORS } from "../../elements/catalog/product-selectors"; import { PRODUCTS_SELECTORS } from "../../elements/catalog/products/product-selectors";
import { urlList } from "../../url/urlList"; import { urlList } from "../../url/urlList";
describe("Products", () => { describe("Products", () => {

View file

@ -1,4 +1,4 @@
import { PRODUCTS_SELECTORS } from "../elements/catalog/product-selectors"; import { PRODUCTS_SELECTORS } from "../elements/catalog/products/product-selectors";
class ProductSteps { class ProductSteps {
valueTrue = PRODUCTS_SELECTORS.radioButtonsValueTrue; valueTrue = PRODUCTS_SELECTORS.radioButtonsValueTrue;

View file

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

View file

@ -83,7 +83,11 @@ export const ChannelsAvailabilityContent: React.FC<ChannelsAvailabilityContentPr
> >
{filteredChannels?.length ? ( {filteredChannels?.length ? (
filteredChannels.map(option => ( filteredChannels.map(option => (
<div key={option.id} className={classes.option}> <div
key={option.id}
className={classes.option}
data-test-id="channel-row"
>
<ControlledCheckbox <ControlledCheckbox
checked={isSelected(option)} checked={isSelected(option)}
name={option.name} name={option.name}