diff --git a/CHANGELOG.md b/CHANGELOG.md index d6de444ff..c85282781 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,3 +24,4 @@ All notable, unreleased changes to this project will be documented in this file. - Add search bars - #172 by @dominik-zeglen - Add sorting to product list - #173 by @dominik-zeglen - Add Heroku integration - #175 by @bogdal +- Add testcafe tags to attributes, categories, collections and product types - #178 by @dominik-zeglen diff --git a/src/attributes/components/AttributeList/AttributeList.tsx b/src/attributes/components/AttributeList/AttributeList.tsx index 715a2badb..17afe3b17 100644 --- a/src/attributes/components/AttributeList/AttributeList.tsx +++ b/src/attributes/components/AttributeList/AttributeList.tsx @@ -13,7 +13,7 @@ import Skeleton from "@saleor/components/Skeleton"; import TableHead from "@saleor/components/TableHead"; import TablePagination from "@saleor/components/TablePagination"; import { translateBoolean } from "@saleor/intl"; -import { renderCollection } from "@saleor/misc"; +import { maybe, renderCollection } from "@saleor/misc"; import { ListActions, ListProps } from "@saleor/types"; import { AttributeList_attributes_edges_node } from "../../types/AttributeList"; @@ -139,6 +139,11 @@ const AttributeList: React.StatelessComponent = ({ key={attribute ? attribute.id : "skeleton"} onClick={attribute && onRowClick(attribute.id)} className={classes.link} + data-tc="id" + data-tc-id={maybe(() => attribute.id)} + data-tc-values={JSON.stringify( + maybe(() => attribute.values, []) + )} > = ({ onChange={() => toggle(attribute.id)} /> - + {attribute ? attribute.slug : } - + {attribute ? attribute.name : } - + attribute.visibleInStorefront)} + > {attribute ? ( translateBoolean(attribute.visibleInStorefront, intl) ) : ( )} - + attribute.filterableInDashboard + )} + > {attribute ? ( translateBoolean(attribute.filterableInDashboard, intl) ) : ( )} - + attribute.filterableInStorefront + )} + > {attribute ? ( translateBoolean(attribute.filterableInStorefront, intl) ) : ( diff --git a/src/attributes/queries.ts b/src/attributes/queries.ts index 66f82d08d..f8850d581 100644 --- a/src/attributes/queries.ts +++ b/src/attributes/queries.ts @@ -72,6 +72,11 @@ const attributeList = gql` edges { node { ...AttributeFragment + values { + id + name + slug + } } } pageInfo { diff --git a/src/attributes/types/AttributeList.ts b/src/attributes/types/AttributeList.ts index d5f296707..ad5050ce5 100644 --- a/src/attributes/types/AttributeList.ts +++ b/src/attributes/types/AttributeList.ts @@ -8,6 +8,13 @@ import { AttributeFilterInput } from "./../../types/globalTypes"; // GraphQL query operation: AttributeList // ==================================================== +export interface AttributeList_attributes_edges_node_values { + __typename: "AttributeValue"; + id: string; + name: string | null; + slug: string | null; +} + export interface AttributeList_attributes_edges_node { __typename: "Attribute"; id: string; @@ -16,6 +23,7 @@ export interface AttributeList_attributes_edges_node { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + values: (AttributeList_attributes_edges_node_values | null)[] | null; } export interface AttributeList_attributes_edges { diff --git a/src/categories/components/CategoryList/CategoryList.tsx b/src/categories/components/CategoryList/CategoryList.tsx index dc18b965a..5ae05489e 100644 --- a/src/categories/components/CategoryList/CategoryList.tsx +++ b/src/categories/components/CategoryList/CategoryList.tsx @@ -17,7 +17,7 @@ import Checkbox from "@saleor/components/Checkbox"; import Skeleton from "@saleor/components/Skeleton"; import TableHead from "@saleor/components/TableHead"; import TablePagination from "@saleor/components/TablePagination"; -import { renderCollection } from "@saleor/misc"; +import { maybe, renderCollection } from "@saleor/misc"; import { ListActions, ListProps } from "@saleor/types"; const styles = (theme: Theme) => @@ -126,6 +126,8 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })( onClick={category ? onRowClick(category.id) : undefined} key={category ? category.id : "skeleton"} selected={isSelected} + data-tc="id" + data-tc-id={maybe(() => category.id)} > toggle(category.id)} /> - + {category && category.name ? category.name : } diff --git a/src/collections/components/CollectionList/CollectionList.tsx b/src/collections/components/CollectionList/CollectionList.tsx index 68d7302df..aeca0420e 100644 --- a/src/collections/components/CollectionList/CollectionList.tsx +++ b/src/collections/components/CollectionList/CollectionList.tsx @@ -122,6 +122,8 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })( onClick={collection ? onRowClick(collection.id) : undefined} key={collection ? collection.id : "skeleton"} selected={isSelected} + data-tc="id" + data-tc-id={maybe(() => collection.id)} > toggle(collection.id)} /> - + {maybe( () => collection.name, @@ -143,7 +145,11 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })( )} - + collection.isPublished)} + > {maybe( () => ( + attribute.id)} index={attributeIndex || 0} + data-tc="id" + data-tc-id={maybe(() => attribute.id)} > toggle(attribute.id)} /> - + {maybe(() => attribute.name) ? ( attribute.name ) : ( )} - + {maybe(() => attribute.slug) ? ( attribute.slug ) : ( diff --git a/src/productTypes/components/ProductTypeList/ProductTypeList.tsx b/src/productTypes/components/ProductTypeList/ProductTypeList.tsx index 536ec3b90..05cbb2825 100644 --- a/src/productTypes/components/ProductTypeList/ProductTypeList.tsx +++ b/src/productTypes/components/ProductTypeList/ProductTypeList.tsx @@ -124,6 +124,8 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })( key={productType ? productType.id : "skeleton"} onClick={productType ? onRowClick(productType.id) : undefined} selected={isSelected} + data-tc="id" + data-tc-id={maybe(() => productType.id)} > {productType ? ( <> - {productType.name} + {productType.name} {maybe(() => productType.hasVariants) ? intl.formatMessage({ diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index ff25993c7..cedf09a8c 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -10868,6 +10868,9 @@ exports[`Storyshots Views / Attributes / Attribute list default 1`] = ` > author Author Yes Yes No box-size Box Size No Yes No brand Brand No No Yes candy-box-size Candy Box Size No Yes Yes coffee-genre Coffee Genre Yes Yes Yes collar Collar Yes No Yes color Color Yes No No cover Cover No Yes No flavor Flavor Yes Yes Yes language Language Yes No Yes publisher Publisher Yes Yes Yes size Size Yes Yes Yes @@ -11675,6 +11807,8 @@ exports[`Storyshots Views / Attributes / Attribute list loading 1`] = ` > Lorem ipsum dolor @@ -13279,6 +13421,8 @@ exports[`Storyshots Views / Categories / Category list default 1`] = ` Mauris vehicula tortor vulputate @@ -13313,6 +13458,8 @@ exports[`Storyshots Views / Categories / Category list default 1`] = ` Excepteur sint occaecat cupidatat non proident @@ -13347,6 +13495,8 @@ exports[`Storyshots Views / Categories / Category list default 1`] = ` Ut enim ad minim veniam @@ -13381,6 +13532,8 @@ exports[`Storyshots Views / Categories / Category list default 1`] = ` Duis aute irure dolor in reprehenderit @@ -13415,6 +13569,8 @@ exports[`Storyshots Views / Categories / Category list default 1`] = ` Neque porro quisquam est @@ -14051,6 +14208,7 @@ exports[`Storyshots Views / Categories / Category list loading 1`] = ` > Summer collection @@ -25287,6 +25451,8 @@ exports[`Storyshots Views / Collections / Collection list default 1`] = `
Winter sale @@ -25325,6 +25494,8 @@ exports[`Storyshots Views / Collections / Collection list default 1`] = `
Vintage vibes @@ -25363,6 +25537,8 @@ exports[`Storyshots Views / Collections / Collection list default 1`] = `
Merry Christmas @@ -25401,6 +25580,8 @@ exports[`Storyshots Views / Collections / Collection list default 1`] = `
80s Miami @@ -25439,6 +25623,8 @@ exports[`Storyshots Views / Collections / Collection list default 1`] = `
Yellow Submarine 2019 @@ -25477,6 +25666,8 @@ exports[`Storyshots Views / Collections / Collection list default 1`] = `
Author author @@ -78889,6 +79088,8 @@ exports[`Storyshots Views / Product types / Product type details default 1`] = ` Language language @@ -78984,6 +79187,8 @@ exports[`Storyshots Views / Product types / Product type details default 1`] = ` Publisher publisher @@ -79367,6 +79574,7 @@ exports[`Storyshots Views / Product types / Product type details form errors 1`] />
Author author @@ -79545,6 +79757,8 @@ exports[`Storyshots Views / Product types / Product type details form errors 1`] Language language @@ -79640,6 +79856,8 @@ exports[`Storyshots Views / Product types / Product type details form errors 1`] Publisher publisher @@ -80024,6 +80244,7 @@ exports[`Storyshots Views / Product types / Product type details loading 1`] = ` />
- Candy + + Candy + @@ -80973,6 +81204,8 @@ exports[`Storyshots Views / Product types / Product types list default 1`] = ` - E-books + + E-books + @@ -81012,6 +81249,8 @@ exports[`Storyshots Views / Product types / Product types list default 1`] = ` - Mugs + + Mugs + @@ -81051,6 +81294,8 @@ exports[`Storyshots Views / Product types / Product types list default 1`] = ` - Coffee + + Coffee + @@ -81090,6 +81339,8 @@ exports[`Storyshots Views / Product types / Product types list default 1`] = ` - T-Shirt + + T-Shirt + @@ -81396,6 +81651,7 @@ exports[`Storyshots Views / Product types / Product types list loading 1`] = ` >