fix failing tests (#1302)
* fix failing tests * no retries * add waiting for confirmation msg * remove unused import * fix test for staff * fix test for staff * fix tests for orders * fix tests for channels * fix autocomplete * fix filters * fix filters * fix create shipping method
This commit is contained in:
parent
457d50c251
commit
e7a06281f1
26 changed files with 142 additions and 58 deletions
|
@ -2,7 +2,8 @@ export function createAttribute({
|
|||
name,
|
||||
attributeValues = ["value"],
|
||||
type = "PRODUCT_TYPE",
|
||||
inputType = "DROPDOWN"
|
||||
inputType = "DROPDOWN",
|
||||
filterableInDashboard = false
|
||||
}) {
|
||||
const values = attributeValues.map(element => `{name:"${element}"}`);
|
||||
const mutation = `mutation{
|
||||
|
@ -12,6 +13,7 @@ export function createAttribute({
|
|||
type:${type}
|
||||
values: [${values}]
|
||||
inputType: ${inputType}
|
||||
filterableInDashboard: ${filterableInDashboard}
|
||||
}){
|
||||
attribute{
|
||||
id
|
||||
|
@ -84,11 +86,15 @@ export function getAttribute(attributeId) {
|
|||
return cy.sendRequestWithQuery(query).its("body.data.attribute");
|
||||
}
|
||||
|
||||
export function updateAttribute({ filterableInDashboard }) {
|
||||
export function updateAttribute({ attributeId, filterableInDashboard }) {
|
||||
const mutation = `mutation{
|
||||
attributeUpdate(id:"" input:{
|
||||
filterableInDashboard:false
|
||||
attributeUpdate(id:"${attributeId}" input:{
|
||||
filterableInDashboard: ${filterableInDashboard}
|
||||
}){
|
||||
attribute{
|
||||
id
|
||||
filterableInDashboard
|
||||
}
|
||||
errors{
|
||||
field
|
||||
message
|
||||
|
|
|
@ -2,7 +2,8 @@ export function createChannel({
|
|||
isActive = true,
|
||||
name,
|
||||
slug = name,
|
||||
currencyCode = "PLN"
|
||||
currencyCode = "PLN",
|
||||
defaultCountry = "PL"
|
||||
}) {
|
||||
const createChannelMutation = `mutation{
|
||||
channelCreate(input: {
|
||||
|
@ -10,13 +11,14 @@ export function createChannel({
|
|||
name: "${name}"
|
||||
slug: "${slug}"
|
||||
currencyCode: "${currencyCode}"
|
||||
defaultCountry: ${defaultCountry}
|
||||
}){
|
||||
channel{
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
channelErrors{
|
||||
errors{
|
||||
code
|
||||
message
|
||||
}
|
||||
|
@ -26,6 +28,7 @@ export function createChannel({
|
|||
.sendRequestWithQuery(createChannelMutation)
|
||||
.its("body.data.channelCreate.channel");
|
||||
}
|
||||
|
||||
export function getChannels() {
|
||||
const getChannelsInfoQuery = `query{
|
||||
channels{
|
||||
|
|
|
@ -11,6 +11,20 @@ export function markOrderAsPaid(orderId) {
|
|||
return cy.sendRequestWithQuery(mutation);
|
||||
}
|
||||
|
||||
export function updateOrdersSettings(automaticallyConfirmAllNewOrders = true) {
|
||||
const mutation = `mutation{
|
||||
orderSettingsUpdate(input:{
|
||||
automaticallyConfirmAllNewOrders: ${automaticallyConfirmAllNewOrders}
|
||||
}){
|
||||
errors{
|
||||
field
|
||||
message
|
||||
}
|
||||
}
|
||||
}`;
|
||||
return cy.sendRequestWithQuery(mutation);
|
||||
}
|
||||
|
||||
export function addProductToOrder(orderId, variantId, quantity = 1) {
|
||||
const mutation = `mutation{
|
||||
orderLinesCreate(id:"${orderId}", input:{
|
||||
|
|
|
@ -10,5 +10,6 @@ export const ADD_CHANNEL_FORM_SELECTORS = {
|
|||
currencyAutocompleteDropdown:
|
||||
"[data-test='singleautocomplete-select-option'][data-test-type='custom']",
|
||||
addShippingZoneButton: '[data-test-id="add-shipping-zone-button"]',
|
||||
shippingAutocompleteSelect: "[data-test-id='shippingAutoCompleteSelect']"
|
||||
shippingAutocompleteSelect: "[data-test-id='shippingAutoCompleteSelect']",
|
||||
countryAutocompleteInput: '[data-test-id="country-select-input"]'
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@ export const SHARED_ELEMENTS = {
|
|||
header: "[data-test-id='page-header']",
|
||||
progressBar: '[role="progressbar"]',
|
||||
circularProgress: '[class*="CircularProgress-circle"]',
|
||||
autocompleteCircle: '[class*="arrowInnerContainer"]',
|
||||
skeleton: '[data-test-id="skeleton"]',
|
||||
table: 'table[class*="Table"]',
|
||||
tableRow: '[data-test="id"], [class*="MuiTableRow"]',
|
||||
|
@ -14,7 +15,8 @@ export const SHARED_ELEMENTS = {
|
|||
empty: '[class*="codex-editor--empty"]'
|
||||
},
|
||||
filters: {
|
||||
filterGroupActivateCheckbox: '[data-test="filterGroupActive"]'
|
||||
filterGroupActivateCheckbox: '[data-test="filterGroupActive"]',
|
||||
filterRow: '[data-test="channel-availability-item"]'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ filterTests(["all"], () => {
|
|||
.should("not.exist")
|
||||
.wait("@productBulkDelete");
|
||||
getCategory(category.id).then(categoryResp => {
|
||||
expect(categoryResp.products).to.be.null;
|
||||
expect(categoryResp.products.edges.length).to.be.eq(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -35,18 +35,23 @@ describe("Tests for using attributes in filters", () => {
|
|||
});
|
||||
|
||||
it("should use attribute as filter", () => {
|
||||
updateAttribute({ filterableInDashboard: false });
|
||||
updateAttribute({
|
||||
attributeId: attribute.id,
|
||||
filterableInDashboard: false
|
||||
});
|
||||
enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
|
||||
enterProductListPage();
|
||||
selectAttributeFilter(attribute.slug, startsWith);
|
||||
cy.contains(SHARED_ELEMENTS.tableRow, startsWith).should("be.visible");
|
||||
selectAttributeFilter(attribute.slug, attribute.name);
|
||||
cy.contains(SHARED_ELEMENTS.tableRow, attribute.name).should("be.visible");
|
||||
});
|
||||
|
||||
it("should remove attribute from filters", () => {
|
||||
updateAttribute({ filterableInDashboard: false });
|
||||
updateAttribute({ attributeId: attribute.id, filterableInDashboard: true });
|
||||
enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
|
||||
enterProductListPage();
|
||||
showFilters();
|
||||
cy.contains(attribute.name).should("not.exist");
|
||||
cy.contains(SHARED_ELEMENTS.filters.filterRow, attribute.name).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -26,6 +26,7 @@ filterTests(["all"], () => {
|
|||
const channelStartsWith = `CyChannels`;
|
||||
const randomName = `${channelStartsWith} ${faker.datatype.number()}`;
|
||||
const currency = "PLN";
|
||||
const defaultCountry = "Poland";
|
||||
let shippingZone;
|
||||
|
||||
before(() => {
|
||||
|
|
|
@ -10,10 +10,13 @@ import { ONE_PERMISSION_USERS } from "../../../Data/users";
|
|||
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
|
||||
import { SHIPPING_ZONE_DETAILS } from "../../../elements/shipping/shipping-zone-details";
|
||||
import { selectChannelInHeader } from "../../../steps/channelsSteps";
|
||||
import { waitForProgressBarToNotExist } from "../../../steps/shared/progressBar";
|
||||
import { enterHomePageChangeChannelAndReturn } from "../../../steps/channelsSteps";
|
||||
import {
|
||||
waitForProgressBarToNotBeVisible,
|
||||
waitForProgressBarToNotExist
|
||||
} from "../../../steps/shared/progressBar";
|
||||
import filterTests from "../../../support/filterTests";
|
||||
import { getFormattedCurrencyAmount } from "../../../support/format/formatCurrencyAmount";
|
||||
import { getCurrencyAndAmountInString } from "../../../support/format/formatCurrencyAmount";
|
||||
import { urlList } from "../../../url/urlList";
|
||||
import * as channelsUtils from "../../../utils/channelsUtils";
|
||||
import * as shippingUtils from "../../../utils/shippingUtils";
|
||||
|
@ -98,18 +101,22 @@ filterTests(["all"], () => {
|
|||
}
|
||||
cy.contains(shippingZone.name).click();
|
||||
cy.wait("@ShippingZone");
|
||||
selectChannelInHeader(defaultChannel.name);
|
||||
enterHomePageChangeChannelAndReturn(defaultChannel.name);
|
||||
waitForProgressBarToNotBeVisible();
|
||||
cy.get(SHARED_ELEMENTS.skeleton).should("not.exist");
|
||||
cy.getTextFromElement(
|
||||
SHIPPING_ZONE_DETAILS.shippingRatePriceTableCell
|
||||
)
|
||||
.then(text => {
|
||||
const expectedValue = getFormattedCurrencyAmount(
|
||||
const expectedValue = getCurrencyAndAmountInString(
|
||||
defaultChannelPrice,
|
||||
defaultChannel.currencyCode
|
||||
);
|
||||
expect(text).to.be.eq(expectedValue);
|
||||
|
||||
selectChannelInHeader(createdChannel.name);
|
||||
enterHomePageChangeChannelAndReturn(createdChannel.name);
|
||||
waitForProgressBarToNotBeVisible();
|
||||
cy.get(SHARED_ELEMENTS.skeleton).should("not.exist");
|
||||
})
|
||||
.then(() => {
|
||||
cy.getTextFromElement(
|
||||
|
@ -117,7 +124,7 @@ filterTests(["all"], () => {
|
|||
);
|
||||
})
|
||||
.then(text => {
|
||||
const expectedValue = getFormattedCurrencyAmount(
|
||||
const expectedValue = getCurrencyAndAmountInString(
|
||||
createdChannelPrice,
|
||||
createdChannelCurrency
|
||||
);
|
||||
|
|
|
@ -63,6 +63,7 @@ filterTests(["all"], () => {
|
|||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Draft order channel should be taken from global channel picker when changed", () => {
|
||||
cy.visit(urlList.homePage);
|
||||
selectChannelInHeader(otherChannel.name);
|
||||
|
@ -80,6 +81,7 @@ filterTests(["all"], () => {
|
|||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("should create draft order with chosen channel", () => {
|
||||
cy.visit(urlList.homePage);
|
||||
selectChannelInHeader(defaultChannel.name);
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
createCustomer,
|
||||
deleteCustomersStartsWith
|
||||
} from "../../apiRequests/Customer";
|
||||
import { updateOrdersSettings } from "../../apiRequests/Order";
|
||||
import { DRAFT_ORDERS_LIST_SELECTORS } from "../../elements/orders/draft-orders-list-selectors";
|
||||
import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
|
||||
import { selectChannelInPicker } from "../../steps/channelsSteps";
|
||||
|
@ -33,6 +34,7 @@ filterTests(["all"], () => {
|
|||
deleteShippingStartsWith(startsWith);
|
||||
productsUtils.deleteProductsStartsWith(startsWith);
|
||||
|
||||
updateOrdersSettings();
|
||||
getDefaultChannel()
|
||||
.then(channel => {
|
||||
defaultChannel = channel;
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
createCustomer,
|
||||
deleteCustomersStartsWith
|
||||
} from "../../apiRequests/Customer";
|
||||
import { getOrder } from "../../apiRequests/Order";
|
||||
import { getOrder, updateOrdersSettings } from "../../apiRequests/Order";
|
||||
import { ONE_PERMISSION_USERS } from "../../Data/users";
|
||||
import { ORDER_REFUND } from "../../elements/orders/order-refund";
|
||||
import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
|
||||
|
@ -46,6 +46,7 @@ filterTests(["all"], () => {
|
|||
deleteShippingStartsWith(startsWith);
|
||||
productsUtils.deleteProductsStartsWith(startsWith);
|
||||
|
||||
updateOrdersSettings();
|
||||
getDefaultChannel()
|
||||
.then(channel => {
|
||||
defaultChannel = channel;
|
||||
|
@ -158,9 +159,6 @@ filterTests(["all"], () => {
|
|||
cy.contains(ORDERS_SELECTORS.orderRow, order.number).click();
|
||||
cy.get(SHARED_ELEMENTS.skeleton)
|
||||
.should("not.exist")
|
||||
.get(ORDERS_SELECTORS.orderFulfillmentFrame)
|
||||
.find(BUTTON_SELECTORS.showMoreButton)
|
||||
.click()
|
||||
.get(ORDERS_SELECTORS.cancelFulfillment)
|
||||
.click();
|
||||
})
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
selectProductsOutOfStock
|
||||
} from "../../../steps/catalog/products/productsListSteps";
|
||||
import { waitForProgressBarToNotExist } from "../../../steps/shared/progressBar";
|
||||
import { searchInTable } from "../../../steps/shared/tables";
|
||||
import filterTests from "../../../support/filterTests";
|
||||
import { urlList } from "../../../url/urlList";
|
||||
import { getDefaultChannel } from "../../../utils/channelsUtils";
|
||||
|
@ -112,9 +113,10 @@ filterTests(["all"], () => {
|
|||
categoryId: category.id,
|
||||
price
|
||||
});
|
||||
waitForProgressBarToNotExist();
|
||||
selectChannel(channel.slug);
|
||||
selectProductsOutOfStock();
|
||||
searchInTable(productOutOfStock);
|
||||
cy.get(PRODUCTS_LIST.productsNames).should("have.length", 1);
|
||||
cy.getTextFromElement(PRODUCTS_LIST.productsNames).then(product => {
|
||||
expect(product).to.includes(productOutOfStock);
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
createVariant,
|
||||
variantsShouldBeVisible
|
||||
} from "../../steps/catalog/products/VariantsSteps";
|
||||
import { selectChannelInHeader } from "../../steps/channelsSteps";
|
||||
import { enterHomePageChangeChannelAndReturn } from "../../steps/channelsSteps";
|
||||
import filterTests from "../../support/filterTests";
|
||||
import { urlList } from "../../url/urlList";
|
||||
import {
|
||||
|
@ -106,7 +106,7 @@ filterTests(["all", "critical"], () => {
|
|||
price,
|
||||
attribute: attributeValues[0]
|
||||
});
|
||||
selectChannelInHeader(defaultChannel.name);
|
||||
enterHomePageChangeChannelAndReturn(defaultChannel.name);
|
||||
variantsShouldBeVisible({ name, price });
|
||||
getProductVariants(createdProduct.id, defaultChannel.slug);
|
||||
})
|
||||
|
@ -144,7 +144,7 @@ filterTests(["all", "critical"], () => {
|
|||
});
|
||||
})
|
||||
.then(() => {
|
||||
selectChannelInHeader(defaultChannel.name);
|
||||
enterHomePageChangeChannelAndReturn(defaultChannel.name);
|
||||
variantsShouldBeVisible({
|
||||
name: variants[1].name,
|
||||
price: variants[1].price
|
||||
|
@ -189,9 +189,9 @@ filterTests(["all", "critical"], () => {
|
|||
price: variantsPrice,
|
||||
attribute: attributeValues[0]
|
||||
});
|
||||
selectChannelInHeader(defaultChannel.name);
|
||||
enterHomePageChangeChannelAndReturn(defaultChannel.name);
|
||||
variantsShouldBeVisible({ name, price: variantsPrice });
|
||||
selectChannelInHeader(newChannel.name);
|
||||
enterHomePageChangeChannelAndReturn(newChannel.name);
|
||||
variantsShouldBeVisible({ name, price: variantsPrice });
|
||||
getProductVariants(createdProduct.id, defaultChannel.slug);
|
||||
})
|
||||
|
|
|
@ -10,6 +10,7 @@ import { STAFF_MEMBER_DETAILS } from "../elements/staffMembers/staffMemberDetail
|
|||
import { STAFF_MEMBERS_LIST } from "../elements/staffMembers/staffMembersList";
|
||||
import { expectWelcomeMessageIncludes } from "../steps/homePageSteps";
|
||||
import { getDisplayedSelectors } from "../steps/permissions";
|
||||
import { confirmationMessageShouldDisappear } from "../steps/shared/confirmationMessages";
|
||||
import {
|
||||
fillUpSetPassword,
|
||||
fillUpUserDetails,
|
||||
|
@ -98,8 +99,9 @@ filterTests(["stagedOnly"], () => {
|
|||
.click()
|
||||
.addAliasToGraphRequest("StaffMemberUpdate")
|
||||
.get(BUTTON_SELECTORS.confirm)
|
||||
.click()
|
||||
.wait("@StaffMemberUpdate")
|
||||
.click();
|
||||
confirmationMessageShouldDisappear();
|
||||
cy.wait("@StaffMemberUpdate")
|
||||
.clearSessionData()
|
||||
.loginUserViaRequest("auth", { email, password })
|
||||
.visit(urlList.homePage);
|
||||
|
|
|
@ -2,6 +2,7 @@ import { ATTRIBUTES_DETAILS } from "../elements/attribute/attributes_details";
|
|||
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
|
||||
import { attributeDetailsUrl } from "../url/urlList";
|
||||
import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
|
||||
import { waitForProgressBarToNotBeVisible } from "./shared/progressBar";
|
||||
|
||||
export function createAttributeWithInputType({
|
||||
name,
|
||||
|
@ -86,8 +87,8 @@ export function selectNumericSystem({ unitSystem, unitsOf, unit }) {
|
|||
}
|
||||
|
||||
export function enterAttributeAndChanegeIsFilterableInDashbord(attributeId) {
|
||||
cy.visit(attributeDetailsUrl(attributeId))
|
||||
.get(ATTRIBUTES_DETAILS.dashboardProperties.useInFilteringCheckbox)
|
||||
.click();
|
||||
cy.visit(attributeDetailsUrl(attributeId));
|
||||
waitForProgressBarToNotBeVisible();
|
||||
cy.get(ATTRIBUTES_DETAILS.dashboardProperties.useInFilteringCheckbox).click();
|
||||
submitAttribute();
|
||||
}
|
||||
|
|
|
@ -8,11 +8,10 @@ import { waitForProgressBarToNotBeVisible } from "../../shared/progressBar";
|
|||
import { fillUpPriceList } from "./priceList";
|
||||
|
||||
export function variantsShouldBeVisible({ name, price }) {
|
||||
cy.contains(PRODUCT_DETAILS.variantRow, name)
|
||||
.should("be.visible")
|
||||
.find(PRODUCT_DETAILS.variantPrice)
|
||||
.invoke("text")
|
||||
.then(text => expect(text).to.includes(price));
|
||||
cy.contains(PRODUCT_DETAILS.variantRow, name).should("be.visible");
|
||||
cy.contains(PRODUCT_DETAILS.variantPrice, price);
|
||||
// .invoke("text")
|
||||
// .then(text => expect(text).to.includes(price));
|
||||
}
|
||||
export function createFirstVariant({ sku, warehouseId, price, attribute }) {
|
||||
cy.get(PRODUCT_DETAILS.addVariantsButton).click();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { PRODUCT_DETAILS } from "../../../elements/catalog/products/product-details";
|
||||
import { AVAILABLE_CHANNELS_FORM } from "../../../elements/channels/available-channels-form";
|
||||
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||
import { fillAutocompleteSelect } from "../../shared/selects";
|
||||
import { fillAutocompleteSelect, fillMultiSelect } from "../../shared/selects";
|
||||
import { addMetadataField } from "../metadataSteps";
|
||||
import { editSeoSettings } from "../seoSteps";
|
||||
|
||||
|
@ -105,7 +105,7 @@ export function fillUpCollectionAndCategory({ category, collection }) {
|
|||
return fillAutocompleteSelect(PRODUCT_DETAILS.categoryInput, category)
|
||||
.then(selected => {
|
||||
organization.category = selected;
|
||||
fillAutocompleteSelect(PRODUCT_DETAILS.collectionInput, collection);
|
||||
fillMultiSelect(PRODUCT_DETAILS.collectionInput, collection);
|
||||
})
|
||||
.then(selected => {
|
||||
organization.collection = selected;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { CATEGORY_DETAILS } from "../elements/catalog/categories/category-details";
|
||||
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
|
||||
import { confirmationMessageShouldDisappear } from "./shared/confirmationMessage";
|
||||
import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
|
||||
|
||||
export function createCategory({ name, description }) {
|
||||
cy.get(CATEGORY_DETAILS.nameInput)
|
||||
|
|
|
@ -6,13 +6,15 @@ import { SELECT_CHANNELS_TO_ASSIGN } from "../elements/channels/select-channels-
|
|||
import { HEADER_SELECTORS } from "../elements/header/header-selectors";
|
||||
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
|
||||
import { SHARED_ELEMENTS } from "../elements/shared/sharedElements";
|
||||
import { urlList } from "../url/urlList";
|
||||
import { fillAutocompleteSelect } from "./shared/selects";
|
||||
|
||||
export function createChannelByView({
|
||||
name,
|
||||
currency,
|
||||
slug = name,
|
||||
shippingZone
|
||||
shippingZone,
|
||||
defaultCountry = "Poland"
|
||||
}) {
|
||||
cy.addAliasToGraphRequest("Channel")
|
||||
.get(CHANNELS_SELECTORS.createChannelButton)
|
||||
|
@ -31,6 +33,10 @@ export function createChannelByView({
|
|||
cy.get(ADD_CHANNEL_FORM_SELECTORS.currencyAutocompleteDropdown).click();
|
||||
}
|
||||
});
|
||||
fillAutocompleteSelect(
|
||||
ADD_CHANNEL_FORM_SELECTORS.countryAutocompleteInput,
|
||||
defaultCountry
|
||||
);
|
||||
if (shippingZone) {
|
||||
addShippingZone(shippingZone);
|
||||
}
|
||||
|
@ -96,3 +102,15 @@ export function selectChannelVariantInDetailsPage(channelName, attributeName) {
|
|||
.find(BUTTON_SELECTORS.submit)
|
||||
.click();
|
||||
}
|
||||
|
||||
export function enterHomePageAndChangeChannel(channelName) {
|
||||
cy.visit(urlList.homePage);
|
||||
selectChannelInHeader(channelName);
|
||||
}
|
||||
|
||||
export function enterHomePageChangeChannelAndReturn(channelName) {
|
||||
cy.url().then(url => {
|
||||
enterHomePageAndChangeChannel(channelName);
|
||||
cy.visit(url);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -58,7 +58,8 @@ export function getDisplayedSelectors(selectors = LEFT_MENU_SELECTORS) {
|
|||
export function expectAllSelectorsPermitted(permissions, selectors) {
|
||||
Object.values(selectors).forEach(selector => {
|
||||
const isSelectorPermitted = isPermitted(permissions, selector);
|
||||
expect(isSelectorPermitted).to.be.true;
|
||||
expect(isSelectorPermitted, `${selector} selector should be in permitted`)
|
||||
.to.be.true;
|
||||
});
|
||||
}
|
||||
function isPermitted(permissions, selector) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
||||
import { selectorWithDataValue } from "../../elements/shared/sharedElements";
|
||||
import {
|
||||
selectorWithDataValue,
|
||||
SHARED_ELEMENTS
|
||||
} from "../../elements/shared/sharedElements";
|
||||
|
||||
export function fillAutocompleteSelect(selectSelector, option) {
|
||||
cy.get(selectSelector)
|
||||
|
@ -12,16 +15,26 @@ export function fillAutocompleteSelect(selectSelector, option) {
|
|||
cy.wrap(option).as("option");
|
||||
} else {
|
||||
cy.get(BUTTON_SELECTORS.selectOption)
|
||||
.wait(1000)
|
||||
.first()
|
||||
.invoke("text")
|
||||
.as("option");
|
||||
cy.get(BUTTON_SELECTORS.selectOption)
|
||||
.as("option")
|
||||
.get(BUTTON_SELECTORS.selectOption)
|
||||
.first()
|
||||
.click();
|
||||
}
|
||||
return cy.get("@option");
|
||||
}
|
||||
|
||||
export function fillMultiSelect(selectSelector, option) {
|
||||
fillAutocompleteSelect(selectSelector, option).then(returnedOption => {
|
||||
cy.get(SHARED_ELEMENTS.header)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
return cy.wrap(returnedOption);
|
||||
});
|
||||
}
|
||||
|
||||
export function fillBaseSelect(selectSelector, value) {
|
||||
cy.get(selectSelector)
|
||||
.click()
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
||||
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
|
||||
import { waitForProgressBarToNotExist } from "./progressBar";
|
||||
|
||||
export function searchInTable(query) {
|
||||
cy.get(SHARED_ELEMENTS.searchInput).type(query);
|
||||
waitForProgressBarToNotExist();
|
||||
}
|
||||
|
||||
export function findElementOnTable(elementName) {
|
||||
cy.getTextFromElement(SHARED_ELEMENTS.table).then(tableText => {
|
||||
|
|
|
@ -31,16 +31,11 @@ export function createShippingZone(
|
|||
confirmationMessageShouldDisappear();
|
||||
cy.get(SHIPPING_ZONE_DETAILS.warehouseSelector)
|
||||
.click()
|
||||
.get(SHIPPING_ZONE_DETAILS.autocompleteContentDialog)
|
||||
.scrollTo("bottom")
|
||||
// Remove this code between comments after fixing bug: SALEOR-3611
|
||||
.get(SHIPPING_ZONE_DETAILS.autocompleteContentDialog)
|
||||
.should("not.exist")
|
||||
.get(SHIPPING_ZONE_DETAILS.warehouseSelector)
|
||||
.click()
|
||||
// Remove this code between comments after fixing bug: SALEOR-3611
|
||||
.get(SHIPPING_ZONE_DETAILS.option)
|
||||
.contains(warehouseName)
|
||||
.type(warehouseName)
|
||||
.get(SHIPPING_ZONE_DETAILS.autocompleteContentDialog)
|
||||
.scrollTo("bottom");
|
||||
cy.contains(SHIPPING_ZONE_DETAILS.option, warehouseName)
|
||||
.click({ force: true })
|
||||
.get(SHIPPING_ZONE_DETAILS.channelSelector)
|
||||
.click()
|
||||
|
|
|
@ -3,6 +3,7 @@ import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
|
|||
import { INVITE_STAFF_MEMBER_FORM } from "../elements/staffMembers/inviteStaffMemberForm";
|
||||
import { STAFF_MEMBER_DETAILS } from "../elements/staffMembers/staffMemberDetails";
|
||||
import { userDetailsUrl } from "../url/urlList";
|
||||
import { confirmationMessageShouldDisappear } from "./shared/confirmationMessages";
|
||||
import { visitAndWaitForProgressBarToDisappear } from "./shared/progressBar";
|
||||
import { fillAutocompleteSelect } from "./shared/selects";
|
||||
|
||||
|
@ -26,6 +27,7 @@ export function fillUpUserDetails(firstName, lastName, email) {
|
|||
.type(email)
|
||||
.get(BUTTON_SELECTORS.submit)
|
||||
.click();
|
||||
confirmationMessageShouldDisappear();
|
||||
fillAutocompleteSelect(STAFF_MEMBER_DETAILS.permissionsSelect);
|
||||
cy.addAliasToGraphRequest("StaffMemberUpdate");
|
||||
cy.get(BUTTON_SELECTORS.confirm)
|
||||
|
|
|
@ -6,3 +6,7 @@ export function getFormattedCurrencyAmount(amount, currency) {
|
|||
});
|
||||
return formattedCurrencyAmount;
|
||||
}
|
||||
|
||||
export function getCurrencyAndAmountInString(amount, currency) {
|
||||
return `${currency}${amount.toFixed(2)}`;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue