test - fix vouchers tests (#3832)

This commit is contained in:
wojteknowacki 2023-06-30 14:02:37 +02:00 committed by GitHub
parent 3123f04c69
commit 5eb6888c42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,9 @@
import { VOUCHERS_SELECTORS } from "../../../elements/discounts/vouchers"; import { VOUCHERS_SELECTORS } from "../../../elements/discounts/vouchers";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { urlList, voucherDetailsUrl } from "../../../fixtures/urlList"; import {
urlList,
voucherDetailsUrl,
} from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { createCheckoutWithVoucher } from "../../api/utils/ordersUtils"; import { createCheckoutWithVoucher } from "../../api/utils/ordersUtils";
import { selectChannelInDetailsPages } from "../channelsPage"; import { selectChannelInDetailsPages } from "../channelsPage";
@ -29,7 +32,9 @@ export function createVoucher({
.get(discountOption) .get(discountOption)
.click(); .click();
if (discountOption !== discountOptions.SHIPPING) { if (discountOption !== discountOptions.SHIPPING) {
cy.get(VOUCHERS_SELECTORS.discountValueInputs).type(voucherValue); cy.get(VOUCHERS_SELECTORS.discountValueInputs).type(voucherValue, {
force: true,
});
} }
if (usageLimit) { if (usageLimit) {
cy.get(VOUCHERS_SELECTORS.limits.usageLimitCheckbox) cy.get(VOUCHERS_SELECTORS.limits.usageLimitCheckbox)
@ -54,9 +59,7 @@ export function createVoucher({
.get(VOUCHERS_SELECTORS.requirements.minCheckoutItemsQuantityInput) .get(VOUCHERS_SELECTORS.requirements.minCheckoutItemsQuantityInput)
.type(minAmountOfItems); .type(minAmountOfItems);
} }
cy.get(BUTTON_SELECTORS.confirm) cy.get(BUTTON_SELECTORS.confirm).click().confirmationMessageShouldAppear();
.click()
.confirmationMessageShouldAppear();
} }
export function setVoucherDate({ export function setVoucherDate({