test fix available for purchase (#3661)

This commit is contained in:
wojteknowacki 2023-05-18 09:01:34 +02:00 committed by GitHub
parent 36c14bd9a0
commit 352ac9566b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -91,7 +91,8 @@ describe("Products available in listings", () => {
.then(({ product: productResp }) => { .then(({ product: productResp }) => {
product = productResp; product = productResp;
const productUrl = productDetailsUrl(product.id); const productUrl = productDetailsUrl(product.id);
updateProductIsAvailableForPurchase(productUrl, true); cy.visit(productUrl);
updateProductIsAvailableForPurchase(true);
}) })
.then(() => { .then(() => {
getProductDetails(product.id, defaultChannel.slug); getProductDetails(product.id, defaultChannel.slug);
@ -121,7 +122,8 @@ describe("Products available in listings", () => {
.then(({ product: productResp }) => { .then(({ product: productResp }) => {
product = productResp; product = productResp;
const productUrl = productDetailsUrl(product.id); const productUrl = productDetailsUrl(product.id);
updateProductIsAvailableForPurchase(productUrl, false); cy.visit(productUrl);
updateProductIsAvailableForPurchase(false);
}) })
.then(() => { .then(() => {
getProductDetails(product.id, defaultChannel.slug); getProductDetails(product.id, defaultChannel.slug);

View file

@ -2,7 +2,7 @@ export const AVAILABLE_CHANNELS_FORM = {
manageChannelsButton: "[data-test-id='channels-availability-manage-button']", manageChannelsButton: "[data-test-id='channels-availability-manage-button']",
assignedChannels: "[data-test-id='expand-icon']", assignedChannels: "[data-test-id='expand-icon']",
publishedRadioButtons: "[name*='isPublished'] > ", publishedRadioButtons: "[name*='isPublished'] > ",
availableForPurchaseRadioButtons: "[name*='isAvailableForPurchase']", availableForPurchaseRadioButtons: "[id*='isAvailableForPurchase']",
radioButtonsValueTrue: "[value='true']", radioButtonsValueTrue: "[value='true']",
radioButtonsValueFalse: "[value='false']", radioButtonsValueFalse: "[value='false']",
visibleInListingsButton: "[id*='visibleInListings']", visibleInListingsButton: "[id*='visibleInListings']",

View file

@ -8,10 +8,7 @@ import { editSeoSettings } from "../seoComponent";
const valueTrue = AVAILABLE_CHANNELS_FORM.radioButtonsValueTrue; const valueTrue = AVAILABLE_CHANNELS_FORM.radioButtonsValueTrue;
const valueFalse = AVAILABLE_CHANNELS_FORM.radioButtonsValueFalse; const valueFalse = AVAILABLE_CHANNELS_FORM.radioButtonsValueFalse;
export function updateProductIsAvailableForPurchase( export function updateProductIsAvailableForPurchase(isAvailableForPurchase) {
productUrl,
isAvailableForPurchase,
) {
const isAvailableForPurchaseSelector = isAvailableForPurchase const isAvailableForPurchaseSelector = isAvailableForPurchase
? valueTrue ? valueTrue
: valueFalse; : valueFalse;
@ -43,6 +40,7 @@ function updateProductManageInChannel(manageSelector) {
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click() .click()
.confirmationMessageShouldAppear() .confirmationMessageShouldAppear()
.confirmationMessageShouldDisappear()
.wait("@ProductChannelListingUpdate"); .wait("@ProductChannelListingUpdate");
} }