-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port admin analytics E2E tests from Puppeteer to Playwright (#10127)
Co-authored-by: Ismael Martín Alabarce <[email protected]>
- Loading branch information
1 parent
9bdf4e7
commit 623b57d
Showing
8 changed files
with
154 additions
and
74 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
changelog/update-9957-playwright-migration-admin-order-analytics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: add | ||
|
||
Admin analytics page E2E tests for Playwright |
Binary file added
BIN
+88.7 KB
...in-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions
85
tests/e2e-pw/specs/merchant/merchant-admin-analytics.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import * as shopper from '../../utils/shopper'; | ||
import { getMerchant, getShopper, useMerchant } from '../../utils/helpers'; | ||
import { | ||
activateMulticurrency, | ||
ensureOrderIsProcessed, | ||
isMulticurrencyEnabled, | ||
tableDataHasLoaded, | ||
waitAndSkipTourComponent, | ||
} from '../../utils/merchant'; | ||
import { goToOrderAnalytics } from '../../utils/merchant-navigation'; | ||
|
||
test.describe( 'Admin order analytics', () => { | ||
let orderId: string; | ||
|
||
// Use the merchant user for this test suite. | ||
useMerchant(); | ||
|
||
test.beforeAll( async ( { browser } ) => { | ||
const { shopperPage } = await getShopper( browser ); | ||
const { merchantPage } = await getMerchant( browser ); | ||
|
||
if ( false === ( await isMulticurrencyEnabled( merchantPage ) ) ) { | ||
await activateMulticurrency( merchantPage ); | ||
} | ||
|
||
// Place an order to ensure the analytics data is correct. | ||
orderId = await shopper.placeOrderWithCurrency( shopperPage, 'USD' ); | ||
await ensureOrderIsProcessed( merchantPage, orderId ); | ||
} ); | ||
|
||
test( 'should load without any errors', async ( { browser } ) => { | ||
const { merchantPage } = await getMerchant( browser ); | ||
await goToOrderAnalytics( merchantPage ); | ||
await tableDataHasLoaded( merchantPage ); | ||
await waitAndSkipTourComponent( | ||
merchantPage, | ||
'.woocommerce-revenue-report-date-tour' | ||
); | ||
|
||
const ordersTitle = merchantPage.getByRole( 'heading', { | ||
name: 'Orders', | ||
level: 1, | ||
exact: true, | ||
} ); | ||
await expect( ordersTitle ).toBeVisible(); | ||
await expect( merchantPage ).toHaveScreenshot(); | ||
} ); | ||
|
||
test( 'orders table should have the customer currency column', async ( { | ||
browser, | ||
} ) => { | ||
const { merchantPage } = await getMerchant( browser ); | ||
await goToOrderAnalytics( merchantPage ); | ||
await tableDataHasLoaded( merchantPage ); | ||
await waitAndSkipTourComponent( | ||
merchantPage, | ||
'.woocommerce-revenue-report-date-tour' | ||
); | ||
|
||
const columnToggle = merchantPage.getByTitle( | ||
'Choose which values to display' | ||
); | ||
await columnToggle.click(); | ||
const customerCurrencyToggle = merchantPage.getByRole( | ||
'menuitemcheckbox', | ||
{ | ||
name: 'Customer Currency', | ||
} | ||
); | ||
await expect( customerCurrencyToggle ).toBeVisible(); | ||
await customerCurrencyToggle.click(); | ||
const customerCurrencyColumn = merchantPage.getByRole( 'columnheader', { | ||
name: 'Customer Currency', | ||
} ); | ||
await expect( customerCurrencyColumn ).toBeVisible(); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 0 additions & 73 deletions
73
tests/e2e/specs/wcpay/merchant/merchant-admin-analytics.spec.js
This file was deleted.
Oops, something went wrong.