add data-test-id

This commit is contained in:
Karolina Rakoczy 2021-02-17 13:50:57 +01:00
parent 1a09ccefe0
commit 91460bd8b1
4 changed files with 24 additions and 38 deletions

View file

@ -1,10 +1,9 @@
import faker from "faker";
import { visit } from "graphql";
import Channels from "../apiRequests/Channels";
import Product from "../apiRequests/Product";
import ShopInfo from "../apiRequests/ShopInfo";
import { PRODUCTS_SELECTORS } from "../elements/catalog/product-selectors";
import { VARIANTS_SELECTORS } from "../elements/catalog/variants-selectors";
import VariantsSteps from "../steps/products/VariantsSteps";
import { urlList } from "../url/url-list";
import ChannelsUtils from "../utils/channelsUtils";
@ -84,24 +83,6 @@ describe("creating variants", () => {
);
cy.visit(`${urlList.products}${productId}`);
variantsSteps.createFirstVariant(warehouse.id);
// .get(PRODUCTS_SELECTORS.addVariantsButton)
// .click()
// .get(VARIANTS_SELECTORS.attributeCheckbox)
// .first()
// .click()
// .get(VARIANTS_SELECTORS.nextButton)
// .click()
// .get(VARIANTS_SELECTORS.priceInput)
// .type(10)
// .get(`[name*='${warehouseId}']`)
// .click()
// .get(VARIANTS_SELECTORS.nextButton)
// .click()
// .get(VARIANTS_SELECTORS.skuInput)
// .type(name)
// .get(VARIANTS_SELECTORS.nextButton)
// .click()
// .waitForGraph("ProductVariantBulkCreate")
cy.getProductDetails(product.id, defaultChannel.slug).then(
productDetailsResp => {
expect(productDetailsResp.body[0].data.product.name).to.equal(name);
@ -133,24 +114,6 @@ describe("creating variants", () => {
.then(() => {
cy.visit(`${urlList.products}${productId}`);
variantsSteps.createVariant(secondVariantSku, warehouse.name);
// .get(PRODUCTS_SELECTORS.addVariantsButton)
// .click()
// .get(VARIANTS_SELECTORS.attributeSelector)
// .click()
// .get(VARIANTS_SELECTORS.attributeOption)
// .first()
// .click()
// .get(VARIANTS_SELECTORS.priceInput)
// .type(10)
// .get(VARIANTS_SELECTORS.skuInputInAddVariant)
// .type(secondVariantSku)
// .get(VARIANTS_SELECTORS.addWarehouseButton)
// .click()
// .get(VARIANTS_SELECTORS.warehouseOption)
// .contains(name)
// .click()
// .get(VARIANTS_SELECTORS.saveButton)
// .click()
})
.then(() => cy.getProductDetails(productId, defaultChannel.slug))
.then(productDetailsResp => {
@ -194,5 +157,25 @@ describe("creating variants", () => {
true
);
});
visit(`${urlList.products}${productId}`);
variantsSteps.createFirstVariant(warehouse.id);
cy.getProductDetails(product.id, defaultChannel.slug).then(
productDetailsResp => {
expect(productDetailsResp.body[0].data.product.name).to.equal(name);
expect(
productDetailsResp.body[0].data.product.variants[0].pricing.price
.gross.amount
).to.equal(10);
}
);
cy.getProductDetails(product.id, newChannel.slug).then(
productDetailsResp => {
expect(productDetailsResp.body[0].data.product.name).to.equal(name);
expect(
productDetailsResp.body[0].data.product.variants[0].pricing.price
.gross.amount
).to.equal(10);
}
);
});
});

View file

@ -310,6 +310,7 @@ const ProductStocks: React.FC<ProductStocksProps> = ({
>
<div ref={anchor}>
<IconButton
data-test-id="add-warehouse"
color="primary"
onClick={() => setExpansionState(!isExpanded)}
>

View file

@ -200,6 +200,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = props
)}
{step !== ProductVariantCreatorStep.summary ? (
<Button
data-test-id="next-step"
className={classes.button}
color="primary"
disabled={!canHitNext(step, wizardData)}

View file

@ -307,6 +307,7 @@ const ProductVariantCreatorSummary: React.FC<ProductVariantCreatorSummaryProps>
))}
<div className={classNames(classes.col, classes.colSku)}>
<TextField
name="sku"
className={classes.input}
error={!!variantFormErrors.sku}
helperText={getBulkProductErrorMessage(