create simple product without sku (#2188)

* create simple product without sku

* remove comments

* restore channel cleanup line

* cr fixes
This commit is contained in:
Anna Szczęch 2022-08-19 08:46:12 +02:00 committed by GitHub
parent cea3ead44b
commit 0ad0becf9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -193,10 +193,11 @@ describe("Creating variants", () => {
); );
it( it(
"should create simple product without sku", "should create simple product without sku SALEOR_2806",
{ tags: ["@products", "@allEnv"] }, { tags: ["@products", "@allEnv"] },
() => { () => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.visit(urlList.products) cy.visit(urlList.products)
.get(PRODUCTS_LIST.createProductBtn) .get(PRODUCTS_LIST.createProductBtn)
.click() .click()
@ -208,15 +209,21 @@ describe("Creating variants", () => {
) )
.fillAutocompleteSelect(PRODUCT_DETAILS.categoryInput); .fillAutocompleteSelect(PRODUCT_DETAILS.categoryInput);
selectChannelInDetailsPages(defaultChannel.name); selectChannelInDetailsPages(defaultChannel.name);
cy.get(PRODUCT_DETAILS.addWarehouseButton).click(); cy.get(PRODUCT_DETAILS.costPriceInput)
.type(10)
.get(PRODUCT_DETAILS.sellingPriceInput)
.type(10)
.addAliasToGraphRequest("VariantCreate")
.get(BUTTON_SELECTORS.confirm)
.click()
.confirmationMessageShouldDisappear()
.wait("@VariantCreate")
.get(PRODUCT_DETAILS.addWarehouseButton)
.click();
cy.contains(PRODUCT_DETAILS.warehouseOption, warehouse.name) cy.contains(PRODUCT_DETAILS.warehouseOption, warehouse.name)
.click() .click()
.get(PRODUCT_DETAILS.stockInput) .get(PRODUCT_DETAILS.stockInput)
.clearAndType(10) .clearAndType(10)
.get(PRODUCT_DETAILS.costPriceInput)
.type(10)
.get(PRODUCT_DETAILS.sellingPriceInput)
.type(10)
.get(AVAILABLE_CHANNELS_FORM.assignedChannels) .get(AVAILABLE_CHANNELS_FORM.assignedChannels)
.click() .click()
.get( .get(
@ -227,22 +234,22 @@ describe("Creating variants", () => {
`${AVAILABLE_CHANNELS_FORM.publishedRadioButtons}${AVAILABLE_CHANNELS_FORM.radioButtonsValueTrue}`, `${AVAILABLE_CHANNELS_FORM.publishedRadioButtons}${AVAILABLE_CHANNELS_FORM.radioButtonsValueTrue}`,
) )
.click() .click()
.addAliasToGraphRequest("VariantCreate") .addAliasToGraphRequest("ProductDetails")
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click() .click()
.confirmationMessageShouldDisappear() .confirmationMessageShouldDisappear()
.wait("@VariantCreate") .wait("@ProductDetails")
.then(({ response }) => { .then(({ response }) => {
const variants = [ const variants = [response.body.data.product.variants[0]];
response.body.data.productVariantCreate.productVariant,
];
createWaitingForCaptureOrder({ createWaitingForCaptureOrder({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
email: "example@example.com", email: "example@example.com",
variantsList: variants, variantsList: variants,
shippingMethodName: shippingMethod.name, shippingMethodName: shippingMethod.name,
address, address,
}); })
.its("order.id")
.should("be.ok");
}); });
}, },
); );