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,
attribute: attributeValues[0]
});
enterHomePageChangeChannelAndReturn(defaultChannel.name);
selectChannelInHeader(defaultChannel.name);
variantsShouldBeVisible({ name, price });
getProductVariants(createdProduct.id, defaultChannel.slug);
})

View file

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

View file

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