Update tests for creating variants (#1718)
* merge * add data-test-id to sku input * remove data-test-id from sku input * update stories * remove duplicated attribute
This commit is contained in:
parent
6e09ec9bb2
commit
a01a2b5a30
7 changed files with 23 additions and 30 deletions
|
@ -3,7 +3,7 @@ export const VARIANTS_SELECTORS = {
|
||||||
valueContainer: "[data-test-id='value-container']",
|
valueContainer: "[data-test-id='value-container']",
|
||||||
nextButton: "[class*='MuiButton-containedPrimary']",
|
nextButton: "[class*='MuiButton-containedPrimary']",
|
||||||
warehouseCheckboxes: "[name*='warehouse:']",
|
warehouseCheckboxes: "[name*='warehouse:']",
|
||||||
skuInput: "[ data-test-id='sku-input']",
|
skuInput: "[ name='sku']",
|
||||||
attributeSelector: "[data-test='attribute-value']",
|
attributeSelector: "[data-test='attribute-value']",
|
||||||
attributeOption:
|
attributeOption:
|
||||||
"[data-test-type='option'], [data-test='multiautocomplete-select-option']",
|
"[data-test-type='option'], [data-test='multiautocomplete-select-option']",
|
||||||
|
|
|
@ -104,7 +104,6 @@ filterTests({ definedTags: ["all", "critical"] }, () => {
|
||||||
cy.visit(`${urlList.products}${createdProduct.id}`);
|
cy.visit(`${urlList.products}${createdProduct.id}`);
|
||||||
createFirstVariant({
|
createFirstVariant({
|
||||||
sku: name,
|
sku: name,
|
||||||
warehouseId: warehouse.id,
|
|
||||||
price,
|
price,
|
||||||
attribute: attributeValues[0]
|
attribute: attributeValues[0]
|
||||||
});
|
});
|
||||||
|
@ -139,7 +138,6 @@ filterTests({ definedTags: ["all", "critical"] }, () => {
|
||||||
cy.visit(`${urlList.products}${createdProduct.id}`);
|
cy.visit(`${urlList.products}${createdProduct.id}`);
|
||||||
createVariant({
|
createVariant({
|
||||||
sku: secondVariantSku,
|
sku: secondVariantSku,
|
||||||
warehouseName: warehouse.name,
|
|
||||||
attributeName: variants[1].name,
|
attributeName: variants[1].name,
|
||||||
price: variants[1].price,
|
price: variants[1].price,
|
||||||
channelName: defaultChannel.name
|
channelName: defaultChannel.name
|
||||||
|
@ -187,7 +185,6 @@ filterTests({ definedTags: ["all", "critical"] }, () => {
|
||||||
cy.visit(`${urlList.products}${createdProduct.id}`);
|
cy.visit(`${urlList.products}${createdProduct.id}`);
|
||||||
createFirstVariant({
|
createFirstVariant({
|
||||||
sku: name,
|
sku: name,
|
||||||
warehouseId: warehouse.id,
|
|
||||||
price: variantsPrice,
|
price: variantsPrice,
|
||||||
attribute: attributeValues[0]
|
attribute: attributeValues[0]
|
||||||
});
|
});
|
||||||
|
|
|
@ -121,6 +121,7 @@ filterTests({ definedTags: ["all", "critical"], version: "3.1.0" }, () => {
|
||||||
channelId: defaultChannel.id
|
channelId: defaultChannel.id
|
||||||
});
|
});
|
||||||
cy.visit(`${urlList.products}${createdProduct.id}`);
|
cy.visit(`${urlList.products}${createdProduct.id}`);
|
||||||
|
cy.waitForProgressBarToNotBeVisible();
|
||||||
createFirstVariant({
|
createFirstVariant({
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
price,
|
price,
|
||||||
|
@ -135,7 +136,7 @@ filterTests({ definedTags: ["all", "critical"], version: "3.1.0" }, () => {
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList: [variant],
|
variantsList: [variant],
|
||||||
shippingMethodId: shippingMethod.id,
|
shippingMethodName: shippingMethod.name,
|
||||||
address
|
address
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -180,7 +181,7 @@ filterTests({ definedTags: ["all", "critical"], version: "3.1.0" }, () => {
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList: [secondVariant],
|
variantsList: [secondVariant],
|
||||||
shippingMethodId: shippingMethod.id,
|
shippingMethodName: shippingMethod.name,
|
||||||
address
|
address
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -234,7 +235,7 @@ filterTests({ definedTags: ["all", "critical"], version: "3.1.0" }, () => {
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList: variants,
|
variantsList: variants,
|
||||||
shippingMethodId: shippingMethod.id,
|
shippingMethodName: shippingMethod.name,
|
||||||
address
|
address
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -208,7 +208,6 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
|
||||||
.get(SHARED_ELEMENTS.skeleton)
|
.get(SHARED_ELEMENTS.skeleton)
|
||||||
.should("not.exist")
|
.should("not.exist")
|
||||||
.get(VARIANTS_SELECTORS.skuInput)
|
.get(VARIANTS_SELECTORS.skuInput)
|
||||||
.find("input")
|
|
||||||
.clear()
|
.clear()
|
||||||
.addAliasToGraphRequest("VariantUpdate")
|
.addAliasToGraphRequest("VariantUpdate")
|
||||||
.get(BUTTON_SELECTORS.confirm)
|
.get(BUTTON_SELECTORS.confirm)
|
||||||
|
@ -267,7 +266,7 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
|
||||||
address,
|
address,
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email,
|
email,
|
||||||
shippingMethodId: shippingMethod.id,
|
shippingMethodName: shippingMethod.name,
|
||||||
variantsList: [variant]
|
variantsList: [variant]
|
||||||
}).then(({ order }) => {
|
}).then(({ order }) => {
|
||||||
expect(order.id).to.be.ok;
|
expect(order.id).to.be.ok;
|
||||||
|
|
|
@ -30,9 +30,14 @@ export function createFirstVariant({
|
||||||
.get(VARIANTS_SELECTORS.nextButton)
|
.get(VARIANTS_SELECTORS.nextButton)
|
||||||
.click();
|
.click();
|
||||||
fillUpPriceList(price);
|
fillUpPriceList(price);
|
||||||
cy.get(`[name*='${warehouseId}']`)
|
if (warehouseId) {
|
||||||
.click()
|
cy.get(`[name*='${warehouseId}']`).click();
|
||||||
.get(VARIANTS_SELECTORS.stockInput)
|
} else {
|
||||||
|
cy.get(VARIANTS_SELECTORS.warehouseCheckboxes)
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
}
|
||||||
|
cy.get(VARIANTS_SELECTORS.stockInput)
|
||||||
.type(quantity)
|
.type(quantity)
|
||||||
.get(VARIANTS_SELECTORS.nextButton)
|
.get(VARIANTS_SELECTORS.nextButton)
|
||||||
.click();
|
.click();
|
||||||
|
@ -80,9 +85,15 @@ export function fillUpGeneralVariantInputs({
|
||||||
}) {
|
}) {
|
||||||
fillUpVariantAttributeAndSku({ attributeName, sku });
|
fillUpVariantAttributeAndSku({ attributeName, sku });
|
||||||
cy.get(VARIANTS_SELECTORS.addWarehouseButton).click();
|
cy.get(VARIANTS_SELECTORS.addWarehouseButton).click();
|
||||||
cy.contains(VARIANTS_SELECTORS.warehouseOption, warehouseName).click({
|
if (warehouseName) {
|
||||||
force: true
|
cy.contains(VARIANTS_SELECTORS.warehouseOption, warehouseName).click({
|
||||||
});
|
force: true
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
cy.get(VARIANTS_SELECTORS.warehouseOption)
|
||||||
|
.first()
|
||||||
|
.click({ force: true });
|
||||||
|
}
|
||||||
cy.get(VARIANTS_SELECTORS.stockInput).type(quantity);
|
cy.get(VARIANTS_SELECTORS.stockInput).type(quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,6 @@ const ProductStocks: React.FC<ProductStocksProps> = ({
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className={classes.skuInputContainer}>
|
<div className={classes.skuInputContainer}>
|
||||||
<TextField
|
<TextField
|
||||||
data-test-id="sku-input"
|
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
error={!!formErrors.sku}
|
error={!!formErrors.sku}
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|
|
@ -183700,7 +183700,6 @@ exports[`Storyshots Views / Products / Create product variant add first variant
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id"
|
||||||
|
@ -184759,7 +184758,6 @@ exports[`Storyshots Views / Products / Create product variant default 1`] = `
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id"
|
||||||
|
@ -185818,7 +185816,6 @@ exports[`Storyshots Views / Products / Create product variant no warehouses 1`]
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id"
|
||||||
|
@ -186616,7 +186613,6 @@ exports[`Storyshots Views / Products / Create product variant when loading data
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id"
|
||||||
|
@ -187685,7 +187681,6 @@ exports[`Storyshots Views / Products / Create product variant with errors 1`] =
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-error-id MuiInputLabel-error-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-error-id MuiInputLabel-error-id"
|
||||||
|
@ -195386,7 +195381,6 @@ exports[`Storyshots Views / Products / Product edit no stock and no variants 1`]
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
||||||
|
@ -196967,7 +196961,6 @@ exports[`Storyshots Views / Products / Product edit no stock, no variants and no
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
||||||
|
@ -198548,7 +198541,6 @@ exports[`Storyshots Views / Products / Product edit no variants 1`] = `
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
||||||
|
@ -201505,7 +201497,6 @@ exports[`Storyshots Views / Products / Product edit when loading data 1`] = `
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id"
|
||||||
|
@ -204522,7 +204513,6 @@ exports[`Storyshots Views / Products / Product edit when product has no variants
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
||||||
|
@ -222332,7 +222322,6 @@ exports[`Storyshots Views / Products / Product variant details attribute errors
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-error-id MuiInputLabel-error-id MuiFormLabel-filled-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-error-id MuiInputLabel-error-id MuiFormLabel-filled-id"
|
||||||
|
@ -224281,7 +224270,6 @@ exports[`Storyshots Views / Products / Product variant details no warehouses 1`]
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
||||||
|
@ -226225,7 +226213,6 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
|
||||||
|
@ -227397,7 +227384,6 @@ exports[`Storyshots Views / Products / Product variant details when loading data
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
|
||||||
data-test-id="sku-input"
|
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id"
|
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id"
|
||||||
|
|
Loading…
Reference in a new issue