Fix flaky test for creating variant (#2032)

* fix flaky test for creating variant

* fix flaky
This commit is contained in:
Karolina Rakoczy 2022-05-13 14:08:29 +02:00 committed by GitHub
parent 9c2ed377cc
commit 97eeccc917
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -88,7 +88,7 @@ filterTests({ definedTags: ["all", "critical", "refactored"] }, () => {
price, price,
attribute: attributeValues[0] attribute: attributeValues[0]
}); });
enterHomePageChangeChannelAndReturn(defaultChannel.name); selectChannelInHeader(defaultChannel.name);
variantsShouldBeVisible({ name, price }); variantsShouldBeVisible({ name, price });
getProductVariants(createdProduct.id, defaultChannel.slug); getProductVariants(createdProduct.id, defaultChannel.slug);
}) })

View file

@ -46,6 +46,7 @@ export function createFirstVariant({
cy.addAliasToGraphRequest("ProductVariantBulkCreate") cy.addAliasToGraphRequest("ProductVariantBulkCreate")
.get(VARIANTS_SELECTORS.nextButton) .get(VARIANTS_SELECTORS.nextButton)
.click() .click()
.confirmationMessageShouldAppear()
.waitForRequestAndCheckIfNoErrors("@ProductVariantBulkCreate") .waitForRequestAndCheckIfNoErrors("@ProductVariantBulkCreate")
.waitForProgressBarToNotBeVisible() .waitForProgressBarToNotBeVisible()
.get(AVAILABLE_CHANNELS_FORM.menageChannelsButton) .get(AVAILABLE_CHANNELS_FORM.menageChannelsButton)
@ -68,7 +69,9 @@ export function createVariant({
.get(VARIANTS_SELECTORS.skuInput) .get(VARIANTS_SELECTORS.skuInput)
.should("be.enabled") .should("be.enabled")
.get(BUTTON_SELECTORS.back) .get(BUTTON_SELECTORS.back)
.click(); .click()
.get(PRODUCT_DETAILS.productNameInput)
.should("be.enabled");
selectChannelForVariantAndFillUpPrices({ selectChannelForVariantAndFillUpPrices({
channelName, channelName,
variantName: attributeName, variantName: attributeName,

View file

@ -64,8 +64,9 @@ export function selectChannelInPicker(channelName) {
export function selectChannelInHeader(channelName) { export function selectChannelInHeader(channelName) {
cy.get(HEADER_SELECTORS.channelSelect).click(); cy.get(HEADER_SELECTORS.channelSelect).click();
cy.contains(SHARED_ELEMENTS.selectOption, channelName) cy.contains(SHARED_ELEMENTS.selectOption, channelName)
.scrollIntoView() .click({ force: true })
.click(); .get(SHARED_ELEMENTS.selectOption)
.should("not.exist");
} }
export function selectChannelInDetailsPages(channelName) { export function selectChannelInDetailsPages(channelName) {