Fix failing cypress test (#738)
* Add test selector for autocomplete field * Update snapshot
This commit is contained in:
parent
30c411179f
commit
7cd3409bb3
4 changed files with 13 additions and 1 deletions
|
@ -6,6 +6,7 @@ export const PRODUCTS_SELECTORS = {
|
||||||
productTypeInput: "[data-test='product-type']",
|
productTypeInput: "[data-test='product-type']",
|
||||||
categoryInput: "[data-test='category']",
|
categoryInput: "[data-test='category']",
|
||||||
categoryItem: "[data-test='singleautocomplete-select-option']",
|
categoryItem: "[data-test='singleautocomplete-select-option']",
|
||||||
|
autocompleteDropdown: "[data-test='autocomplete-dropdown']",
|
||||||
firstCategoryItem: "#downshift-0-item-0",
|
firstCategoryItem: "#downshift-0-item-0",
|
||||||
visibleRadioBtn: "[name='isPublished']",
|
visibleRadioBtn: "[name='isPublished']",
|
||||||
saveBtn: "[data-test='button-bar-confirm']",
|
saveBtn: "[data-test='button-bar-confirm']",
|
||||||
|
|
|
@ -20,6 +20,9 @@ describe("Products", () => {
|
||||||
.type("Visible test product")
|
.type("Visible test product")
|
||||||
.get(PRODUCTS_SELECTORS.productTypeInput)
|
.get(PRODUCTS_SELECTORS.productTypeInput)
|
||||||
.click()
|
.click()
|
||||||
|
.get(PRODUCTS_SELECTORS.autocompleteDropdown) // trying to fill autocomplete before dropdown will cause error
|
||||||
|
.get(PRODUCTS_SELECTORS.productTypeInput)
|
||||||
|
.click()
|
||||||
.type("Cushion")
|
.type("Cushion")
|
||||||
.get(PRODUCTS_SELECTORS.categoryItem)
|
.get(PRODUCTS_SELECTORS.categoryItem)
|
||||||
.should("have.length", 1)
|
.should("have.length", 1)
|
||||||
|
|
|
@ -177,7 +177,11 @@ const SingleAutocompleteSelectFieldContent: React.FC<SingleAutocompleteSelectFie
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper className={classes.root}>
|
<Paper className={classes.root}>
|
||||||
<div className={classes.content} ref={anchor}>
|
<div
|
||||||
|
className={classes.content}
|
||||||
|
ref={anchor}
|
||||||
|
data-test="autocomplete-dropdown"
|
||||||
|
>
|
||||||
{choices.length > 0 || displayCustomValue ? (
|
{choices.length > 0 || displayCustomValue ? (
|
||||||
<>
|
<>
|
||||||
{emptyOption && (
|
{emptyOption && (
|
||||||
|
|
|
@ -8230,6 +8230,7 @@ exports[`Storyshots Generics / Select with autocomplete can load more 1`] = `
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="SingleAutocompleteSelectFieldContent-content-id"
|
class="SingleAutocompleteSelectFieldContent-content-id"
|
||||||
|
data-test="autocomplete-dropdown"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
|
@ -8381,6 +8382,7 @@ exports[`Storyshots Generics / Select with autocomplete default 1`] = `
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="SingleAutocompleteSelectFieldContent-content-id"
|
class="SingleAutocompleteSelectFieldContent-content-id"
|
||||||
|
data-test="autocomplete-dropdown"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
|
@ -8838,6 +8840,7 @@ exports[`Storyshots Generics / Select with autocomplete no data 1`] = `
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="SingleAutocompleteSelectFieldContent-content-id"
|
class="SingleAutocompleteSelectFieldContent-content-id"
|
||||||
|
data-test="autocomplete-dropdown"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-disabled="true"
|
aria-disabled="true"
|
||||||
|
@ -8871,6 +8874,7 @@ exports[`Storyshots Generics / Select with autocomplete with add 1`] = `
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="SingleAutocompleteSelectFieldContent-content-id"
|
class="SingleAutocompleteSelectFieldContent-content-id"
|
||||||
|
data-test="autocomplete-dropdown"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
|
|
Loading…
Reference in a new issue