
* Update schema * Update queries, mutations, and types * Add render with dividers util function * Add plugin details channels card component * Update plugin details to use channels * Update stories * Update plugin configuration type across the app, fix some other types, temporarily comment some things out in plugins list so types match" * Update schema * Update types * Update plugins list to show channels and global statuses, add plugin channel status, update status label component * Add render with dividers util function * Comment out some stuff for types to match - temporary * Add useChannelsSearchWithLoadMore util to imitate loading more from backend for channels list with load more * Change filters logic to be able to display multiple fields in a field section and add it to plugins view * Add scroll option to plugin availability popup on plugin list * Fix plugin list page story * Temporarily comment some stuff out, fix some types * Add filters errors WIP * Fix filters not updating list * Add error handling to plugins list filters and filters in general * Rename some components according to review * Move useChannelsSearch and useChannelsSearchWithLoadMore to hooks, change some imports accordingly * Fix imports * Move render collection with dividers to a component, fix usages * Replace channels with load more and search query to base channels query * Change render with dividers function to take in a component instead of render function * Update tests * Extract messages * Remove unnecessary imports * Fix filters - autocomplete messing items order sometimes & some fields not working * Update plugin update mutation variables - change channelId to channel * fix failing tests * Add test ids * fix failing tests * fix failing tests * Rename misc.tsx to ts * Remove usage of render collection with diviers, change it to CollectionWithDividers component * Remove unnecessary imports * Update messages ids * Update snapshots Co-authored-by: Karolina Rakoczy <rakoczy.karolina@gmail.com>
102 lines
3 KiB
JavaScript
102 lines
3 KiB
JavaScript
// <reference types="cypress" />
|
|
import faker from "faker";
|
|
|
|
import {
|
|
createCustomer,
|
|
deleteCustomersStartsWith
|
|
} from "../../apiRequests/Customer";
|
|
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";
|
|
import { finalizeDraftOrder } from "../../steps/draftOrderSteps";
|
|
import { urlList } from "../../url/urlList";
|
|
import { getDefaultChannel } from "../../utils/channelsUtils";
|
|
import * as productsUtils from "../../utils/products/productsUtils";
|
|
import {
|
|
createShipping,
|
|
deleteShippingStartsWith
|
|
} from "../../utils/shippingUtils";
|
|
|
|
describe("Draft orders", () => {
|
|
const startsWith = "CyDraftOrders-";
|
|
const randomName = startsWith + faker.datatype.number();
|
|
|
|
let defaultChannel;
|
|
let warehouse;
|
|
let address;
|
|
|
|
before(() => {
|
|
cy.clearSessionData().loginUserViaRequest();
|
|
deleteCustomersStartsWith(startsWith);
|
|
deleteShippingStartsWith(startsWith);
|
|
productsUtils.deleteProductsStartsWith(startsWith);
|
|
|
|
getDefaultChannel()
|
|
.then(channel => {
|
|
defaultChannel = channel;
|
|
})
|
|
.then(() => {
|
|
cy.fixture("addresses");
|
|
})
|
|
.then(addresses => {
|
|
address = addresses.plAddress;
|
|
createCustomer(
|
|
`${randomName}@example.com`,
|
|
randomName,
|
|
addresses.plAddress,
|
|
true
|
|
);
|
|
createShipping({
|
|
channelId: defaultChannel.id,
|
|
name: randomName,
|
|
address: addresses.plAddress
|
|
});
|
|
})
|
|
.then(({ warehouse: warehouseResp }) => {
|
|
warehouse = warehouseResp;
|
|
productsUtils.createTypeAttributeAndCategoryForProduct(randomName);
|
|
})
|
|
.then(
|
|
({
|
|
productType: productTypeResp,
|
|
attribute: attributeResp,
|
|
category: categoryResp
|
|
}) => {
|
|
productsUtils.createProductInChannel({
|
|
name: randomName,
|
|
channelId: defaultChannel.id,
|
|
warehouseId: warehouse.id,
|
|
productTypeId: productTypeResp.id,
|
|
attributeId: attributeResp.id,
|
|
categoryId: categoryResp.id
|
|
});
|
|
}
|
|
);
|
|
});
|
|
|
|
beforeEach(() => {
|
|
cy.clearSessionData().loginUserViaRequest();
|
|
});
|
|
|
|
it("should move draft order to orders", () => {
|
|
cy.visit(urlList.orders)
|
|
.get(ORDERS_SELECTORS.createOrder)
|
|
.click();
|
|
selectChannelInPicker(defaultChannel.name);
|
|
finalizeDraftOrder(randomName, address).then(draftOrderNumber => {
|
|
cy.visit(urlList.orders);
|
|
cy.contains(ORDERS_SELECTORS.orderRow, draftOrderNumber).should(
|
|
$order => {
|
|
expect($order).to.be.visible;
|
|
}
|
|
);
|
|
cy.visit(urlList.draftOrders);
|
|
cy.contains(
|
|
DRAFT_ORDERS_LIST_SELECTORS.draftOrderRow,
|
|
draftOrderNumber
|
|
).should($draftOrder => {
|
|
expect($draftOrder).to.not.exist;
|
|
});
|
|
});
|
|
});
|
|
});
|