fixed all tests (#1253)
* fixed all tests * fix shipping weight tests * fix create product * delete users created in previous tests * merge
This commit is contained in:
parent
db5ad19827
commit
5e7dc8e2a5
22 changed files with 281 additions and 219 deletions
|
@ -33,6 +33,7 @@ export function createCheckout({
|
|||
field
|
||||
message
|
||||
}
|
||||
|
||||
created
|
||||
checkout{
|
||||
id
|
||||
|
@ -56,6 +57,10 @@ export function addShippingMethod(checkoutId, shippingMethodId) {
|
|||
field
|
||||
}
|
||||
checkout{
|
||||
shippingMethod{
|
||||
id
|
||||
name
|
||||
}
|
||||
totalPrice{
|
||||
gross{
|
||||
amount
|
||||
|
|
|
@ -61,6 +61,7 @@ export function createShippingZone(name, country, channelId) {
|
|||
.sendRequestWithQuery(mutation)
|
||||
.its("body.data.shippingZoneCreate.shippingZone");
|
||||
}
|
||||
|
||||
export function addChannelToShippingZone(shippingZoneId, channelId) {
|
||||
const mutation = `mutation addCh{
|
||||
shippingZoneUpdate(id:"${shippingZoneId}", input:{
|
||||
|
@ -74,6 +75,7 @@ export function addChannelToShippingZone(shippingZoneId, channelId) {
|
|||
}`;
|
||||
return cy.sendRequestWithQuery(mutation);
|
||||
}
|
||||
|
||||
export function addChannelToShippingMethod(
|
||||
shippingRateId,
|
||||
channelId,
|
||||
|
@ -138,8 +140,12 @@ export function getShippingZone(shippingZoneId) {
|
|||
name
|
||||
id
|
||||
}
|
||||
shippingMethods{
|
||||
id
|
||||
name
|
||||
}
|
||||
} `;
|
||||
}
|
||||
}`;
|
||||
return cy
|
||||
.sendRequestWithQuery(query)
|
||||
.then(resp => resp.body.data.shippingZone);
|
||||
|
|
|
@ -14,7 +14,10 @@ export function updateShopWeightUnit(weightUnit) {
|
|||
}
|
||||
}
|
||||
}`;
|
||||
return cy.sendRequestWithQuery(mutation).its("body.data.shopSettingsUpdate");
|
||||
return cy
|
||||
.sendRequestWithQuery(mutation)
|
||||
.wait(1000)
|
||||
.its("body.data.shopSettingsUpdate");
|
||||
}
|
||||
|
||||
export function updateShopAddress(address) {
|
||||
|
|
|
@ -5,6 +5,7 @@ export function getProductDetails(productId, channelId, auth = "token") {
|
|||
auth === "auth",
|
||||
`privateMetadata{key value}`
|
||||
);
|
||||
|
||||
const query = `fragment BasicProductFields on Product {
|
||||
id
|
||||
name
|
||||
|
@ -49,6 +50,10 @@ export function getProductDetails(productId, channelId, auth = "token") {
|
|||
id
|
||||
sku
|
||||
name
|
||||
weight{
|
||||
unit
|
||||
value
|
||||
}
|
||||
pricing {
|
||||
price {
|
||||
...Price
|
||||
|
|
|
@ -6,7 +6,7 @@ import { APP_DETAILS } from "../elements/apps/appDetails";
|
|||
import { APPS_LIST } from "../elements/apps/appsList";
|
||||
import { WEBHOOK_DETAILS } from "../elements/apps/webhookDetails";
|
||||
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
|
||||
import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages";
|
||||
import filterTests from "../support/filterTests";
|
||||
import { appDetailsUrl, urlList } from "../url/urlList";
|
||||
import { deleteAppsStartsWith } from "../utils/appUtils";
|
||||
|
|
|
@ -7,7 +7,7 @@ import { CUSTOMERS_LIST } from "../../elements/customer/customers-list";
|
|||
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
||||
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
|
||||
import { fillUpAddressForm } from "../../steps/shared/addressForm";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
|
||||
import filterTests from "../../support/filterTests";
|
||||
import { urlList } from "../../url/urlList";
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
import { PRODUCT_TYPE_DETAILS } from "../../elements/productTypes/productTypeDetails";
|
||||
import { createProductType } from "../../steps/productTypeSteps";
|
||||
import { assignElements } from "../../steps/shared/assignElements";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
|
||||
import { visitAndWaitForProgressBarToDisappear } from "../../steps/shared/progressBar";
|
||||
import filterTests from "../../support/filterTests";
|
||||
import { productTypeDetailsUrl, urlList } from "../../url/urlList";
|
||||
|
|
|
@ -1,190 +0,0 @@
|
|||
// <reference types="cypress" />
|
||||
import faker from "faker";
|
||||
|
||||
import { createCheckout } from "../../../apiRequests/Checkout";
|
||||
import {
|
||||
createShippingRate as createShippingRateViaApi,
|
||||
createShippingZone
|
||||
} from "../../../apiRequests/ShippingMethod";
|
||||
import { updateShopWeightUnit } from "../../../apiRequests/shopSettings";
|
||||
import { createWarehouse } from "../../../apiRequests/Warehouse";
|
||||
import { ONE_PERMISSION_USERS } from "../../../Data/users";
|
||||
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
|
||||
import { SHIPPING_RATE_DETAILS } from "../../../elements/shipping/shipping-rate-details";
|
||||
import {
|
||||
changeWeightUnit,
|
||||
createShippingRate,
|
||||
rateOptions
|
||||
} from "../../../steps/shippingMethodSteps";
|
||||
import filterTests from "../../../support/filterTests";
|
||||
import {
|
||||
shippingZoneDetailsUrl,
|
||||
urlList,
|
||||
weightRateUrl
|
||||
} from "../../../url/urlList";
|
||||
import { getDefaultChannel } from "../../../utils/channelsUtils";
|
||||
import {
|
||||
createProductInChannel,
|
||||
createTypeAttributeAndCategoryForProduct,
|
||||
deleteProductsStartsWith
|
||||
} from "../../../utils/products/productsUtils";
|
||||
import { deleteShippingStartsWith } from "../../../utils/shippingUtils";
|
||||
import { isShippingAvailableInCheckout } from "../../../utils/storeFront/checkoutUtils";
|
||||
|
||||
filterTests(["all"], () => {
|
||||
describe("Shipping weight limits", () => {
|
||||
const startsWith = "CyWeightRates-";
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
|
||||
const price = 10;
|
||||
|
||||
let defaultChannel;
|
||||
let usAddress;
|
||||
let shippingZone;
|
||||
let warehouse;
|
||||
let variantsList;
|
||||
|
||||
before(() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
deleteShippingStartsWith(startsWith);
|
||||
deleteProductsStartsWith(startsWith);
|
||||
|
||||
updateShopWeightUnit("KG");
|
||||
getDefaultChannel()
|
||||
.then(channel => {
|
||||
defaultChannel = channel;
|
||||
cy.fixture("addresses");
|
||||
})
|
||||
.then(({ usAddress: usAddressResp }) => {
|
||||
usAddress = usAddressResp;
|
||||
createShippingZone(name, "US", defaultChannel.id);
|
||||
})
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
createWarehouse({
|
||||
name,
|
||||
shippingZone: shippingZone.id,
|
||||
address: usAddress
|
||||
});
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
createTypeAttributeAndCategoryForProduct(name);
|
||||
})
|
||||
.then(({ attribute, productType, category }) => {
|
||||
createProductInChannel({
|
||||
name,
|
||||
channelId: defaultChannel.id,
|
||||
warehouseId: warehouse.id,
|
||||
attributeId: attribute.id,
|
||||
categoryId: category.id,
|
||||
productTypeId: productType.id,
|
||||
weight: 10
|
||||
});
|
||||
})
|
||||
.then(({ variantsList: variantsListResp }) => {
|
||||
variantsList = variantsListResp;
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.clearSessionData()
|
||||
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping)
|
||||
.visit(shippingZoneDetailsUrl(shippingZone.id));
|
||||
});
|
||||
|
||||
it("should be possible to buy product in a shipping weight limits", () => {
|
||||
const rateName = `${startsWith}${faker.datatype.number()}`;
|
||||
createShippingRate({
|
||||
rateName,
|
||||
price,
|
||||
rateOption: rateOptions.WEIGHT_OPTION,
|
||||
weightLimits: {
|
||||
max: 11,
|
||||
min: 10
|
||||
}
|
||||
});
|
||||
createCheckout({
|
||||
address: usAddress,
|
||||
channelSlug: defaultChannel.slug,
|
||||
email: "example@example.com",
|
||||
variantsList
|
||||
}).then(({ checkout }) => {
|
||||
expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
it("should not be possible to buy product not in a shipping weight limits", () => {
|
||||
const rateName = `${startsWith}${faker.datatype.number()}`;
|
||||
createShippingRate({
|
||||
rateName,
|
||||
price,
|
||||
rateOption: rateOptions.WEIGHT_OPTION,
|
||||
weightLimits: {
|
||||
max: 101,
|
||||
min: 100
|
||||
}
|
||||
});
|
||||
createCheckout({
|
||||
address: usAddress,
|
||||
channelSlug: defaultChannel.slug,
|
||||
email: "example@example.com",
|
||||
variantsList
|
||||
}).then(({ checkout }) => {
|
||||
expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
// Log in as user with shipping permissions after resolving SALEOR-3407 bug
|
||||
it("should recalculate weight after changing shipping weight unit", () => {
|
||||
const rateName = `${startsWith}${faker.datatype.number()}`;
|
||||
const minWeightInKg = 1;
|
||||
const maxWeightInKg = 10;
|
||||
const minWeightInG = minWeightInKg * 1000;
|
||||
const maxWeightInG = maxWeightInKg * 1000;
|
||||
let shippingMethod;
|
||||
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
|
||||
createShippingRateViaApi({
|
||||
name: rateName,
|
||||
shippingZone: shippingZone.id,
|
||||
type: "WEIGHT",
|
||||
maxWeight: maxWeightInKg,
|
||||
minWeight: minWeightInKg
|
||||
})
|
||||
.then(({ shippingMethod: shippingMethodResp }) => {
|
||||
shippingMethod = shippingMethodResp;
|
||||
cy.visit(urlList.shippingMethods)
|
||||
.get(SHARED_ELEMENTS.progressBar)
|
||||
.should("not.exist");
|
||||
changeWeightUnit("G");
|
||||
|
||||
cy.addAliasToGraphRequest("ShippingZone");
|
||||
cy.visit(weightRateUrl(shippingZone.id, shippingMethod.id))
|
||||
.wait("@ShippingZone")
|
||||
.its("response.body");
|
||||
})
|
||||
.then(responseArray => {
|
||||
const shippingMethods = responseArray.find(
|
||||
element => element.data.shippingZone
|
||||
).data.shippingZone.shippingMethods;
|
||||
const rate = shippingMethods.find(
|
||||
element => element.id === shippingMethod.id
|
||||
);
|
||||
expect(rate.minimumOrderWeight.unit).to.eq("G");
|
||||
cy.get(SHARED_ELEMENTS.progressBar)
|
||||
.should("not.be.visible")
|
||||
.get(SHIPPING_RATE_DETAILS.minWeightInput)
|
||||
.invoke("val");
|
||||
})
|
||||
.then(actualMinWeight => {
|
||||
expect(parseInt(actualMinWeight, 10)).to.eq(minWeightInG);
|
||||
cy.get(SHIPPING_RATE_DETAILS.maxWeightInput).invoke("val");
|
||||
})
|
||||
.then(actualMaxWeight => {
|
||||
expect(parseInt(actualMaxWeight, 10)).to.eq(maxWeightInG);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,134 @@
|
|||
// <reference types="cypress" />
|
||||
import faker from "faker";
|
||||
|
||||
import { createCheckout } from "../../../../apiRequests/Checkout";
|
||||
import { createShippingZone } from "../../../../apiRequests/ShippingMethod";
|
||||
import { createWarehouse } from "../../../../apiRequests/Warehouse";
|
||||
import { ONE_PERMISSION_USERS } from "../../../../Data/users";
|
||||
import {
|
||||
createShippingRate,
|
||||
rateOptions
|
||||
} from "../../../../steps/shippingMethodSteps";
|
||||
import filterTests from "../../../../support/filterTests";
|
||||
import { shippingZoneDetailsUrl } from "../../../../url/urlList";
|
||||
import { getDefaultChannel } from "../../../../utils/channelsUtils";
|
||||
import {
|
||||
createProductInChannel,
|
||||
createTypeAttributeAndCategoryForProduct,
|
||||
deleteProductsStartsWith
|
||||
} from "../../../../utils/products/productsUtils";
|
||||
import { deleteShippingStartsWith } from "../../../../utils/shippingUtils";
|
||||
import { isShippingAvailableInCheckout } from "../../../../utils/storeFront/checkoutUtils";
|
||||
|
||||
filterTests(["all"], () => {
|
||||
describe("Shipping weight limits", () => {
|
||||
const startsWith = "CyWeightRates-";
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
|
||||
const price = 10;
|
||||
|
||||
let defaultChannel;
|
||||
let usAddress;
|
||||
let shippingZone;
|
||||
let warehouse;
|
||||
let variantsList;
|
||||
|
||||
before(() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
deleteShippingStartsWith(startsWith);
|
||||
deleteProductsStartsWith(startsWith);
|
||||
|
||||
getDefaultChannel()
|
||||
.then(channel => {
|
||||
defaultChannel = channel;
|
||||
cy.fixture("addresses");
|
||||
})
|
||||
.then(({ usAddress: usAddressResp }) => {
|
||||
usAddress = usAddressResp;
|
||||
createShippingZone(name, "US", defaultChannel.id);
|
||||
})
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
createWarehouse({
|
||||
name,
|
||||
shippingZone: shippingZone.id,
|
||||
address: usAddress
|
||||
});
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
createTypeAttributeAndCategoryForProduct(name);
|
||||
})
|
||||
.then(({ attribute, productType, category }) => {
|
||||
createProductInChannel({
|
||||
name,
|
||||
channelId: defaultChannel.id,
|
||||
warehouseId: warehouse.id,
|
||||
attributeId: attribute.id,
|
||||
categoryId: category.id,
|
||||
productTypeId: productType.id,
|
||||
weight: 10
|
||||
});
|
||||
})
|
||||
.then(({ variantsList: variantsListResp }) => {
|
||||
variantsList = variantsListResp;
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.clearSessionData()
|
||||
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping)
|
||||
.visit(shippingZoneDetailsUrl(shippingZone.id));
|
||||
});
|
||||
|
||||
it("should be possible to buy product in a shipping weight limits", () => {
|
||||
const rateName = `${startsWith}${faker.datatype.number()}`;
|
||||
|
||||
createShippingRate({
|
||||
rateName,
|
||||
price,
|
||||
rateOption: rateOptions.WEIGHT_OPTION,
|
||||
weightLimits: {
|
||||
max: 11,
|
||||
min: 10
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
createCheckout({
|
||||
address: usAddress,
|
||||
channelSlug: defaultChannel.slug,
|
||||
email: "example@example.com",
|
||||
variantsList
|
||||
});
|
||||
})
|
||||
.then(({ checkout }) => {
|
||||
expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
it("should not be possible to buy product not in a shipping weight limits", () => {
|
||||
const rateName = `${startsWith}${faker.datatype.number()}`;
|
||||
|
||||
createShippingRate({
|
||||
rateName,
|
||||
price,
|
||||
rateOption: rateOptions.WEIGHT_OPTION,
|
||||
weightLimits: {
|
||||
max: 101,
|
||||
min: 100
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
createCheckout({
|
||||
address: usAddress,
|
||||
channelSlug: defaultChannel.slug,
|
||||
email: "example@example.com",
|
||||
variantsList
|
||||
});
|
||||
})
|
||||
.then(({ checkout }) => {
|
||||
expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.false;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,99 @@
|
|||
// <reference types="cypress" />
|
||||
import faker from "faker";
|
||||
|
||||
import {
|
||||
createShippingRate as createShippingRateViaApi,
|
||||
createShippingZone
|
||||
} from "../../../../apiRequests/ShippingMethod";
|
||||
import { updateShopWeightUnit } from "../../../../apiRequests/shopSettings";
|
||||
import { SHARED_ELEMENTS } from "../../../../elements/shared/sharedElements";
|
||||
import { SHIPPING_RATE_DETAILS } from "../../../../elements/shipping/shipping-rate-details";
|
||||
import { waitForProgressBarToNotBeVisible } from "../../../../steps/shared/progressBar";
|
||||
import { changeWeightUnit } from "../../../../steps/shippingMethodSteps";
|
||||
import filterTests from "../../../../support/filterTests";
|
||||
import { urlList, weightRateUrl } from "../../../../url/urlList";
|
||||
import { getDefaultChannel } from "../../../../utils/channelsUtils";
|
||||
import { deleteProductsStartsWith } from "../../../../utils/products/productsUtils";
|
||||
import { deleteShippingStartsWith } from "../../../../utils/shippingUtils";
|
||||
|
||||
filterTests(["all"], () => {
|
||||
describe("Recalculate weights", () => {
|
||||
const startsWith = "RecalculateWeight";
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
|
||||
let defaultChannel;
|
||||
let usAddress;
|
||||
let shippingZone;
|
||||
|
||||
before(() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
deleteShippingStartsWith(startsWith);
|
||||
deleteProductsStartsWith(startsWith);
|
||||
|
||||
updateShopWeightUnit("KG")
|
||||
.then(() => {
|
||||
getDefaultChannel().then(channel => {
|
||||
defaultChannel = channel;
|
||||
cy.fixture("addresses");
|
||||
});
|
||||
})
|
||||
.then(({ usAddress: usAddressResp }) => {
|
||||
usAddress = usAddressResp;
|
||||
createShippingZone(name, "US", defaultChannel.id);
|
||||
})
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
});
|
||||
});
|
||||
|
||||
// Log in as user with shipping permissions after resolving SALEOR-3407 bug
|
||||
it("should recalculate weight after changing shipping weight unit", () => {
|
||||
const rateName = `${startsWith}${faker.datatype.number()}`;
|
||||
const minWeightInKg = 1;
|
||||
const maxWeightInKg = 10;
|
||||
const minWeightInG = minWeightInKg * 1000;
|
||||
const maxWeightInG = maxWeightInKg * 1000;
|
||||
let shippingMethod;
|
||||
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
|
||||
createShippingRateViaApi({
|
||||
name: rateName,
|
||||
shippingZone: shippingZone.id,
|
||||
type: "WEIGHT",
|
||||
maxWeight: maxWeightInKg,
|
||||
minWeight: minWeightInKg
|
||||
})
|
||||
.then(({ shippingMethod: shippingMethodResp }) => {
|
||||
shippingMethod = shippingMethodResp;
|
||||
cy.visit(urlList.shippingMethods)
|
||||
.get(SHARED_ELEMENTS.progressBar)
|
||||
.should("not.exist");
|
||||
changeWeightUnit("G");
|
||||
|
||||
cy.addAliasToGraphRequest("ShippingZone");
|
||||
cy.visit(weightRateUrl(shippingZone.id, shippingMethod.id))
|
||||
.wait("@ShippingZone")
|
||||
.its("response.body");
|
||||
})
|
||||
.then(responseArray => {
|
||||
const shippingMethods = responseArray.find(
|
||||
element => element.data.shippingZone
|
||||
).data.shippingZone.shippingMethods;
|
||||
const rate = shippingMethods.find(
|
||||
element => element.id === shippingMethod.id
|
||||
);
|
||||
waitForProgressBarToNotBeVisible();
|
||||
expect(rate.minimumOrderWeight.unit).to.eq("G");
|
||||
cy.get(SHIPPING_RATE_DETAILS.minWeightInput).invoke("val");
|
||||
})
|
||||
.then(actualMinWeight => {
|
||||
expect(parseInt(actualMinWeight, 10)).to.eq(minWeightInG);
|
||||
cy.get(SHIPPING_RATE_DETAILS.maxWeightInput).invoke("val");
|
||||
})
|
||||
.then(actualMaxWeight => {
|
||||
expect(parseInt(actualMaxWeight, 10)).to.eq(maxWeightInG);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -4,7 +4,7 @@ import { getShopInfo, updateShopAddress } from "../../apiRequests/shopSettings";
|
|||
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
||||
import { SITE_SETTINGS_DETAILS } from "../../elements/siteSettings/site-settings-details";
|
||||
import { fillUpBasicAddress } from "../../steps/shared/addressForm";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
|
||||
import filterTests from "../../support/filterTests";
|
||||
import { urlList } from "../../url/urlList";
|
||||
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
import faker from "faker";
|
||||
|
||||
import { confirmAccount, customerRegistration } from "../apiRequests/Customer";
|
||||
import {
|
||||
confirmAccount,
|
||||
customerRegistration,
|
||||
deleteCustomersStartsWith
|
||||
} from "../apiRequests/Customer";
|
||||
import { CUSTOMER_DETAILS } from "../elements/customers/customer-details";
|
||||
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
|
||||
import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages";
|
||||
import filterTests from "../support/filterTests";
|
||||
import { customerDetailsUrl } from "../url/urlList";
|
||||
import { getDefaultChannel } from "../utils/channelsUtils";
|
||||
|
@ -17,6 +21,7 @@ describe("Tests for customer registration", () => {
|
|||
|
||||
before(() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
deleteCustomersStartsWith(startsWith);
|
||||
getDefaultChannel().then(channel => {
|
||||
defaultChannel = channel;
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ import { PAGE_TYPES_LIST } from "../../elements/pageTypes/pageTypesList";
|
|||
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
||||
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
|
||||
import { assignElements } from "../../steps/shared/assignElements";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
|
||||
import filterTests from "../../support/filterTests";
|
||||
import { pageTypeDetailsUrl, urlList } from "../../url/urlList";
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
} from "../../steps/catalog/products/priceList";
|
||||
import { fillUpCommonFieldsForAllProductTypes } from "../../steps/catalog/products/productSteps";
|
||||
import { selectChannelInDetailsPages } from "../../steps/channelsSteps";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
|
||||
import filterTests from "../../support/filterTests";
|
||||
import { urlList } from "../../url/urlList";
|
||||
import {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
|||
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
|
||||
import { metadataForms } from "../../steps/catalog/metadataSteps";
|
||||
import { fillUpCommonFieldsForAllProductTypes } from "../../steps/catalog/products/productSteps";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "../../steps/shared/confirmationMessages";
|
||||
import filterTests from "../../support/filterTests";
|
||||
import { productDetailsUrl } from "../../url/urlList";
|
||||
import { getDefaultChannel } from "../../utils/channelsUtils";
|
||||
|
|
|
@ -3,8 +3,7 @@ import { AVAILABLE_CHANNELS_FORM } from "../elements/channels/available-channels
|
|||
import { SELECT_CHANNELS_TO_ASSIGN } from "../elements/channels/select-channels-to-assign";
|
||||
import { ASSIGN_ELEMENTS_SELECTORS } from "../elements/shared/assign-elements-selectors";
|
||||
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
|
||||
import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
|
||||
import { confirmationMessageShouldDisappear } from "./shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
|
||||
|
||||
export function createCollection(collectionName, isPublished, channel) {
|
||||
const publishedSelector = isPublished
|
||||
|
|
|
@ -3,7 +3,7 @@ import { ASSIGN_ELEMENTS_SELECTORS } from "../../elements/shared/assign-elements
|
|||
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
||||
import { formatDate } from "../../support/format/formatDate";
|
||||
import { selectChannelInDetailsPages } from "../channelsSteps";
|
||||
import { confirmationMessageShouldDisappear } from "../shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "../shared/confirmationMessages";
|
||||
import { waitForProgressBarToNotBeVisible } from "../shared/progressBar";
|
||||
|
||||
export const discountOptions = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { VOUCHERS_SELECTORS } from "../../elements/discounts/vouchers";
|
||||
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
||||
import { selectChannelInDetailsPages } from "../channelsSteps";
|
||||
import { confirmationMessageShouldDisappear } from "../shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "../shared/confirmationMessages";
|
||||
|
||||
export const discountOptions = {
|
||||
PERCENTAGE: VOUCHERS_SELECTORS.percentageDiscountRadioButton,
|
||||
|
|
|
@ -3,7 +3,7 @@ import { MENU_LIST } from "../elements/navigation/menu-list";
|
|||
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
|
||||
import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
|
||||
import { menuDetailsUrl, urlList } from "../url/urlList";
|
||||
import { confirmationMessageShouldDisappear } from "./shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
|
||||
|
||||
export function createMenu(name) {
|
||||
cy.visit(urlList.navigation)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
|
||||
|
||||
export function confirmationMessageShouldDisappear() {
|
||||
cy.get(SHARED_ELEMENTS.notificationSuccess)
|
||||
.should("be.visible")
|
||||
.get(SHARED_ELEMENTS.notificationSuccess)
|
||||
.should("not.exist");
|
||||
}
|
|
@ -3,7 +3,7 @@ import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
|
|||
import { SHIPPING_RATE_DETAILS } from "../elements/shipping/shipping-rate-details";
|
||||
import { SHIPPING_ZONE_DETAILS } from "../elements/shipping/shipping-zone-details";
|
||||
import { SHIPPING_ZONES_LIST } from "../elements/shipping/shipping-zones-list";
|
||||
import { confirmationMessageShouldDisappear } from "./shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
|
||||
import { waitForProgressBarToNotBeVisible } from "./shared/progressBar";
|
||||
import { fillBaseSelect } from "./shared/selects";
|
||||
|
||||
|
@ -58,7 +58,7 @@ export function changeWeightUnit(weightUnit) {
|
|||
cy.addAliasToGraphRequest("UpdateDefaultWeightUnit");
|
||||
cy.get(SHIPPING_ZONES_LIST.saveUnit).click();
|
||||
confirmationMessageShouldDisappear();
|
||||
cy.wait("@UpdateDefaultWeightUnit");
|
||||
cy.wait("@UpdateDefaultWeightUnit").wait(1000);
|
||||
}
|
||||
|
||||
export function createShippingRate({
|
||||
|
@ -75,7 +75,7 @@ export function createShippingRate({
|
|||
weightLimits,
|
||||
deliveryTime
|
||||
});
|
||||
saveRate();
|
||||
return saveRate();
|
||||
}
|
||||
|
||||
export function enterAndFillUpShippingRate({
|
||||
|
@ -121,7 +121,7 @@ export function createRateWithPostalCode({
|
|||
.type(maxPostalCode)
|
||||
.get(BUTTON_SELECTORS.submit)
|
||||
.click();
|
||||
saveRate();
|
||||
return saveRate();
|
||||
}
|
||||
|
||||
export function saveRate() {
|
||||
|
@ -130,7 +130,10 @@ export function saveRate() {
|
|||
.get(BUTTON_SELECTORS.confirm)
|
||||
.click();
|
||||
confirmationMessageShouldDisappear();
|
||||
cy.wait(`@ShippingMethodChannelListingUpdate`).wait(`@ShippingZone`);
|
||||
return cy
|
||||
.wait(`@ShippingMethodChannelListingUpdate`)
|
||||
.wait(`@ShippingZone`)
|
||||
.its("response.body.0.data.shippingZone");
|
||||
}
|
||||
|
||||
export function fillUpWeightLimits({ max, min }) {
|
||||
|
|
|
@ -28,6 +28,7 @@ export function getMailActivationLinkForUser(email, i = 0) {
|
|||
}
|
||||
return cy.mhGetMailsByRecipient(email).should(mails => {
|
||||
if (!mails.length) {
|
||||
cy.wait(10000);
|
||||
getMailActivationLinkForUser(email, i + 1);
|
||||
} else {
|
||||
cy.wrap(mails)
|
||||
|
|
Loading…
Reference in a new issue