fixing tests: 2505 2506 - should update product to be visible or not in listings (#3648)
* fix tests should update product to be visible in listings, should update product to not be visible in listings * lock conflict fixes * update tests: products published or not to new implementation
This commit is contained in:
parent
50c8e93534
commit
192be719fe
4 changed files with 20 additions and 16 deletions
|
@ -73,7 +73,8 @@ describe("Published products", () => {
|
|||
.then(({ product: productResp }) => {
|
||||
const product = productResp;
|
||||
const productUrl = productDetailsUrl(product.id);
|
||||
updateProductPublish(productUrl, true);
|
||||
cy.visit(productUrl);
|
||||
updateProductPublish(true);
|
||||
getProductDetails(product.id, defaultChannel.slug);
|
||||
})
|
||||
.then(resp => {
|
||||
|
@ -101,7 +102,8 @@ describe("Published products", () => {
|
|||
.then(({ product: productResp }) => {
|
||||
product = productResp;
|
||||
const productUrl = productDetailsUrl(product.id);
|
||||
updateProductPublish(productUrl, false);
|
||||
cy.visit(productUrl);
|
||||
updateProductPublish(false);
|
||||
getProductDetails(product.id, defaultChannel.slug);
|
||||
})
|
||||
.then(resp => {
|
||||
|
|
|
@ -72,7 +72,8 @@ describe("Products displayed in listings", () => {
|
|||
.then(({ product: productResp }) => {
|
||||
const product = productResp;
|
||||
const productUrl = productDetailsUrl(product.id);
|
||||
updateProductVisibleInListings(productUrl);
|
||||
cy.visit(productUrl);
|
||||
updateProductVisibleInListings();
|
||||
searchInShop(productName);
|
||||
})
|
||||
.then(resp => {
|
||||
|
@ -103,7 +104,8 @@ describe("Products displayed in listings", () => {
|
|||
.then(({ product: productResp }) => {
|
||||
const product = productResp;
|
||||
const productUrl = productDetailsUrl(product.id);
|
||||
updateProductVisibleInListings(productUrl);
|
||||
cy.visit(productUrl);
|
||||
updateProductVisibleInListings();
|
||||
|
||||
searchInShop(productName).then(resp => {
|
||||
const isProductVisible = isProductVisibleInSearchResult(
|
||||
|
|
|
@ -5,6 +5,6 @@ export const AVAILABLE_CHANNELS_FORM = {
|
|||
availableForPurchaseRadioButtons: "[name*='isAvailableForPurchase']",
|
||||
radioButtonsValueTrue: "[value='true']",
|
||||
radioButtonsValueFalse: "[value='false']",
|
||||
visibleInListingsButton: "[name*='visibleInListings']",
|
||||
visibleInListingsButton: "[id*='visibleInListings']",
|
||||
availableChannel: "[data-test-id*='channel-availability-item']",
|
||||
};
|
||||
|
|
|
@ -16,33 +16,33 @@ export function updateProductIsAvailableForPurchase(
|
|||
? valueTrue
|
||||
: valueFalse;
|
||||
const availableForPurchaseSelector = `${AVAILABLE_CHANNELS_FORM.availableForPurchaseRadioButtons}${isAvailableForPurchaseSelector}`;
|
||||
updateProductManageInChannel(productUrl, availableForPurchaseSelector);
|
||||
updateProductManageInChannel(availableForPurchaseSelector);
|
||||
}
|
||||
|
||||
export function updateProductPublish(productUrl, isPublished) {
|
||||
export function updateProductPublish(isPublished) {
|
||||
const isPublishedSelector = isPublished ? valueTrue : valueFalse;
|
||||
const publishedSelector = `${AVAILABLE_CHANNELS_FORM.publishedRadioButtons}${isPublishedSelector}`;
|
||||
updateProductManageInChannel(productUrl, publishedSelector);
|
||||
updateProductManageInChannel(publishedSelector);
|
||||
}
|
||||
|
||||
export function updateProductVisibleInListings(productUrl) {
|
||||
updateProductManageInChannel(
|
||||
productUrl,
|
||||
AVAILABLE_CHANNELS_FORM.visibleInListingsButton,
|
||||
);
|
||||
export function updateProductVisibleInListings() {
|
||||
updateProductManageInChannel(AVAILABLE_CHANNELS_FORM.visibleInListingsButton);
|
||||
}
|
||||
|
||||
function updateProductManageInChannel(productUrl, manageSelector) {
|
||||
cy.visit(productUrl)
|
||||
.get(AVAILABLE_CHANNELS_FORM.assignedChannels)
|
||||
function updateProductManageInChannel(manageSelector) {
|
||||
cy.get(AVAILABLE_CHANNELS_FORM.assignedChannels)
|
||||
.click()
|
||||
.get(manageSelector)
|
||||
.first()
|
||||
.scrollIntoView()
|
||||
.click()
|
||||
// cypress click is to fast - our app is nor ready to handle new event when click occurs - solution could be disabling save button until app is ready to handle new event
|
||||
.wait(1000)
|
||||
.waitForProgressBarToNotBeVisible()
|
||||
.addAliasToGraphRequest("ProductChannelListingUpdate")
|
||||
.get(BUTTON_SELECTORS.confirm)
|
||||
.click()
|
||||
.confirmationMessageShouldAppear()
|
||||
.wait("@ProductChannelListingUpdate");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue