Skip to content

Commit

Permalink
Convert merchant admin transactions E2E tests to Playwright (#10174)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpaksu authored Jan 21, 2025
1 parent 30e1c14 commit a77413a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 40 deletions.
4 changes: 4 additions & 0 deletions changelog/dev-9960-playwright-migration-admin-transactions
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Convert merchant admin transactions E2E test to Playwright
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions tests/e2e-pw/specs/merchant/merchant-admin-transactions.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* External dependencies
*/
import test, { expect } from '@playwright/test';

/**
* Internal dependencies
*/
import { shouldRunSubscriptionsTests } from '../../utils/constants';
import { getMerchant } from '../../utils/helpers';
import { goToTransactions } from '../../utils/merchant-navigation';

test.describe( 'Admin transactions', () => {
test( 'page should load without errors', async ( { browser } ) => {
const { merchantPage } = await getMerchant( browser );
await goToTransactions( merchantPage );
await expect(
merchantPage
.getByLabel( 'Transactions', { exact: true } )
.getByRole( 'heading', { name: 'Transactions' } )
).toBeVisible();

if ( shouldRunSubscriptionsTests ) {
await expect(
merchantPage.getByRole( 'columnheader', {
name: 'Subscription number',
} )
).toBeVisible();
}

await expect( merchantPage ).toHaveScreenshot();
} );
} );
8 changes: 8 additions & 0 deletions tests/e2e-pw/utils/merchant-navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ export const goToOrderAnalytics = async ( page: Page ) => {
await dataHasLoaded( page );
};

export const goToTransactions = async ( page: Page ) => {
await page.goto(
'/wp-admin/admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions',
{ waitUntil: 'load' }
);
await dataHasLoaded( page );
};

export const goToMultiCurrencySettings = async ( page: Page ) => {
await page.goto(
'/wp-admin/admin.php?page=wc-settings&tab=wcpay_multi_currency',
Expand Down
40 changes: 0 additions & 40 deletions tests/e2e/specs/wcpay/merchant/merchant-admin-transactions.spec.js

This file was deleted.

0 comments on commit a77413a

Please sign in to comment.