Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add E2E tests for merchant on-boarding #7955

Merged
merged 49 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
fff28c9
Add test skeleton
rafaelzaleski Dec 27, 2023
11e56ac
Add flow to disable all enabled currencies
rafaelzaleski Dec 29, 2023
bd27c82
Add test id for currency checkboxes
rafaelzaleski Dec 29, 2023
7795392
Add test case for submit button disabled
rafaelzaleski Dec 29, 2023
7b9bed9
Merge branch 'develop' into e2e/7347-merchant-on-boarding
rafaelzaleski Dec 29, 2023
d548ebc
Improve add and remove currency flows
rafaelzaleski Jan 3, 2024
e7305d8
Add onboarding page navigation and implement currency selection tests
rafaelzaleski Jan 3, 2024
d51ffd0
Add recommended and enabled currencies tests
rafaelzaleski Jan 8, 2024
cb020bd
Add test 'Should offer currency switch by geolocation'
rafaelzaleski Jan 9, 2024
9c8fde3
Add test 'Should preview currency switch correctly'
rafaelzaleski Jan 9, 2024
8ad7fe9
Add helper to perform theme activation
rafaelzaleski Jan 9, 2024
a05d72a
Merge branch 'develop' into e2e/7347-merchant-on-boarding
rafaelzaleski Jan 9, 2024
079312b
add currency switcher checkbox test
rafaelzaleski Jan 9, 2024
4db0c61
Remove skip instructions
rafaelzaleski Jan 9, 2024
f670e7f
Fix iframe handling in headless browser
rafaelzaleski Jan 10, 2024
390e6e7
remove wait instruction that is not needed
rafaelzaleski Jan 10, 2024
cf78476
Add changelog
rafaelzaleski Jan 11, 2024
9fe5489
Add helper to set checkbox state
rafaelzaleski Jan 11, 2024
0713990
Remove screenshots
rafaelzaleski Jan 11, 2024
9718349
Refactor button actions
rafaelzaleski Jan 11, 2024
e713b12
Use constants for common selectors
rafaelzaleski Jan 11, 2024
2c23b3c
Merge branch 'develop' into e2e/7347-merchant-on-boarding
rafaelzaleski Jan 11, 2024
4755840
Add screenshots to debug CI
rafaelzaleski Jan 11, 2024
7e5721a
Debug with console log
rafaelzaleski Jan 11, 2024
8b4a908
Invert assertions for debugging
rafaelzaleski Jan 11, 2024
277d780
debug
rafaelzaleski Jan 11, 2024
ff6c71c
debug
rafaelzaleski Jan 11, 2024
a891e47
Increase some timeouts
rafaelzaleski Jan 11, 2024
9c19523
debug
rafaelzaleski Jan 11, 2024
333d121
debug
rafaelzaleski Jan 11, 2024
02bfc7e
Attempt to enable screenshots
rafaelzaleski Jan 12, 2024
8d79f78
Merge branch 'develop' into e2e/7347-merchant-on-boarding
rafaelzaleski Jan 12, 2024
ab8b4cc
Add more screenshots
rafaelzaleski Jan 12, 2024
4ffed58
debug
rafaelzaleski Jan 12, 2024
65334f3
Fix screenshot dir GH actions artifacts
rafaelzaleski Jan 12, 2024
f13309c
Remove debug code from flows.js
rafaelzaleski Jan 12, 2024
9b8d8ff
Remove debug code from test file
rafaelzaleski Jan 12, 2024
41335ca
Remove unstable test assertion
rafaelzaleski Jan 12, 2024
78f541a
Merge branch 'develop' into e2e/7347-merchant-on-boarding
rafaelzaleski Jan 12, 2024
17209aa
Change screen size for preview screenshot
rafaelzaleski Jan 12, 2024
afbeb18
Update test snapshot
rafaelzaleski Jan 12, 2024
3537ea7
Merge branch 'develop' into e2e/7347-merchant-on-boarding
bborman22 Jan 15, 2024
e014c26
Merge branch 'develop' into e2e/7347-merchant-on-boarding
rafaelzaleski Jan 15, 2024
f5d0794
Merge branch 'develop' into e2e/7347-merchant-on-boarding
rafaelzaleski Jan 16, 2024
0e1de5f
Merge branch 'develop' into e2e/7347-merchant-on-boarding
rafaelzaleski Jan 18, 2024
8800591
Merge branch 'develop' into e2e/7347-merchant-on-boarding
rafaelzaleski Jan 23, 2024
9f133ed
Merge branch 'develop' into e2e/7347-merchant-on-boarding
achyuthajoy Jan 24, 2024
29764b4
Add tests/e2e/screenshots back to job artifacts
rafaelzaleski Jan 24, 2024
105730c
Merge branch 'develop' into e2e/7347-merchant-on-boarding
rafaelzaleski Jan 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/e2e/run-log-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ runs:
with:
name: wp(${{ env.E2E_WP_VERSION }})-wc(${{ env.E2E_WC_VERSION }})-${{ env.E2E_GROUP }}-${{ env.E2E_BRANCH }}
path: |
tests/e2e/screenshots
screenshots
tests/e2e/docker/wordpress/wp-content/debug.log
${{ env.E2E_RESULT_FILEPATH }}
if-no-files-found: ignore
Expand Down
4 changes: 4 additions & 0 deletions changelog/e2e-7347-merchant-on-boarding
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

E2E test - Merchant facing multi-currency on-boarding screen.
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,14 @@ const AddCurrenciesTask = () => {
);
} );

const displayCurrencyCheckbox = ( code ) =>
const displayCurrencyCheckbox = ( code, testId = '' ) =>
availableCurrencyCodes.length && (
<EnabledCurrenciesModalCheckbox
key={ 'currency-checkbox-' + availableCurrencies[ code ].id }
checked={ selectedCurrencyCodes.includes( code ) }
onChange={ handleChange }
currency={ availableCurrencies[ code ] }
testId={ _.isString( testId ) ? testId : null }
/>
);

Expand Down Expand Up @@ -284,7 +285,11 @@ const AddCurrenciesTask = () => {
</h4>
</li>
{ visibleRecommendedCurrencyCodes.map(
displayCurrencyCheckbox
( code ) =>
displayCurrencyCheckbox(
code,
'recommended-currency'
)
) }
<li
className={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down Expand Up @@ -171,6 +172,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down Expand Up @@ -232,6 +234,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down Expand Up @@ -293,6 +296,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down Expand Up @@ -354,6 +358,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down Expand Up @@ -415,6 +420,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const EnabledCurrenciesModalCheckbox = ( {
onChange,
checked = false,
currency: { flag, symbol, code, name },
testId = null,
} ) => {
const handleChange = useCallback(
( enabled ) => {
Expand All @@ -20,7 +21,7 @@ const EnabledCurrenciesModalCheckbox = ( {
);

return (
<li className="enabled-currency-checkbox">
<li className="enabled-currency-checkbox" data-testid={ testId }>
<CheckboxControl
code={ code }
checked={ checked }
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"test:e2e-up": "./tests/e2e/env/up.sh",
"test:e2e-cleanup": "./tests/e2e/env/cleanup.sh",
"test:e2e-reset": "npm run test:e2e-down && npm run test:e2e-cleanup",
"test:e2e": "NODE_CONFIG_DIR='tests/e2e/config' wp-scripts test-e2e --config tests/e2e/config/jest.config.js",
"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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to be able to work with iframes.

"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",
"test:e2e-performance": "NODE_CONFIG_DIR='tests/e2e/config' wp-scripts test-e2e --config tests/e2e/config/jest.performance.config.js",
"test:update-snapshots": "npm run test:js -- --updateSnapshot",
Expand Down
17 changes: 17 additions & 0 deletions tests/e2e/config/jest-puppeteer-headless.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { jestPuppeteerConfig } = require( '@woocommerce/e2e-environment' );

// Add arg to allow accessing the payments iframes in interactive mode ({ headles: false }).
// https://github.com/puppeteer/puppeteer/issues/4960#issuecomment-535729011
jestPuppeteerConfig.launch.args.push( '--disable-features=site-per-process' );
jestPuppeteerConfig.launch.args.push( '--disable-web-security' );
jestPuppeteerConfig.launch.args.push( '--disable-features=IsolateOrigins' );
jestPuppeteerConfig.launch.args.push( '--disable-site-isolation-trials' );

// Set a real User Agent so the "Add block" button isn't disabled in Gutenberg during -dev tests.
// Also keeping the "puppeteer-debug" value coming from @automattic.puppeteer
jestPuppeteerConfig.launch.args.push(
// eslint-disable-next-line max-len
'--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'
);

module.exports = jestPuppeteerConfig;
Loading
Loading