|
1 | 1 | /**
|
2 | 2 | * External dependencies
|
3 | 3 | */
|
4 |
| -const { merchant } = require( '@woocommerce/e2e-utils' ); |
| 4 | +const { merchant, WP_ADMIN_DASHBOARD } = require( '@woocommerce/e2e-utils' ); |
5 | 5 | /**
|
6 | 6 | * Internal dependencies
|
7 | 7 | */
|
8 |
| -import { merchantWCP, shopperWCP } from '../../../utils'; |
| 8 | +import { merchantWCP, uiLoaded } from '../../../utils'; |
9 | 9 |
|
10 | 10 | let wasMulticurrencyEnabled;
|
11 | 11 |
|
@@ -33,23 +33,64 @@ describe( 'Merchant On-boarding', () => {
|
33 | 33 | } );
|
34 | 34 |
|
35 | 35 | describe( 'Currency Selection and Management', () => {
|
| 36 | + beforeAll( async () => { |
| 37 | + await merchantWCP.disableAllEnabledCurrencies(); |
| 38 | + } ); |
| 39 | + |
| 40 | + beforeEach( async () => { |
| 41 | + await page.goto( |
| 42 | + `${ WP_ADMIN_DASHBOARD }admin.php?page=wc-admin&path=%2Fpayments%2Fmulti-currency-setup`, |
| 43 | + { |
| 44 | + waitUntil: 'networkidle0', |
| 45 | + } |
| 46 | + ); |
| 47 | + await uiLoaded(); |
| 48 | + } ); |
| 49 | + |
36 | 50 | it( 'Should disable the submit button when no currencies are selected', async () => {
|
37 |
| - // Implement test |
| 51 | + const checkboxes = await page.$$( |
| 52 | + '.enabled-currency-checkbox .components-checkbox-control__input' |
| 53 | + ); |
| 54 | + |
| 55 | + for ( const checkbox of checkboxes ) { |
| 56 | + const isChecked = await ( |
| 57 | + await checkbox.getProperty( 'checked' ) |
| 58 | + ).jsonValue(); |
| 59 | + if ( isChecked ) { |
| 60 | + // Click the checkbox to uncheck it if it's checked |
| 61 | + await checkbox.click(); |
| 62 | + } |
| 63 | + } |
| 64 | + |
| 65 | + await page.waitFor( 1000 ); |
| 66 | + |
| 67 | + const button = await page.$( |
| 68 | + '.add-currencies-task.is-active .task-collapsible-body.is-active > button.is-primary' |
| 69 | + ); |
| 70 | + |
| 71 | + expect( button ).not.toBeNull(); |
| 72 | + |
| 73 | + const isDisabled = await page.evaluate( |
| 74 | + ( btn ) => btn.disabled, |
| 75 | + button |
| 76 | + ); |
| 77 | + |
| 78 | + expect( isDisabled ).toBeTruthy(); |
38 | 79 | } );
|
39 | 80 |
|
40 |
| - it( 'Should allow multiple currencies to be selectable', async () => { |
| 81 | + it.skip( 'Should allow multiple currencies to be selectable', async () => { |
41 | 82 | // Implement test
|
42 | 83 | } );
|
43 | 84 |
|
44 |
| - it( 'Should exclude already enabled currencies from the currency screen', async () => { |
| 85 | + it.skip( 'Should exclude already enabled currencies from the currency screen', async () => { |
45 | 86 | // Implement test
|
46 | 87 | } );
|
47 | 88 |
|
48 |
| - it( 'Should display some suggested currencies at the beginning of the list', async () => { |
| 89 | + it.skip( 'Should display some suggested currencies at the beginning of the list', async () => { |
49 | 90 | // Implement test
|
50 | 91 | } );
|
51 | 92 |
|
52 |
| - it( 'Should ensure selected currencies are enabled after submitting the form', async () => { |
| 93 | + it.skip( 'Should ensure selected currencies are enabled after submitting the form', async () => { |
53 | 94 | // Implement test
|
54 | 95 | } );
|
55 | 96 | } );
|
|
0 commit comments