diff --git a/cypress.config.js b/cypress.config.js index 17fc73980..f7088bbd7 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -11,8 +11,8 @@ module.exports = defineConfig({ viewportWidth: 1400, viewportHeight: 660, retries: { - runMode: 2, - openMode: 1, + runMode: 1, + openMode: 0, }, e2e: { env: { diff --git a/cypress/e2e/catalog/giftCards/activateGiftCards.js b/cypress/e2e/catalog/giftCards/activateGiftCards.js index c8babd9b7..95cf2de68 100644 --- a/cypress/e2e/catalog/giftCards/activateGiftCards.js +++ b/cypress/e2e/catalog/giftCards/activateGiftCards.js @@ -20,6 +20,7 @@ import { } from "../../../support/api/utils/ordersUtils"; import * as productsUtils from "../../../support/api/utils/products/productsUtils"; import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils"; +import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils"; import { changeGiftCardActiveStatus, enterAndSelectGiftCards, @@ -69,6 +70,10 @@ describe("As a admin I want to use enabled gift card in checkout", () => { beforeEach(() => { cy.clearSessionData().loginUserViaRequest(); + updateTaxConfigurationForChannel({ + channelSlug: defaultChannel.slug, + pricesEnteredWithTax: true, + }); }); it( diff --git a/cypress/e2e/configuration/attributes/attributeVariantSelection.js b/cypress/e2e/configuration/attributes/attributeVariantSelection.js index 2fd95fe55..b83d05088 100644 --- a/cypress/e2e/configuration/attributes/attributeVariantSelection.js +++ b/cypress/e2e/configuration/attributes/attributeVariantSelection.js @@ -32,8 +32,8 @@ describe("As an admin I want to use attributes in variant selection", () => { getDefaultChannel().then(defaultChannel => (channel = defaultChannel)); createCategory({ name: startsWith }).then( categoryResp => (category = categoryResp), - cy.checkIfDataAreNotNull({ channel, category }), ); + cy.checkIfDataAreNotNull({ channel, category }); }); beforeEach(() => { diff --git a/cypress/e2e/customerRegistration.js b/cypress/e2e/customerRegistration.js index 049b36827..5893cfc61 100644 --- a/cypress/e2e/customerRegistration.js +++ b/cypress/e2e/customerRegistration.js @@ -29,7 +29,7 @@ describe("Tests for customer registration", () => { }); }); - it("should register customer", { tags: ["@customer", "@stagedOnly"] }, () => { + it("should register customer", { tags: ["@customer", "@allEnv"] }, () => { const email = `${startsWith}${faker.datatype.number()}@example.com`; customerRegistration({ email, channel: defaultChannel.slug }); const registrationLinkRegex = /\[(\s*http[^\]]*)\]/; diff --git a/cypress/e2e/discounts/sales/createSalesForProducts.js b/cypress/e2e/discounts/sales/createSalesForProducts.js index f52cd081b..1336b1d03 100644 --- a/cypress/e2e/discounts/sales/createSalesForProducts.js +++ b/cypress/e2e/discounts/sales/createSalesForProducts.js @@ -14,6 +14,10 @@ import { deleteShippingStartsWith, } from "../../../support/api/utils/shippingUtils"; import { getProductPrice } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; +import { + getDefaultTaxClass, + updateTaxConfigurationForChannel, +} from "../../../support/api/utils/taxesUtils"; import { assignProducts, createSale, @@ -31,6 +35,7 @@ describe("As an admin I want to create sale for products", () => { let category; let defaultChannel; let warehouse; + let taxClass; before(() => { const name = `${startsWith}${faker.datatype.number()}`; @@ -57,6 +62,10 @@ describe("As an admin I want to create sale for products", () => { ) .then(channel => { defaultChannel = channel; + getDefaultTaxClass(); + }) + .then(taxResp => { + taxClass = taxResp; cy.fixture("addresses"); }) .then(addresses => { @@ -65,6 +74,7 @@ describe("As an admin I want to create sale for products", () => { name, address: addresses.plAddress, price: 100, + taxClassId: taxClass.id, }); }) .then(({ warehouse: warehouseResp }) => { @@ -81,6 +91,10 @@ describe("As an admin I want to create sale for products", () => { beforeEach(() => { cy.clearSessionData().loginUserViaRequest(); + updateTaxConfigurationForChannel({ + channelSlug: defaultChannel.slug, + pricesEnteredWithTax: true, + }); }); it( @@ -100,6 +114,7 @@ describe("As an admin I want to create sale for products", () => { price: productPrice, discountOption: discountOptions.PERCENTAGE, discountValue, + taxClassId: taxClass.id, }).should("eq", expectedPrice); }, ); @@ -146,6 +161,7 @@ describe("As an admin I want to create sale for products", () => { attributeId: attribute.id, categoryId: category.id, price: productPrice, + taxClassId: taxClass.id, }) .then(({ product: productResp }) => { product = productResp; diff --git a/cypress/e2e/discounts/sales/createSalesForVariants.js b/cypress/e2e/discounts/sales/createSalesForVariants.js index 9c76dd9e1..a2adbb70e 100644 --- a/cypress/e2e/discounts/sales/createSalesForVariants.js +++ b/cypress/e2e/discounts/sales/createSalesForVariants.js @@ -16,6 +16,10 @@ import { createShipping, deleteShippingStartsWith, } from "../../../support/api/utils/shippingUtils"; +import { + getDefaultTaxClass, + updateTaxConfigurationForChannel, +} from "../../../support/api/utils/taxesUtils"; import { deleteWarehouseStartsWith } from "../../../support/api/utils/warehouseUtils"; import { createSaleWithNewVariant, @@ -31,6 +35,7 @@ describe("Sales discounts for variant", () => { let warehouse; let productData; let address; + let taxClass; before(() => { const name = `${startsWith}${faker.datatype.number()}`; @@ -40,9 +45,15 @@ describe("Sales discounts for variant", () => { deleteShippingStartsWith(startsWith); deleteSalesStartsWith(startsWith); deleteWarehouseStartsWith(startsWith); - channelsUtils.getDefaultChannel().then(channel => { - defaultChannel = channel; - }); + channelsUtils + .getDefaultChannel() + .then(channel => { + defaultChannel = channel; + getDefaultTaxClass(); + }) + .then(taxResp => { + taxClass = taxResp; + }); cy.fixture("addresses") .then(addresses => { address = addresses.usAddress; @@ -51,6 +62,7 @@ describe("Sales discounts for variant", () => { channelId: defaultChannel.id, address, name, + taxClassId: taxClass.id, }); }) .then(({ warehouse: warehouseResp }) => { @@ -70,6 +82,7 @@ describe("Sales discounts for variant", () => { channelId: defaultChannel.id, warehouseId: warehouse.id, price: productPrice, + taxClassId: taxClass.id, }; cy.checkIfDataAreNotNull({ productData, @@ -82,6 +95,10 @@ describe("Sales discounts for variant", () => { beforeEach(() => { cy.clearSessionData().loginUserViaRequest(); + updateTaxConfigurationForChannel({ + channelSlug: defaultChannel.slug, + pricesEnteredWithTax: true, + }); }); it( @@ -158,6 +175,7 @@ describe("Sales discounts for variant", () => { price: productPrice, discountOption: discountOptions.PERCENTAGE, discountValue, + taxClassId: taxClass.id, }) .its("pricing.price.gross.amount") .should("eq", expectedPrice); diff --git a/cypress/e2e/discounts/sales/updateSales.js b/cypress/e2e/discounts/sales/updateSales.js index c1d4eb508..6a93c6b5e 100644 --- a/cypress/e2e/discounts/sales/updateSales.js +++ b/cypress/e2e/discounts/sales/updateSales.js @@ -24,6 +24,10 @@ import { createShipping, deleteShippingStartsWith, } from "../../../support/api/utils/shippingUtils"; +import { + getDefaultTaxClass, + updateTaxConfigurationForChannel, +} from "../../../support/api/utils/taxesUtils"; describe("As an admin I want to update sales", () => { const startsWith = "CySales"; @@ -37,6 +41,7 @@ describe("As an admin I want to update sales", () => { let address; let productData; let variants; + let taxClass; before(() => { const name = `${startsWith}${faker.datatype.number()}`; @@ -48,7 +53,10 @@ describe("As an admin I want to update sales", () => { getDefaultChannel() .then(channel => { defaultChannel = channel; - + getDefaultTaxClass(); + }) + .then(taxResp => { + taxClass = taxResp; createSaleInChannel({ name, type: "FIXED", @@ -65,6 +73,7 @@ describe("As an admin I want to update sales", () => { channelId: defaultChannel.id, address, name: startsWith, + taxClassId: taxClass.id, }); }) .then(({ warehouse: warehouseResp }) => { @@ -81,6 +90,7 @@ describe("As an admin I want to update sales", () => { channelId: defaultChannel.id, warehouseId: warehouse.id, price: productPrice, + taxClassId: taxClass.id, }; cy.checkIfDataAreNotNull({ productData, @@ -95,6 +105,10 @@ describe("As an admin I want to update sales", () => { beforeEach(() => { cy.clearSessionData().loginUserViaRequest(); + updateTaxConfigurationForChannel({ + channelSlug: defaultChannel.slug, + pricesEnteredWithTax: true, + }); }); it( diff --git a/cypress/e2e/discounts/vouchers/createVouchers.js b/cypress/e2e/discounts/vouchers/createVouchers.js index 41b616495..5e1c5de22 100644 --- a/cypress/e2e/discounts/vouchers/createVouchers.js +++ b/cypress/e2e/discounts/vouchers/createVouchers.js @@ -13,6 +13,7 @@ import { createCheckoutWithVoucher, } from "../../../support/api/utils/ordersUtils"; import * as productsUtils from "../../../support/api/utils/products/productsUtils"; +import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils"; import { createVoucher, discountOptions, @@ -53,14 +54,21 @@ describe("As an admin I want to create voucher", () => { auth: "token", }; }, - cy.checkIfDataAreNotNull({ - createdChannel, - dataForCheckout, - defaultChannel, - }), ); + cy.checkIfDataAreNotNull({ + createdChannel, + dataForCheckout, + defaultChannel, + }); }); + beforeEach(() => { + cy.clearSessionData().loginUserViaRequest(); + updateTaxConfigurationForChannel({ + channelSlug: defaultChannel.slug, + pricesEnteredWithTax: true, + }); + }); it( "should be able to create fixed price voucher. TC: SALEOR_1901", { tags: ["@vouchers", "@allEnv", "@stable"] }, diff --git a/cypress/e2e/discounts/vouchers/updateVouchers.js b/cypress/e2e/discounts/vouchers/updateVouchers.js index e97712240..c3ede2a93 100644 --- a/cypress/e2e/discounts/vouchers/updateVouchers.js +++ b/cypress/e2e/discounts/vouchers/updateVouchers.js @@ -12,6 +12,7 @@ import { } from "../../../support/api/utils/discounts/vouchersUtils"; import { createCheckoutWithVoucher } from "../../../support/api/utils/ordersUtils"; import * as productsUtils from "../../../support/api/utils/products/productsUtils"; +import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils"; import { formatDate, formatTime } from "../../../support/formatData/formatDate"; import { setVoucherDate } from "../../../support/pages/discounts/vouchersPage"; @@ -51,10 +52,17 @@ describe("As an admin I want to update vouchers", () => { auth: "token", }; }, - cy.checkIfDataAreNotNull({ dataForCheckout, defaultChannel, product }), ); + cy.checkIfDataAreNotNull({ dataForCheckout, defaultChannel, product }); }); + beforeEach(() => { + cy.clearSessionData().loginUserViaRequest(); + updateTaxConfigurationForChannel({ + channelSlug: defaultChannel.slug, + pricesEnteredWithTax: true, + }); + }); it( "should delete voucher. TC: SALEOR_1905", { tags: ["@vouchers", "@allEnv", "@stable"] }, diff --git a/cypress/e2e/products/productsVariants.js b/cypress/e2e/products/productsVariants.js index 625b225e0..8aad6d9cc 100644 --- a/cypress/e2e/products/productsVariants.js +++ b/cypress/e2e/products/productsVariants.js @@ -13,6 +13,7 @@ import { } from "../../support/api/requests/Product"; import * as productUtils from "../../support/api/utils/products/productsUtils"; import { getProductVariants } from "../../support/api/utils/storeFront/storeFrontProductUtils"; +import { updateTaxConfigurationForChannel } from "../../support/api/utils/taxesUtils"; import { addVariantToDataGrid, enterVariantEditPage, @@ -21,6 +22,7 @@ import { createVariant, selectChannelsForVariant, } from "../../support/pages/catalog/products/VariantsPage"; + describe("As an admin I should be able to create variant", () => { const startsWith = "CyCreateVariants-"; const attributeValues = ["value1", "value2"]; @@ -37,6 +39,7 @@ describe("As an admin I should be able to create variant", () => { cy.clearSessionData().loginUserViaRequest(); + updateTaxConfigurationForChannel({ pricesEnteredWithTax: true }); productUtils .createShippingProductTypeAttributeAndCategory(name, attributeValues) .then(resp => { @@ -50,15 +53,19 @@ describe("As an admin I should be able to create variant", () => { }) .then(resp => { newChannel = resp; - cy.checkIfDataAreNotNull({ - defaultChannel, - warehouse, - attribute, - productType, - category, - newChannel, + updateTaxConfigurationForChannel({ + channelSlug: newChannel.slug, + pricesEnteredWithTax: true, }); }); + cy.checkIfDataAreNotNull({ + defaultChannel, + warehouse, + attribute, + productType, + category, + newChannel, + }); }); beforeEach(() => { diff --git a/cypress/e2e/products/productsWithoutSku/createProductWithoutSku.js b/cypress/e2e/products/productsWithoutSku/createProductWithoutSku.js index 3065998ae..d57f81623 100644 --- a/cypress/e2e/products/productsWithoutSku/createProductWithoutSku.js +++ b/cypress/e2e/products/productsWithoutSku/createProductWithoutSku.js @@ -15,6 +15,7 @@ import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersU import * as productUtils from "../../../support/api/utils/products/productsUtils"; import * as shippingUtils from "../../../support/api/utils/shippingUtils"; import { getProductVariants } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; +import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils"; import { deleteWarehouseStartsWith } from "../../../support/api/utils/warehouseUtils"; import { fillUpPriceList, @@ -64,6 +65,11 @@ describe("Creating variants", () => { defaultChannel = resp.defaultChannel; warehouse = resp.warehouse; shippingMethod = resp.shippingMethod; + + updateTaxConfigurationForChannel({ + channelSlug: defaultChannel.slug, + pricesEnteredWithTax: true, + }); }); productUtils @@ -195,15 +201,15 @@ describe("Creating variants", () => { }); }); enterVariantEditPage(); - cy.addAliasToGraphRequest("ProductVariantDetails"); + cy.addAliasToGraphRequest("VariantUpdate"); selectChannelsForVariant(); cy.get(BUTTON_SELECTORS.confirm) .click() .confirmationMessageShouldDisappear() - .wait("@ProductVariantDetails") + .wait("@VariantUpdate") .then(({ response }) => { const variants = [ - response.body.data.productVariant.product.variants[0], + response.body.data.productVariantUpdate.productVariant, ]; createWaitingForCaptureOrder({ channelSlug: defaultChannel.slug, diff --git a/cypress/elements/catalog/products/variants-selectors.js b/cypress/elements/catalog/products/variants-selectors.js index 44860f874..7ba54149a 100644 --- a/cypress/elements/catalog/products/variants-selectors.js +++ b/cypress/elements/catalog/products/variants-selectors.js @@ -1,6 +1,6 @@ export const VARIANTS_SELECTORS = { variantNameInput: '[data-test-id="variant-name"]', - skuTextField: '[data-test-id="sku"]', + skuTextField: '[data-test-id="sku"] input', attributeOption: "[data-test-type='option'], [data-test-id='multi-autocomplete-select-option']", attributeSelector: "[data-test-id='attribute-value']", diff --git a/cypress/support/api/requests/Taxes.js b/cypress/support/api/requests/Taxes.js index 3fbbd5a43..d2ebb0ec7 100644 --- a/cypress/support/api/requests/Taxes.js +++ b/cypress/support/api/requests/Taxes.js @@ -22,12 +22,13 @@ export function updateTaxes({ id, chargeTaxes = true, taxCalculationStrategy = "FLAT_RATES", + pricesEnteredWithTax = "false", }) { const mutation = `mutation{ taxConfigurationUpdate(id:"${id}", input:{ chargeTaxes:${chargeTaxes} displayGrossPrices:true - pricesEnteredWithTax:false + pricesEnteredWithTax:${pricesEnteredWithTax} removeCountriesConfiguration: [] taxCalculationStrategy:${taxCalculationStrategy} updateCountriesConfiguration: [] diff --git a/cypress/support/api/utils/taxesUtils.js b/cypress/support/api/utils/taxesUtils.js index 9ba0bf740..2f991ae8c 100644 --- a/cypress/support/api/utils/taxesUtils.js +++ b/cypress/support/api/utils/taxesUtils.js @@ -5,9 +5,10 @@ import { } from "../requests/Taxes"; export function updateTaxConfigurationForChannel({ - channelSlug, + channelSlug = "default-channel", chargeTaxes = true, taxCalculationStrategy = "FLAT_RATES", + pricesEnteredWithTax = "false", }) { getTaxConfigurationList().then(taxConfigurationList => { const taxConfigurationForChannel = taxConfigurationList.find( @@ -17,6 +18,7 @@ export function updateTaxConfigurationForChannel({ id: taxConfigurationForChannel.node.id, chargeTaxes, taxCalculationStrategy, + pricesEnteredWithTax, }); }); } diff --git a/cypress/support/pages/catalog/products/VariantsPage.js b/cypress/support/pages/catalog/products/VariantsPage.js index 3672a2205..87f8d1bab 100644 --- a/cypress/support/pages/catalog/products/VariantsPage.js +++ b/cypress/support/pages/catalog/products/VariantsPage.js @@ -32,12 +32,9 @@ export function createVariant({ price, variantName, }); - cy.addAliasToGraphRequest("WarehouseList") - .get(VARIANTS_SELECTORS.saveButton) + cy.get(VARIANTS_SELECTORS.saveButton) .click() - .wait("@WarehouseList") .get(VARIANTS_SELECTORS.skuTextField) - .find("input") .and("be.enabled") .get(BUTTON_SELECTORS.back) .click() @@ -58,9 +55,7 @@ export function fillUpGeneralVariantInputs({ force: true, }); } else { - cy.get(VARIANTS_SELECTORS.warehouseOption) - .first() - .click({ force: true }); + cy.get(VARIANTS_SELECTORS.warehouseOption).first().click({ force: true }); } cy.get(VARIANTS_SELECTORS.stockInput).type(quantity); } diff --git a/cypress/support/pages/discounts/salesPage.js b/cypress/support/pages/discounts/salesPage.js index 4d09d9f64..b1b66ef51 100644 --- a/cypress/support/pages/discounts/salesPage.js +++ b/cypress/support/pages/discounts/salesPage.js @@ -84,6 +84,7 @@ export function createSaleWithNewProduct({ price, discountOption, discountValue, + taxClassId, }) { return createProductInChannel({ name, @@ -93,6 +94,7 @@ export function createSaleWithNewProduct({ attributeId, categoryId, price, + taxClassId, }).then(({ product: productResp }) => { const product = productResp; /* Uncomment after fixing SALEOR-3367 bug