Add tc tags for e2e tests
This commit is contained in:
parent
4ec7508b97
commit
6eb3e6d2dd
16 changed files with 72 additions and 13 deletions
|
@ -154,6 +154,9 @@ const LoginCard = withStyles(styles, { name: "LoginCard" })(
|
||||||
name="email"
|
name="email"
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
value={data.email}
|
value={data.email}
|
||||||
|
inputProps={{
|
||||||
|
"data-tc": "email"
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<FormSpacer />
|
<FormSpacer />
|
||||||
<TextField
|
<TextField
|
||||||
|
@ -164,6 +167,7 @@ const LoginCard = withStyles(styles, { name: "LoginCard" })(
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
type="password"
|
type="password"
|
||||||
value={data.password}
|
value={data.password}
|
||||||
|
data-tc="password"
|
||||||
/>
|
/>
|
||||||
<FormSpacer />
|
<FormSpacer />
|
||||||
<div className={classes.buttonContainer}>
|
<div className={classes.buttonContainer}>
|
||||||
|
@ -181,6 +185,7 @@ const LoginCard = withStyles(styles, { name: "LoginCard" })(
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
type="submit"
|
type="submit"
|
||||||
|
data-tc="submit"
|
||||||
>
|
>
|
||||||
{i18n.t("Login")}
|
{i18n.t("Login")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -233,6 +233,7 @@ const MenuList = withStyles(styles, { name: "MenuList" })(
|
||||||
menuItem.ariaLabel === activeSubMenu.label &&
|
menuItem.ariaLabel === activeSubMenu.label &&
|
||||||
activeSubMenu.isActive
|
activeSubMenu.isActive
|
||||||
})}
|
})}
|
||||||
|
data-tc={menuItem.label}
|
||||||
onClick={() => handleSubMenu(menuItem.ariaLabel)}
|
onClick={() => handleSubMenu(menuItem.ariaLabel)}
|
||||||
>
|
>
|
||||||
<SVG
|
<SVG
|
||||||
|
|
|
@ -162,6 +162,7 @@ const MenuNested = withStyles(styles, { name: "MenuNested" })(
|
||||||
className={classNames(classes.menuListNestedClose, {
|
className={classNames(classes.menuListNestedClose, {
|
||||||
[classes.menuListNestedCloseDark]: isDark
|
[classes.menuListNestedCloseDark]: isDark
|
||||||
})}
|
})}
|
||||||
|
data-tc={ariaLabel}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
closeSubMenu({
|
closeSubMenu({
|
||||||
isActive: false,
|
isActive: false,
|
||||||
|
@ -178,6 +179,7 @@ const MenuNested = withStyles(styles, { name: "MenuNested" })(
|
||||||
<a
|
<a
|
||||||
className={classNames(classes.menuListNestedItem)}
|
className={classNames(classes.menuListNestedItem)}
|
||||||
href={createHref(item.url)}
|
href={createHref(item.url)}
|
||||||
|
data-tc={ariaLabel}
|
||||||
onClick={event => closeMenu(item.url, event)}
|
onClick={event => closeMenu(item.url, event)}
|
||||||
key={item.label}
|
key={item.label}
|
||||||
>
|
>
|
||||||
|
|
|
@ -60,7 +60,7 @@ interface ImageTileProps extends WithStyles<typeof styles> {
|
||||||
|
|
||||||
const ImageTile = withStyles(styles, { name: "ImageTile" })(
|
const ImageTile = withStyles(styles, { name: "ImageTile" })(
|
||||||
({ classes, onImageDelete, onImageEdit, image }: ImageTileProps) => (
|
({ classes, onImageDelete, onImageEdit, image }: ImageTileProps) => (
|
||||||
<div className={classes.imageContainer}>
|
<div className={classes.imageContainer} data-tc="product-image">
|
||||||
<div className={classes.imageOverlay}>
|
<div className={classes.imageOverlay}>
|
||||||
<div className={classes.imageOverlayToolbar}>
|
<div className={classes.imageOverlayToolbar}>
|
||||||
{onImageEdit && (
|
{onImageEdit && (
|
||||||
|
|
|
@ -123,7 +123,8 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
placeholder,
|
placeholder,
|
||||||
value,
|
value,
|
||||||
fetchChoices,
|
fetchChoices,
|
||||||
onChange
|
onChange,
|
||||||
|
...props
|
||||||
}: MultiAutocompleteSelectFieldProps & WithStyles<typeof styles>) => {
|
}: MultiAutocompleteSelectFieldProps & WithStyles<typeof styles>) => {
|
||||||
const handleSelect = (
|
const handleSelect = (
|
||||||
item: string,
|
item: string,
|
||||||
|
@ -153,7 +154,7 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
highlightedIndex,
|
highlightedIndex,
|
||||||
inputValue
|
inputValue
|
||||||
}) => (
|
}) => (
|
||||||
<div className={classes.container}>
|
<div className={classes.container} {...props}>
|
||||||
<TextField
|
<TextField
|
||||||
InputProps={{
|
InputProps={{
|
||||||
...getInputProps({
|
...getInputProps({
|
||||||
|
@ -190,6 +191,7 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
{...getItemProps({
|
{...getItemProps({
|
||||||
item: value.value
|
item: value.value
|
||||||
})}
|
})}
|
||||||
|
data-tc="multiautocomplete-select-option"
|
||||||
>
|
>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
className={classes.checkbox}
|
className={classes.checkbox}
|
||||||
|
@ -213,6 +215,7 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
{...getItemProps({
|
{...getItemProps({
|
||||||
item: suggestion.value
|
item: suggestion.value
|
||||||
})}
|
})}
|
||||||
|
data-tc="multiautocomplete-select-option"
|
||||||
>
|
>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={value.includes(suggestion.value)}
|
checked={value.includes(suggestion.value)}
|
||||||
|
@ -238,6 +241,7 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
{...getItemProps({
|
{...getItemProps({
|
||||||
item: inputValue
|
item: inputValue
|
||||||
})}
|
})}
|
||||||
|
data-tc="multiautocomplete-select-option"
|
||||||
>
|
>
|
||||||
<span className={classes.menuItemLabel}>
|
<span className={classes.menuItemLabel}>
|
||||||
{i18n.t("Add new value: {{ value }}", {
|
{i18n.t("Add new value: {{ value }}", {
|
||||||
|
@ -250,7 +254,11 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
!loading && (
|
!loading && (
|
||||||
<MenuItem disabled={true} component="div">
|
<MenuItem
|
||||||
|
disabled={true}
|
||||||
|
component="div"
|
||||||
|
data-tc="multiautocomplete-select-no-options"
|
||||||
|
>
|
||||||
{i18n.t("No results found")}
|
{i18n.t("No results found")}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)
|
)
|
||||||
|
|
|
@ -173,6 +173,7 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
|
||||||
key={product ? product.id : "skeleton"}
|
key={product ? product.id : "skeleton"}
|
||||||
onClick={product && onRowClick(product.id)}
|
onClick={product && onRowClick(product.id)}
|
||||||
className={classes.link}
|
className={classes.link}
|
||||||
|
data-tc={product ? `product-${product.id}` : undefined}
|
||||||
>
|
>
|
||||||
<TableCell padding="checkbox">
|
<TableCell padding="checkbox">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
|
|
@ -103,6 +103,7 @@ export const SaveButtonBar = withStyles(styles, { name: "SaveButtonBar" })(
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={onDelete}
|
onClick={onDelete}
|
||||||
className={classes.deleteButton}
|
className={classes.deleteButton}
|
||||||
|
data-tc="button-bar-delete"
|
||||||
>
|
>
|
||||||
{labels && labels.delete
|
{labels && labels.delete
|
||||||
? labels.delete
|
? labels.delete
|
||||||
|
@ -114,6 +115,7 @@ export const SaveButtonBar = withStyles(styles, { name: "SaveButtonBar" })(
|
||||||
className={classes.cancelButton}
|
className={classes.cancelButton}
|
||||||
variant="text"
|
variant="text"
|
||||||
onClick={onCancel}
|
onClick={onCancel}
|
||||||
|
data-tc="button-bar-cancel"
|
||||||
>
|
>
|
||||||
{maybe(
|
{maybe(
|
||||||
() => labels.cancel,
|
() => labels.cancel,
|
||||||
|
@ -126,6 +128,7 @@ export const SaveButtonBar = withStyles(styles, { name: "SaveButtonBar" })(
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onClick={onSave}
|
onClick={onSave}
|
||||||
transitionState={state}
|
transitionState={state}
|
||||||
|
data-tc="button-bar-confirm"
|
||||||
>
|
>
|
||||||
{maybe(
|
{maybe(
|
||||||
() => labels.save,
|
() => labels.save,
|
||||||
|
|
|
@ -93,7 +93,8 @@ const SingleAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
value,
|
value,
|
||||||
InputProps,
|
InputProps,
|
||||||
fetchChoices,
|
fetchChoices,
|
||||||
onChange
|
onChange,
|
||||||
|
...props
|
||||||
}: SingleAutocompleteSelectFieldProps & WithStyles<typeof styles>) => {
|
}: SingleAutocompleteSelectFieldProps & WithStyles<typeof styles>) => {
|
||||||
const [prevDisplayValue] = useStateFromProps(displayValue);
|
const [prevDisplayValue] = useStateFromProps(displayValue);
|
||||||
const handleChange = item =>
|
const handleChange = item =>
|
||||||
|
@ -136,7 +137,7 @@ const SingleAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.container}>
|
<div className={classes.container} {...props}>
|
||||||
<TextField
|
<TextField
|
||||||
InputProps={{
|
InputProps={{
|
||||||
...InputProps,
|
...InputProps,
|
||||||
|
@ -173,6 +174,7 @@ const SingleAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
{...getItemProps({
|
{...getItemProps({
|
||||||
item: ""
|
item: ""
|
||||||
})}
|
})}
|
||||||
|
data-tc="singleautocomplete-select-option"
|
||||||
>
|
>
|
||||||
<Typography color="textSecondary">
|
<Typography color="textSecondary">
|
||||||
{i18n.t("None")}
|
{i18n.t("None")}
|
||||||
|
@ -195,6 +197,7 @@ const SingleAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
index: choiceIndex,
|
index: choiceIndex,
|
||||||
item: suggestion.value
|
item: suggestion.value
|
||||||
})}
|
})}
|
||||||
|
data-tc="singleautocomplete-select-option"
|
||||||
>
|
>
|
||||||
{suggestion.label}
|
{suggestion.label}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
@ -215,6 +218,7 @@ const SingleAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
{...getItemProps({
|
{...getItemProps({
|
||||||
item: inputValue
|
item: inputValue
|
||||||
})}
|
})}
|
||||||
|
data-tc="singleautocomplete-select-option"
|
||||||
>
|
>
|
||||||
{i18n.t("Add new value: {{ value }}", {
|
{i18n.t("Add new value: {{ value }}", {
|
||||||
context: "add custom option",
|
context: "add custom option",
|
||||||
|
@ -224,7 +228,11 @@ const SingleAutocompleteSelectFieldComponent = withStyles(styles, {
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<MenuItem disabled={true} component="div">
|
<MenuItem
|
||||||
|
disabled={true}
|
||||||
|
component="div"
|
||||||
|
data-tc="singleautocomplete-select-no-options"
|
||||||
|
>
|
||||||
{i18n.t("No results found")}
|
{i18n.t("No results found")}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -88,6 +88,7 @@ export const TablePaginationActions = withStyles(styles, {
|
||||||
})}
|
})}
|
||||||
onClick={onPreviousPage}
|
onClick={onPreviousPage}
|
||||||
disabled={!hasPreviousPage}
|
disabled={!hasPreviousPage}
|
||||||
|
data-tc="button-pagination-back"
|
||||||
{...backIconButtonProps}
|
{...backIconButtonProps}
|
||||||
>
|
>
|
||||||
{theme.direction === "rtl" ? <ArrowRight /> : <ArrowLeft />}
|
{theme.direction === "rtl" ? <ArrowRight /> : <ArrowLeft />}
|
||||||
|
@ -99,6 +100,7 @@ export const TablePaginationActions = withStyles(styles, {
|
||||||
})}
|
})}
|
||||||
onClick={onNextPage}
|
onClick={onNextPage}
|
||||||
disabled={!hasNextPage}
|
disabled={!hasNextPage}
|
||||||
|
data-tc="button-pagination-next"
|
||||||
{...nextIconButtonProps}
|
{...nextIconButtonProps}
|
||||||
>
|
>
|
||||||
{theme.direction === "rtl" ? <ArrowLeft /> : <ArrowRight />}
|
{theme.direction === "rtl" ? <ArrowLeft /> : <ArrowRight />}
|
||||||
|
|
|
@ -71,7 +71,11 @@ export class MessageManager extends React.Component<{}, MessageManagerState> {
|
||||||
ContentProps={{
|
ContentProps={{
|
||||||
"aria-describedby": "message-id"
|
"aria-describedby": "message-id"
|
||||||
}}
|
}}
|
||||||
message={<span id="message-id">{text}</span>}
|
message={
|
||||||
|
<span id="message-id" data-tc="notification">
|
||||||
|
{text}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
action={[
|
action={[
|
||||||
!!onUndo ? (
|
!!onUndo ? (
|
||||||
<Button
|
<Button
|
||||||
|
@ -79,6 +83,7 @@ export class MessageManager extends React.Component<{}, MessageManagerState> {
|
||||||
color="secondary"
|
color="secondary"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={this.handleClose as any}
|
onClick={this.handleClose as any}
|
||||||
|
data-tc="button-undo"
|
||||||
>
|
>
|
||||||
UNDO
|
UNDO
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -147,6 +147,7 @@ const ProductAttributes: React.FC<ProductAttributesProps> = ({
|
||||||
<IconButton
|
<IconButton
|
||||||
className={classes.expansionBarButton}
|
className={classes.expansionBarButton}
|
||||||
onClick={toggleExpansion}
|
onClick={toggleExpansion}
|
||||||
|
data-tc="product-attributes-expand"
|
||||||
>
|
>
|
||||||
<ArrowDropDownIcon
|
<ArrowDropDownIcon
|
||||||
className={classNames(classes.expansionBarButtonIcon, {
|
className={classNames(classes.expansionBarButtonIcon, {
|
||||||
|
@ -162,10 +163,13 @@ const ProductAttributes: React.FC<ProductAttributesProps> = ({
|
||||||
<React.Fragment key={attribute.id}>
|
<React.Fragment key={attribute.id}>
|
||||||
{attributeIndex > 0 && <Hr />}
|
{attributeIndex > 0 && <Hr />}
|
||||||
<Grid className={classes.attributeSection} variant="uniform">
|
<Grid className={classes.attributeSection} variant="uniform">
|
||||||
<div className={classes.attributeSectionLabel}>
|
<div
|
||||||
|
className={classes.attributeSectionLabel}
|
||||||
|
data-tc="product-attribute-label"
|
||||||
|
>
|
||||||
<Typography>{attribute.label}</Typography>
|
<Typography>{attribute.label}</Typography>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div data-tc="product-attribute-value">
|
||||||
{attribute.data.inputType ===
|
{attribute.data.inputType ===
|
||||||
AttributeInputTypeEnum.DROPDOWN ? (
|
AttributeInputTypeEnum.DROPDOWN ? (
|
||||||
<SingleAutocompleteSelectField
|
<SingleAutocompleteSelectField
|
||||||
|
|
|
@ -192,6 +192,7 @@ const ProductImages = withStyles(styles, { name: "ProductImages" })(
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
variant="text"
|
variant="text"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
data-tc="button-upload-image"
|
||||||
>
|
>
|
||||||
{i18n.t("Upload image")}
|
{i18n.t("Upload image")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -99,7 +99,12 @@ export const ProductListPage: React.FC<ProductListPageProps> = props => {
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
onSave={handleSave}
|
onSave={handleSave}
|
||||||
/>
|
/>
|
||||||
<Button onClick={onAdd} color="primary" variant="contained">
|
<Button
|
||||||
|
onClick={onAdd}
|
||||||
|
color="primary"
|
||||||
|
variant="contained"
|
||||||
|
data-tc="add-product"
|
||||||
|
>
|
||||||
{i18n.t("Add product")} <AddIcon />
|
{i18n.t("Add product")} <AddIcon />
|
||||||
</Button>
|
</Button>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
|
|
|
@ -101,6 +101,7 @@ const ProductOrganization = withStyles(styles, { name: "ProductOrganization" })(
|
||||||
choices={productTypes}
|
choices={productTypes}
|
||||||
value={data.productType}
|
value={data.productType}
|
||||||
onChange={onProductTypeChange}
|
onChange={onProductTypeChange}
|
||||||
|
data-tc="product-type"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
@ -137,6 +138,7 @@ const ProductOrganization = withStyles(styles, { name: "ProductOrganization" })(
|
||||||
value={data.category}
|
value={data.category}
|
||||||
onChange={onCategoryChange}
|
onChange={onCategoryChange}
|
||||||
fetchChoices={fetchCategories}
|
fetchChoices={fetchCategories}
|
||||||
|
data-tc="category"
|
||||||
/>
|
/>
|
||||||
<FormSpacer />
|
<FormSpacer />
|
||||||
<Hr />
|
<Hr />
|
||||||
|
@ -152,6 +154,7 @@ const ProductOrganization = withStyles(styles, { name: "ProductOrganization" })(
|
||||||
)}
|
)}
|
||||||
onChange={onCollectionChange}
|
onChange={onCollectionChange}
|
||||||
fetchChoices={fetchCollections}
|
fetchChoices={fetchCollections}
|
||||||
|
data-tc="collections"
|
||||||
/>
|
/>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
|
@ -93,6 +93,7 @@ const ProductVariantAttributes: React.FC<ProductVariantAttributesProps> = ({
|
||||||
value={getAttributeValue(attribute.id, attributes)}
|
value={getAttributeValue(attribute.id, attributes)}
|
||||||
choices={getAttributeValueChoices(attribute.id, attributes)}
|
choices={getAttributeValueChoices(attribute.id, attributes)}
|
||||||
allowCustomValues
|
allowCustomValues
|
||||||
|
data-tc="variant-attribute-input"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|
|
@ -94,10 +94,20 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })(
|
||||||
title={i18n.t("Variants")}
|
title={i18n.t("Variants")}
|
||||||
toolbar={
|
toolbar={
|
||||||
<>
|
<>
|
||||||
<Button onClick={onAttributesEdit} variant="text" color="primary">
|
<Button
|
||||||
|
onClick={onAttributesEdit}
|
||||||
|
variant="text"
|
||||||
|
color="primary"
|
||||||
|
data-tc="button-edit-attributes"
|
||||||
|
>
|
||||||
{i18n.t("Edit attributes")}
|
{i18n.t("Edit attributes")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={onVariantAdd} variant="text" color="primary">
|
<Button
|
||||||
|
onClick={onVariantAdd}
|
||||||
|
variant="text"
|
||||||
|
color="primary"
|
||||||
|
data-tc="button-add-variant"
|
||||||
|
>
|
||||||
{i18n.t("Add variant")}
|
{i18n.t("Add variant")}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in a new issue