wait for sales to be visible

This commit is contained in:
Karolina Rakoczy 2021-02-12 10:36:14 +01:00
parent c5939517c6
commit 5b6d1ddd77
2 changed files with 10 additions and 21 deletions

View file

@ -5,6 +5,5 @@ export const DASHBOARD_SELECTORS = {
topProducts: "[data-test-id='top-products']",
ordersReadyToFulfill: "[data-test-id='orders-to-fulfill']",
paymentsWaitingForCapture: "[data-test-id='orders-to-capture']",
productsOutOfStock: "[data-test-id='products-out-of-stock']",
dataAreLoading: "[class*='Skeleton-skeleton']"
productsOutOfStock: "[data-test-id='products-out-of-stock']"
};

View file

@ -130,24 +130,14 @@ describe("User authorization", () => {
.get(HEADER_SELECTORS.channelSelectList)
.contains(randomName)
.click()
.waitForGraph("Home")
.then(() => {
cy.get(DASHBOARD_SELECTORS.dataAreLoading)
.should("not.exist")
.then(() => {
const regex = /^1\D+/;
cy.softAssertMatch(DASHBOARD_SELECTORS.ordersReadyToFulfill, regex)
.softAssertMatch(
DASHBOARD_SELECTORS.paymentsWaitingForCapture,
regex
)
.softAssertMatch(DASHBOARD_SELECTORS.productsOutOfStock, regex)
.softAssertMatch(
DASHBOARD_SELECTORS.sales,
new RegExp(`\\D+${sales}[\,.]00\\D*`)
)
.softAssertMatch(DASHBOARD_SELECTORS.orders, /\D+2\D*/);
});
});
.waitForGraph("Home");
const salesRegexp = new RegExp(`\\D+${sales}[\,.]00\\D*`);
cy.contains(salesRegexp).should("be.visible");
const regex = /^1\D+/;
cy.softAssertMatch(DASHBOARD_SELECTORS.ordersReadyToFulfill, regex)
.softAssertMatch(DASHBOARD_SELECTORS.paymentsWaitingForCapture, regex)
.softAssertMatch(DASHBOARD_SELECTORS.productsOutOfStock, regex)
.softAssertMatch(DASHBOARD_SELECTORS.sales, salesRegexp)
.softAssertMatch(DASHBOARD_SELECTORS.orders, /\D+2\D*/);
});
});