Fix failed night schedule tests (#3015)
* fix e2e tests * update test tag * update tax config in tests failing on v310 * updatet taxes for product variant tests * move updateRaxConfiguration to beforeEach * fix imports * change retries in config * update data-test-id and remove failing wait for request
This commit is contained in:
parent
7593e6378a
commit
644b58a914
16 changed files with 116 additions and 34 deletions
|
@ -11,8 +11,8 @@ module.exports = defineConfig({
|
|||
viewportWidth: 1400,
|
||||
viewportHeight: 660,
|
||||
retries: {
|
||||
runMode: 2,
|
||||
openMode: 1,
|
||||
runMode: 1,
|
||||
openMode: 0,
|
||||
},
|
||||
e2e: {
|
||||
env: {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -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[^\]]*)\]/;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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"] },
|
||||
|
|
|
@ -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"] },
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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']",
|
||||
|
|
|
@ -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: []
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue