Merge pull request #178 from mirumee/add/tc-product-types
Add testcafe tags to attributes, categories, collections and product types
This commit is contained in:
commit
aea2ba1e60
9 changed files with 328 additions and 19 deletions
|
@ -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 search bars - #172 by @dominik-zeglen
|
||||||
- Add sorting to product list - #173 by @dominik-zeglen
|
- Add sorting to product list - #173 by @dominik-zeglen
|
||||||
- Add Heroku integration - #175 by @bogdal
|
- Add Heroku integration - #175 by @bogdal
|
||||||
|
- Add testcafe tags to attributes, categories, collections and product types - #178 by @dominik-zeglen
|
||||||
|
|
|
@ -13,7 +13,7 @@ import Skeleton from "@saleor/components/Skeleton";
|
||||||
import TableHead from "@saleor/components/TableHead";
|
import TableHead from "@saleor/components/TableHead";
|
||||||
import TablePagination from "@saleor/components/TablePagination";
|
import TablePagination from "@saleor/components/TablePagination";
|
||||||
import { translateBoolean } from "@saleor/intl";
|
import { translateBoolean } from "@saleor/intl";
|
||||||
import { renderCollection } from "@saleor/misc";
|
import { maybe, renderCollection } from "@saleor/misc";
|
||||||
import { ListActions, ListProps } from "@saleor/types";
|
import { ListActions, ListProps } from "@saleor/types";
|
||||||
import { AttributeList_attributes_edges_node } from "../../types/AttributeList";
|
import { AttributeList_attributes_edges_node } from "../../types/AttributeList";
|
||||||
|
|
||||||
|
@ -139,6 +139,11 @@ const AttributeList: React.StatelessComponent<AttributeListProps> = ({
|
||||||
key={attribute ? attribute.id : "skeleton"}
|
key={attribute ? attribute.id : "skeleton"}
|
||||||
onClick={attribute && onRowClick(attribute.id)}
|
onClick={attribute && onRowClick(attribute.id)}
|
||||||
className={classes.link}
|
className={classes.link}
|
||||||
|
data-tc="id"
|
||||||
|
data-tc-id={maybe(() => attribute.id)}
|
||||||
|
data-tc-values={JSON.stringify(
|
||||||
|
maybe(() => attribute.values, [])
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
<TableCell padding="checkbox">
|
<TableCell padding="checkbox">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
@ -148,27 +153,43 @@ const AttributeList: React.StatelessComponent<AttributeListProps> = ({
|
||||||
onChange={() => toggle(attribute.id)}
|
onChange={() => toggle(attribute.id)}
|
||||||
/>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colSlug}>
|
<TableCell className={classes.colSlug} data-tc="slug">
|
||||||
{attribute ? attribute.slug : <Skeleton />}
|
{attribute ? attribute.slug : <Skeleton />}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colName}>
|
<TableCell className={classes.colName} data-tc="name">
|
||||||
{attribute ? attribute.name : <Skeleton />}
|
{attribute ? attribute.name : <Skeleton />}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colVisible}>
|
<TableCell
|
||||||
|
className={classes.colVisible}
|
||||||
|
data-tc="visible"
|
||||||
|
data-tc-visible={maybe(() => attribute.visibleInStorefront)}
|
||||||
|
>
|
||||||
{attribute ? (
|
{attribute ? (
|
||||||
translateBoolean(attribute.visibleInStorefront, intl)
|
translateBoolean(attribute.visibleInStorefront, intl)
|
||||||
) : (
|
) : (
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colSearchable}>
|
<TableCell
|
||||||
|
className={classes.colSearchable}
|
||||||
|
data-tc="searchable"
|
||||||
|
data-tc-searchable={maybe(
|
||||||
|
() => attribute.filterableInDashboard
|
||||||
|
)}
|
||||||
|
>
|
||||||
{attribute ? (
|
{attribute ? (
|
||||||
translateBoolean(attribute.filterableInDashboard, intl)
|
translateBoolean(attribute.filterableInDashboard, intl)
|
||||||
) : (
|
) : (
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colFaceted}>
|
<TableCell
|
||||||
|
className={classes.colFaceted}
|
||||||
|
data-tc="use-in-faceted-search"
|
||||||
|
data-tc-use-in-faceted-search={maybe(
|
||||||
|
() => attribute.filterableInStorefront
|
||||||
|
)}
|
||||||
|
>
|
||||||
{attribute ? (
|
{attribute ? (
|
||||||
translateBoolean(attribute.filterableInStorefront, intl)
|
translateBoolean(attribute.filterableInStorefront, intl)
|
||||||
) : (
|
) : (
|
||||||
|
|
|
@ -72,6 +72,11 @@ const attributeList = gql`
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
...AttributeFragment
|
...AttributeFragment
|
||||||
|
values {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pageInfo {
|
pageInfo {
|
||||||
|
|
|
@ -8,6 +8,13 @@ import { AttributeFilterInput } from "./../../types/globalTypes";
|
||||||
// GraphQL query operation: AttributeList
|
// 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 {
|
export interface AttributeList_attributes_edges_node {
|
||||||
__typename: "Attribute";
|
__typename: "Attribute";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -16,6 +23,7 @@ export interface AttributeList_attributes_edges_node {
|
||||||
visibleInStorefront: boolean;
|
visibleInStorefront: boolean;
|
||||||
filterableInDashboard: boolean;
|
filterableInDashboard: boolean;
|
||||||
filterableInStorefront: boolean;
|
filterableInStorefront: boolean;
|
||||||
|
values: (AttributeList_attributes_edges_node_values | null)[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AttributeList_attributes_edges {
|
export interface AttributeList_attributes_edges {
|
||||||
|
|
|
@ -17,7 +17,7 @@ import Checkbox from "@saleor/components/Checkbox";
|
||||||
import Skeleton from "@saleor/components/Skeleton";
|
import Skeleton from "@saleor/components/Skeleton";
|
||||||
import TableHead from "@saleor/components/TableHead";
|
import TableHead from "@saleor/components/TableHead";
|
||||||
import TablePagination from "@saleor/components/TablePagination";
|
import TablePagination from "@saleor/components/TablePagination";
|
||||||
import { renderCollection } from "@saleor/misc";
|
import { maybe, renderCollection } from "@saleor/misc";
|
||||||
import { ListActions, ListProps } from "@saleor/types";
|
import { ListActions, ListProps } from "@saleor/types";
|
||||||
|
|
||||||
const styles = (theme: Theme) =>
|
const styles = (theme: Theme) =>
|
||||||
|
@ -126,6 +126,8 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
|
||||||
onClick={category ? onRowClick(category.id) : undefined}
|
onClick={category ? onRowClick(category.id) : undefined}
|
||||||
key={category ? category.id : "skeleton"}
|
key={category ? category.id : "skeleton"}
|
||||||
selected={isSelected}
|
selected={isSelected}
|
||||||
|
data-tc="id"
|
||||||
|
data-tc-id={maybe(() => category.id)}
|
||||||
>
|
>
|
||||||
<TableCell padding="checkbox">
|
<TableCell padding="checkbox">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
@ -135,7 +137,7 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
|
||||||
onChange={() => toggle(category.id)}
|
onChange={() => toggle(category.id)}
|
||||||
/>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colName}>
|
<TableCell className={classes.colName} data-tc="name">
|
||||||
{category && category.name ? category.name : <Skeleton />}
|
{category && category.name ? category.name : <Skeleton />}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colSubcategories}>
|
<TableCell className={classes.colSubcategories}>
|
||||||
|
|
|
@ -122,6 +122,8 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
|
||||||
onClick={collection ? onRowClick(collection.id) : undefined}
|
onClick={collection ? onRowClick(collection.id) : undefined}
|
||||||
key={collection ? collection.id : "skeleton"}
|
key={collection ? collection.id : "skeleton"}
|
||||||
selected={isSelected}
|
selected={isSelected}
|
||||||
|
data-tc="id"
|
||||||
|
data-tc-id={maybe(() => collection.id)}
|
||||||
>
|
>
|
||||||
<TableCell padding="checkbox">
|
<TableCell padding="checkbox">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
@ -131,7 +133,7 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
|
||||||
onChange={() => toggle(collection.id)}
|
onChange={() => toggle(collection.id)}
|
||||||
/>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colName}>
|
<TableCell className={classes.colName} data-tc="name">
|
||||||
{maybe<React.ReactNode>(
|
{maybe<React.ReactNode>(
|
||||||
() => collection.name,
|
() => collection.name,
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
|
@ -143,7 +145,11 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colAvailability}>
|
<TableCell
|
||||||
|
className={classes.colAvailability}
|
||||||
|
data-tc="published"
|
||||||
|
data-tc-published={maybe(() => collection.isPublished)}
|
||||||
|
>
|
||||||
{maybe(
|
{maybe(
|
||||||
() => (
|
() => (
|
||||||
<StatusLabel
|
<StatusLabel
|
||||||
|
|
|
@ -85,7 +85,13 @@ const ProductTypeAttributes = withStyles(styles, {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card
|
||||||
|
data-tc={
|
||||||
|
type === AttributeTypeEnum.PRODUCT
|
||||||
|
? "product-attributes"
|
||||||
|
: "variant-attributes"
|
||||||
|
}
|
||||||
|
>
|
||||||
<CardTitle
|
<CardTitle
|
||||||
title={
|
title={
|
||||||
type === AttributeTypeEnum.PRODUCT
|
type === AttributeTypeEnum.PRODUCT
|
||||||
|
@ -150,6 +156,8 @@ const ProductTypeAttributes = withStyles(styles, {
|
||||||
}
|
}
|
||||||
key={maybe(() => attribute.id)}
|
key={maybe(() => attribute.id)}
|
||||||
index={attributeIndex || 0}
|
index={attributeIndex || 0}
|
||||||
|
data-tc="id"
|
||||||
|
data-tc-id={maybe(() => attribute.id)}
|
||||||
>
|
>
|
||||||
<TableCell padding="checkbox">
|
<TableCell padding="checkbox">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
@ -159,14 +167,14 @@ const ProductTypeAttributes = withStyles(styles, {
|
||||||
onChange={() => toggle(attribute.id)}
|
onChange={() => toggle(attribute.id)}
|
||||||
/>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colName}>
|
<TableCell className={classes.colName} data-tc="name">
|
||||||
{maybe(() => attribute.name) ? (
|
{maybe(() => attribute.name) ? (
|
||||||
attribute.name
|
attribute.name
|
||||||
) : (
|
) : (
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colSlug}>
|
<TableCell className={classes.colSlug} data-tc="slug">
|
||||||
{maybe(() => attribute.slug) ? (
|
{maybe(() => attribute.slug) ? (
|
||||||
attribute.slug
|
attribute.slug
|
||||||
) : (
|
) : (
|
||||||
|
|
|
@ -124,6 +124,8 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(
|
||||||
key={productType ? productType.id : "skeleton"}
|
key={productType ? productType.id : "skeleton"}
|
||||||
onClick={productType ? onRowClick(productType.id) : undefined}
|
onClick={productType ? onRowClick(productType.id) : undefined}
|
||||||
selected={isSelected}
|
selected={isSelected}
|
||||||
|
data-tc="id"
|
||||||
|
data-tc-id={maybe(() => productType.id)}
|
||||||
>
|
>
|
||||||
<TableCell padding="checkbox">
|
<TableCell padding="checkbox">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
@ -136,7 +138,7 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(
|
||||||
<TableCell className={classes.colName}>
|
<TableCell className={classes.colName}>
|
||||||
{productType ? (
|
{productType ? (
|
||||||
<>
|
<>
|
||||||
{productType.name}
|
<span data-tc="name">{productType.name}</span>
|
||||||
<Typography variant="caption">
|
<Typography variant="caption">
|
||||||
{maybe(() => productType.hasVariants)
|
{maybe(() => productType.hasVariants)
|
||||||
? intl.formatMessage({
|
? intl.formatMessage({
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue