Test case
JavaScript
//1) open Dashboard
//2) check that name in breadcrubs is correct
//3) check for no error message
//4) check for content loading
//5) repeat for all dashboards
Code
JavaScript
//Definition of existing dashboards
const dashboards = [
{
name: 'Price Analyst - Dashboard',
url: '/#/dashboards/Dashboard_PriceAnalyst',
hasContent: true
},
{
name: 'Sales Analyst - Dashboard',
url: '/#/dashboards/Dashboard_SalesAnalyst',
hasContent: true
},
{
name: 'Dashboard Promotions Performance',
url: '/#/dashboards/Dashboard_Promotions_Performance',
hasContent: true
},
{
name: 'Dashboard Simulation Of Promotions',
url: '/#/dashboards/Dashboard_Simulation_Of_Promotions',
hasContent: true
},
{
name: 'Dashboard Rebates',
url: '/#/dashboards/Dashboard_Rebates',
hasContent: true
},
{
name: 'Revenue Breakdown',
url: '/#/dashboards/Revenue_Breakdown',
hasContent: true
},
{
name: 'Customer Rebates',
url: '/#/dashboards/Dashboard_Customer_Rebates',
hasContent: true
},
{
name: 'Rebate Simualtion',
url: '/#/dashboards/Dashboard_Rebate_Simulation',
hasContent: true
},
{
name: 'Promo Optimization Plan',
url: '/#/dashboards/Promo_Optimization_Plan',
hasContent: true
},
{
name: 'Quote Compliance',
url: '/#/dashboards/Dashboard_QuoteCompliance',
hasContent: true
},
{
name: 'Overview of discounts and promotions (active)',
url: '/#/dashboards/Dashboard_Discounts_Promotions',
hasContent: true
},
{
name: 'Customer Retention & Growth Dashboard',
url: '/#/dashboards/CrossSellProductScore_Wizard',
hasContent: true
},
{
name: 'Margin Breakdown',
url: '/#/dashboards/Dashboard_MarginBreakdown',
hasContent: true
},
];
describe('React - Products', () => {
before(() => {
cy.login('demoPartition');
});
beforeEach(() => {
// Configure 'X-PriceFx-Csrf-Token' and 'X-PriceFx-jwt' cookies to be preserved after each test.
Cypress.Cookies.preserveOnce('X-PriceFx-Csrf-Token', 'X-PriceFx-jwt');
// Restore the logged in status by restoring the local storage
cy.restoreLocalStorage().then(() => {
cy.waitForSpinner();
});
});
//1) open Dashboard
//2) check that name in breadcrubs is correct
//3) check for no error message
//4) check for content loading
//5) repeat for all dashboards
//---------------------------------------------------------
//1) open Dashboard
//5) repeat for all dashboards
Cypress._.times(Cypress.env('timesRepeated'), () => {
dashboards.forEach(dashboard => {
it(`Load ${dashboard.name}`, () => {
cy.visit(dashboard.url);
cy.waitForSpinner();
//2) check that name in breadcrubs is correct
cy.contains('[data-test=ucBreadcrumbs]', dashboard.name);
//3) check for no error message
cy.get('.sharedNotification--type-error', { timeout: 0 }).should('not.be.visible');
//4) check for content loading
if (dashboard.hasContent) {
cy.get('.dashboardContent');
}
});
});
});
});
Download test for LoginAPI- Dashboards here.