fix test for publishing products (#2215)

This commit is contained in:
Karolina Rakoczy 2022-08-08 12:40:42 +02:00 committed by GitHub
parent eaf3271dc9
commit 5ce4a87515
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View file

@ -50,7 +50,7 @@ describe("Published products", () => {
it( it(
"should update product to published", "should update product to published",
{ tags: ["@products", "@allEnv"] }, { tags: ["@products", "@allEnv", "@stable"] },
() => { () => {
const productName = `${startsWith}${faker.datatype.number()}`; const productName = `${startsWith}${faker.datatype.number()}`;
@ -79,7 +79,7 @@ describe("Published products", () => {
it( it(
"should update product to not published", "should update product to not published",
{ tags: ["@products", "@allEnv"] }, { tags: ["@products", "@allEnv", "@stable"] },
() => { () => {
const productName = `${startsWith}${faker.datatype.number()}`; const productName = `${startsWith}${faker.datatype.number()}`;
let product; let product;

View file

@ -9,7 +9,7 @@ const valueFalse = AVAILABLE_CHANNELS_FORM.radioButtonsValueFalse;
export function updateProductIsAvailableForPurchase( export function updateProductIsAvailableForPurchase(
productUrl, productUrl,
isAvailableForPurchase isAvailableForPurchase,
) { ) {
const isAvailableForPurchaseSelector = isAvailableForPurchase const isAvailableForPurchaseSelector = isAvailableForPurchase
? valueTrue ? valueTrue
@ -27,7 +27,7 @@ export function updateProductPublish(productUrl, isPublished) {
export function updateProductVisibleInListings(productUrl) { export function updateProductVisibleInListings(productUrl) {
updateProductMenageInChannel( updateProductMenageInChannel(
productUrl, productUrl,
AVAILABLE_CHANNELS_FORM.visibleInListingsButton AVAILABLE_CHANNELS_FORM.visibleInListingsButton,
); );
} }
@ -36,16 +36,17 @@ function updateProductMenageInChannel(productUrl, menageSelector) {
.get(AVAILABLE_CHANNELS_FORM.assignedChannels) .get(AVAILABLE_CHANNELS_FORM.assignedChannels)
.click() .click()
.get(menageSelector) .get(menageSelector)
.click(); .click()
cy.addAliasToGraphRequest("ProductChannelListingUpdate"); .waitForProgressBarToNotBeVisible()
cy.get(BUTTON_SELECTORS.confirm) .addAliasToGraphRequest("ProductChannelListingUpdate")
.get(BUTTON_SELECTORS.confirm)
.click() .click()
.wait("@ProductChannelListingUpdate"); .wait("@ProductChannelListingUpdate");
} }
export function fillUpCommonFieldsForAllProductTypes( export function fillUpCommonFieldsForAllProductTypes(
{ generalInfo, seo, metadata, productOrganization }, { generalInfo, seo, metadata, productOrganization },
createMode = true createMode = true,
) { ) {
return fillUpAllCommonFieldsInCreateAndUpdate({ generalInfo, seo, metadata }) return fillUpAllCommonFieldsInCreateAndUpdate({ generalInfo, seo, metadata })
.then(() => { .then(() => {
@ -54,7 +55,7 @@ export function fillUpCommonFieldsForAllProductTypes(
} else { } else {
fillUpCollectionAndCategory({ fillUpCollectionAndCategory({
category: productOrganization.category, category: productOrganization.category,
collection: productOrganization.collection collection: productOrganization.collection,
}); });
} }
}) })
@ -64,7 +65,7 @@ export function fillUpCommonFieldsForAllProductTypes(
export function fillUpAllCommonFieldsInCreateAndUpdate({ export function fillUpAllCommonFieldsInCreateAndUpdate({
generalInfo, generalInfo,
seo, seo,
metadata metadata,
}) { }) {
return fillUpProductGeneralInfo(generalInfo) return fillUpProductGeneralInfo(generalInfo)
.then(() => { .then(() => {
@ -92,7 +93,7 @@ export function fillUpProductGeneralInfo({ name, description, rating }) {
export function fillUpProductOrganization({ export function fillUpProductOrganization({
productType, productType,
category, category,
collection collection,
}) { }) {
const organization = {}; const organization = {};
return cy return cy