Merge pull request #29489 from woocommerce/e2e/e2e-merchant-analytics-pagechecks
Add new e2e test opening analytics pages
This commit is contained in:
commit
bec795d60c
|
@ -26,6 +26,7 @@
|
|||
- Merchant Settings Shipping Zones
|
||||
- Shopper Variable product info updates on different variations
|
||||
- Merchant order emails flow
|
||||
- Merchant analytics page load tests
|
||||
- Shopper Checkout Create Account
|
||||
|
||||
# 0.1.1
|
||||
|
|
|
@ -62,6 +62,7 @@ The functions to access the core tests are:
|
|||
- `runTaxSettingsTest` - Merchant can update tax settings
|
||||
- `runUpdateGeneralSettingsTest` - Merchant can update general settings
|
||||
- `runMerchantOrderEmailsTest` - Merchant can receive order emails and resend emails by Order Actions
|
||||
- `runAnalyticsPageLoadsTest` - Merchant can load and see all pages in Analytics
|
||||
|
||||
### Shopper
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ const runProductSearchTest = require( './merchant/wp-admin-product-search.test'
|
|||
const runMerchantOrdersCustomerPaymentPage = require( './merchant/wp-admin-order-customer-payment-page.test' );
|
||||
const runMerchantOrderEmailsTest = require( './merchant/wp-admin-order-emails.test' );
|
||||
const runOrderSearchingTest = require( './merchant/wp-admin-order-searching.test' );
|
||||
const runAnalyticsPageLoadsTest = require( './merchant/wp-admin-analytics-page-loads.test' );
|
||||
|
||||
// REST API tests
|
||||
const runExternalProductAPITest = require( './api/external-product.test' );
|
||||
|
@ -81,6 +82,7 @@ const runMerchantTests = () => {
|
|||
runProductEditDetailsTest();
|
||||
runProductSearchTest();
|
||||
runMerchantOrdersCustomerPaymentPage();
|
||||
runAnalyticsPageLoadsTest();
|
||||
}
|
||||
|
||||
const runApiTests = () => {
|
||||
|
@ -129,5 +131,6 @@ module.exports = {
|
|||
runAddNewShippingZoneTest,
|
||||
runProductBrowseSearchSortTest,
|
||||
runApiTests,
|
||||
runAnalyticsPageLoadsTest,
|
||||
runCheckoutCreateAccountTest,
|
||||
};
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
/* eslint-disable jest/no-export, jest/no-disabled-tests */
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
const {
|
||||
merchant,
|
||||
} = require( '@woocommerce/e2e-utils' );
|
||||
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
const {
|
||||
it,
|
||||
describe,
|
||||
beforeAll,
|
||||
} = require( '@jest/globals' );
|
||||
|
||||
/**
|
||||
* Quick check for page title and no data message.
|
||||
*
|
||||
* @param pageTitle Page title in H1.
|
||||
* @param element Defaults to '.d3-chart__empty-message'
|
||||
* @param elementText Defaults to 'No data for the selected date range'
|
||||
*/
|
||||
const checkHeadingAndElement = async (
|
||||
pageTitle, element = '.d3-chart__empty-message', elementText = 'No data for the selected date range') => {
|
||||
await expect(page).toMatchElement('h1', {text: pageTitle});
|
||||
await expect(page).toMatchElement(element, elementText);
|
||||
};
|
||||
|
||||
const runAnalyticsPageLoadsTest = () => {
|
||||
describe('Analytics > Opening Top Level Pages', () => {
|
||||
beforeAll(async () => {
|
||||
await merchant.login();
|
||||
});
|
||||
|
||||
it('can see Overview page properly', async () => {
|
||||
// Go to "overview" page and verify it
|
||||
await merchant.openAnalyticsPage('overview');
|
||||
await checkHeadingAndElement('Overview');
|
||||
});
|
||||
|
||||
it('can see Products page properly', async () => {
|
||||
// Go to "products" page and verify it
|
||||
await merchant.openAnalyticsPage('products');
|
||||
await checkHeadingAndElement('Products');
|
||||
});
|
||||
|
||||
it('can see Revenue page properly', async () => {
|
||||
// Go to "revenue" page and verify it
|
||||
await merchant.openAnalyticsPage('revenue');
|
||||
await checkHeadingAndElement('Revenue');
|
||||
});
|
||||
|
||||
it('can see Orders page properly', async () => {
|
||||
// Go to "orders" page and verify it
|
||||
await merchant.openAnalyticsPage('orders');
|
||||
await checkHeadingAndElement('Orders');
|
||||
});
|
||||
|
||||
it('can see Variations page properly', async () => {
|
||||
// Go to "variations" page and verify it
|
||||
await merchant.openAnalyticsPage('variations');
|
||||
await checkHeadingAndElement('Variations');
|
||||
});
|
||||
|
||||
it('can see Categories page properly', async () => {
|
||||
// Go to "categories" page and verify it
|
||||
await merchant.openAnalyticsPage('categories');
|
||||
await checkHeadingAndElement('Categories');
|
||||
});
|
||||
|
||||
it('can see Coupons page properly', async () => {
|
||||
// Go to "coupons" page and verify it
|
||||
await merchant.openAnalyticsPage('coupons');
|
||||
await checkHeadingAndElement('Coupons');
|
||||
});
|
||||
|
||||
it('can see Taxes page properly', async () => {
|
||||
// Go to "taxes" page and verify it
|
||||
await merchant.openAnalyticsPage('taxes');
|
||||
await checkHeadingAndElement('Taxes');
|
||||
});
|
||||
|
||||
it('can see Downloads page properly', async () => {
|
||||
// Go to "downloads" page and verify it
|
||||
await merchant.openAnalyticsPage('downloads');
|
||||
await checkHeadingAndElement('Downloads');
|
||||
});
|
||||
|
||||
it('can see Stock page properly', async () => {
|
||||
// Go to "stock" page and verify it
|
||||
await merchant.openAnalyticsPage('stock');
|
||||
await checkHeadingAndElement('Stock', '.components-button > span', 'Product / Variation');
|
||||
});
|
||||
|
||||
it('can see Settings page properly', async () => {
|
||||
// Go to "settings" page and verify it
|
||||
await merchant.openAnalyticsPage('settings');
|
||||
await checkHeadingAndElement('Settings', 'h2', 'Analytics Settings');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = runAnalyticsPageLoadsTest;
|
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* Internal dependencies
|
||||
*/
|
||||
const { runAnalyticsPageLoadsTest } = require( '@woocommerce/e2e-core-tests' );
|
||||
|
||||
runAnalyticsPageLoadsTest();
|
|
@ -53,6 +53,7 @@ describe( 'Cart page', () => {
|
|||
| `runSetupWizard` | | Open the onboarding profiler |
|
||||
| `updateOrderStatus` | `orderId, status` | Update the status of an order |
|
||||
| `openEmailLog` | | Open the WP Mail Log page |
|
||||
| `openAnalyticsPage` | | Open any Analytics page |
|
||||
| `openAllUsersView` | | Open the All Users page |
|
||||
|
||||
### Shopper `shopper`
|
||||
|
|
|
@ -17,6 +17,7 @@ export const WP_ADMIN_NEW_PRODUCT = baseUrl + 'wp-admin/post-new.php?post_type=p
|
|||
export const WP_ADMIN_WC_SETTINGS = baseUrl + 'wp-admin/admin.php?page=wc-settings&tab=';
|
||||
export const WP_ADMIN_PERMALINK_SETTINGS = baseUrl + 'wp-admin/options-permalink.php';
|
||||
export const WP_ADMIN_NEW_SHIPPING_ZONE = baseUrl + 'wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=new';
|
||||
export const WP_ADMIN_ANALYTICS_PAGES = baseUrl + 'wp-admin/admin.php?page=wc-admin&path=%2Fanalytics%2F';
|
||||
export const WP_ADMIN_ALL_USERS_VIEW = baseUrl + 'wp-admin/users.php';
|
||||
|
||||
export const SHOP_PAGE = baseUrl + 'shop';
|
||||
|
|
|
@ -20,6 +20,7 @@ const {
|
|||
WP_ADMIN_SETUP_WIZARD,
|
||||
WP_ADMIN_WC_SETTINGS,
|
||||
WP_ADMIN_NEW_SHIPPING_ZONE,
|
||||
WP_ADMIN_ANALYTICS_PAGES,
|
||||
WP_ADMIN_ALL_USERS_VIEW,
|
||||
} = require( './constants' );
|
||||
|
||||
|
@ -184,6 +185,12 @@ const merchant = {
|
|||
} );
|
||||
},
|
||||
|
||||
openAnalyticsPage: async ( pageName ) => {
|
||||
await page.goto( WP_ADMIN_ANALYTICS_PAGES + pageName, {
|
||||
waitUntil: 'networkidle0',
|
||||
} );
|
||||
},
|
||||
|
||||
openAllUsersView: async () => {
|
||||
await page.goto( WP_ADMIN_ALL_USERS_VIEW, {
|
||||
waitUntil: 'networkidle0',
|
||||
|
|
Loading…
Reference in New Issue