Skip to content

Commit fbecab2

Browse files
rafaelzaleskibborman22achyuthajoy
authored
Add E2E tests for merchant on-boarding (#7955)
Co-authored-by: Brian Borman <[email protected]> Co-authored-by: Achyuth Ajoy <[email protected]>
1 parent e9e5be3 commit fbecab2

File tree

11 files changed

+450
-4
lines changed

11 files changed

+450
-4
lines changed

.github/actions/e2e/run-log-tests/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ runs:
3939
with:
4040
name: wp(${{ env.E2E_WP_VERSION }})-wc(${{ env.E2E_WC_VERSION }})-${{ env.E2E_GROUP }}-${{ env.E2E_BRANCH }}
4141
path: |
42+
screenshots
4243
tests/e2e/screenshots
4344
tests/e2e/docker/wordpress/wp-content/debug.log
4445
${{ env.E2E_RESULT_FILEPATH }}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: dev
3+
4+
E2E test - Merchant facing multi-currency on-boarding screen.

client/multi-currency-setup/tasks/add-currencies-task/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,14 @@ const AddCurrenciesTask = () => {
173173
);
174174
} );
175175

176-
const displayCurrencyCheckbox = ( code ) =>
176+
const displayCurrencyCheckbox = ( code, testId = '' ) =>
177177
availableCurrencyCodes.length && (
178178
<EnabledCurrenciesModalCheckbox
179179
key={ 'currency-checkbox-' + availableCurrencies[ code ].id }
180180
checked={ selectedCurrencyCodes.includes( code ) }
181181
onChange={ handleChange }
182182
currency={ availableCurrencies[ code ] }
183+
testId={ _.isString( testId ) ? testId : null }
183184
/>
184185
);
185186

@@ -284,7 +285,11 @@ const AddCurrenciesTask = () => {
284285
</h4>
285286
</li>
286287
{ visibleRecommendedCurrencyCodes.map(
287-
displayCurrencyCheckbox
288+
( code ) =>
289+
displayCurrencyCheckbox(
290+
code,
291+
'recommended-currency'
292+
)
288293
) }
289294
<li
290295
className={

client/multi-currency-setup/tasks/add-currencies-task/test/__snapshots__/index.test.js.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
110110
</li>
111111
<li
112112
class="enabled-currency-checkbox"
113+
data-testid="recommended-currency"
113114
>
114115
<div
115116
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
@@ -171,6 +172,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
171172
</li>
172173
<li
173174
class="enabled-currency-checkbox"
175+
data-testid="recommended-currency"
174176
>
175177
<div
176178
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
@@ -232,6 +234,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
232234
</li>
233235
<li
234236
class="enabled-currency-checkbox"
237+
data-testid="recommended-currency"
235238
>
236239
<div
237240
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
@@ -293,6 +296,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
293296
</li>
294297
<li
295298
class="enabled-currency-checkbox"
299+
data-testid="recommended-currency"
296300
>
297301
<div
298302
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
@@ -354,6 +358,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
354358
</li>
355359
<li
356360
class="enabled-currency-checkbox"
361+
data-testid="recommended-currency"
357362
>
358363
<div
359364
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
@@ -415,6 +420,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
415420
</li>
416421
<li
417422
class="enabled-currency-checkbox"
423+
data-testid="recommended-currency"
418424
>
419425
<div
420426
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"

client/multi-currency/multi-currency-settings/enabled-currencies-list/modal-checkbox.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const EnabledCurrenciesModalCheckbox = ( {
1111
onChange,
1212
checked = false,
1313
currency: { flag, symbol, code, name },
14+
testId = null,
1415
} ) => {
1516
const handleChange = useCallback(
1617
( enabled ) => {
@@ -20,7 +21,7 @@ const EnabledCurrenciesModalCheckbox = ( {
2021
);
2122

2223
return (
23-
<li className="enabled-currency-checkbox">
24+
<li className="enabled-currency-checkbox" data-testid={ testId }>
2425
<CheckboxControl
2526
code={ code }
2627
checked={ checked }

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"test:e2e-up": "./tests/e2e/env/up.sh",
3434
"test:e2e-cleanup": "./tests/e2e/env/cleanup.sh",
3535
"test:e2e-reset": "npm run test:e2e-down && npm run test:e2e-cleanup",
36-
"test:e2e": "NODE_CONFIG_DIR='tests/e2e/config' wp-scripts test-e2e --config tests/e2e/config/jest.config.js",
36+
"test:e2e": "NODE_CONFIG_DIR='tests/e2e/config' JEST_PUPPETEER_CONFIG='tests/e2e/config/jest-puppeteer-headless.config.js' wp-scripts test-e2e --config tests/e2e/config/jest.config.js",
3737
"test:e2e-dev": "NODE_CONFIG_DIR='tests/e2e/config' JEST_PUPPETEER_CONFIG='tests/e2e/config/jest-puppeteer.config.js' wp-scripts test-e2e --config tests/e2e/config/jest.config.js --puppeteer-interactive",
3838
"test:e2e-performance": "NODE_CONFIG_DIR='tests/e2e/config' wp-scripts test-e2e --config tests/e2e/config/jest.performance.config.js",
3939
"test:update-snapshots": "npm run test:js -- --updateSnapshot",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const { jestPuppeteerConfig } = require( '@woocommerce/e2e-environment' );
2+
3+
// Add arg to allow accessing the payments iframes in interactive mode ({ headles: false }).
4+
// https://github.com/puppeteer/puppeteer/issues/4960#issuecomment-535729011
5+
jestPuppeteerConfig.launch.args.push( '--disable-features=site-per-process' );
6+
jestPuppeteerConfig.launch.args.push( '--disable-web-security' );
7+
jestPuppeteerConfig.launch.args.push( '--disable-features=IsolateOrigins' );
8+
jestPuppeteerConfig.launch.args.push( '--disable-site-isolation-trials' );
9+
10+
// Set a real User Agent so the "Add block" button isn't disabled in Gutenberg during -dev tests.
11+
// Also keeping the "puppeteer-debug" value coming from @automattic.puppeteer
12+
jestPuppeteerConfig.launch.args.push(
13+
// eslint-disable-next-line max-len
14+
'--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 puppeteer-debug'
15+
);
16+
17+
module.exports = jestPuppeteerConfig;

0 commit comments

Comments
 (0)