|
| 1 | +/** |
| 2 | + * External dependencies |
| 3 | + */ |
| 4 | +import { test, expect } from '@playwright/test'; |
| 5 | +import qit from '/qitHelpers'; |
| 6 | + |
| 7 | +/** |
| 8 | + * Simple QIT E2E test - bare minimum to verify QIT works |
| 9 | + */ |
| 10 | +test( 'Load home page', async ( { page } ) => { |
| 11 | + await page.goto( '/' ); |
| 12 | + |
| 13 | + // Just check that we can load the page and title exists |
| 14 | + await expect( page ).toHaveTitle( /.*/ ); |
| 15 | +} ); |
| 16 | + |
| 17 | +/** |
| 18 | + * Test WooCommerce Payments onboarding flow access |
| 19 | + * Since we're running in development mode without Jetpack connection, |
| 20 | + * we expect to always land on the onboarding flow. |
| 21 | + */ |
| 22 | +test( 'Access WooCommerce Payments onboarding as admin', async ( { page } ) => { |
| 23 | + // Use QIT helper to login as admin |
| 24 | + await qit.loginAsAdmin( page ); |
| 25 | + |
| 26 | + // Navigate to WooCommerce Payments settings |
| 27 | + await page.goto( |
| 28 | + '/wp-admin/admin.php?page=wc-admin&path=%2Fpayments%2Foverview' |
| 29 | + ); |
| 30 | + |
| 31 | + // We should see the Payments admin route load |
| 32 | + await expect( |
| 33 | + page.locator( 'h1:not(.screen-reader-text)' ).first() |
| 34 | + ).toContainText( /Settings|Payments|Overview/, { timeout: 15000 } ); |
| 35 | + |
| 36 | + // In development mode without Jetpack connection, we should be on onboarding |
| 37 | + expect( page.url() ).toContain( 'onboarding' ); |
| 38 | + |
| 39 | + // The onboarding page should load without errors |
| 40 | + await expect( page.locator( 'body' ) ).not.toHaveText( |
| 41 | + /500|404|Fatal error/ |
| 42 | + ); |
| 43 | +} ); |
| 44 | + |
| 45 | +/** |
| 46 | + * Test plugin activation and basic WooCommerce functionality |
| 47 | + */ |
| 48 | +test( 'Verify WooCommerce Payments plugin activation', async ( { page } ) => { |
| 49 | + await qit.loginAsAdmin( page ); |
| 50 | + |
| 51 | + // Check plugins page to verify WooCommerce Payments is active |
| 52 | + await page.goto( '/wp-admin/plugins.php' ); |
| 53 | + |
| 54 | + // Look for the WooCommerce Payments plugin row (exclude update row) |
| 55 | + const pluginRow = page.locator( |
| 56 | + 'tr[data-plugin*="woocommerce-payments"]:not(.plugin-update-tr)' |
| 57 | + ); |
| 58 | + await expect( pluginRow ).toBeVisible(); |
| 59 | + |
| 60 | + // Verify it shows as activated |
| 61 | + await expect( pluginRow.locator( '.deactivate' ) ).toBeVisible(); |
| 62 | +} ); |
0 commit comments