Skip to content

Commit

Permalink
Restore activated currencies after all E2E test that deactivates the …
Browse files Browse the repository at this point in the history
…existing ones (#10175)
  • Loading branch information
tpaksu authored Jan 17, 2025
1 parent 90442fc commit 30643ff
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog/dev-playwright-fix-multi-currency-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Restore activated currencies after all tests that deactivate current ones.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
disableAllEnabledCurrencies,
getActiveThemeSlug,
removeCurrency,
restoreCurrencies,
} from '../../utils/merchant';
import * as navigation from '../../utils/merchant-navigation';

Expand All @@ -38,7 +39,7 @@ test.describe( 'Multi-currency on-boarding', () => {
test.afterAll( async () => {
// Restore original theme.
await activateTheme( page, activeThemeSlug );

await restoreCurrencies( page );
if ( ! wasMulticurrencyEnabled ) {
await deactivateMulticurrency( page );
}
Expand Down
3 changes: 3 additions & 0 deletions tests/e2e-pw/specs/merchant/multi-currency-setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
deactivateMulticurrency,
disableAllEnabledCurrencies,
removeCurrency,
restoreCurrencies,
setCurrencyCharmPricing,
setCurrencyPriceRounding,
setCurrencyRate,
Expand All @@ -31,6 +32,8 @@ test.describe( 'Multi-currency setup', () => {
} );

test.afterAll( async () => {
await restoreCurrencies( merchantPage );

if ( ! wasMulticurrencyEnabled ) {
await deactivateMulticurrency( merchantPage );
}
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e-pw/specs/merchant/multi-currency.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
addMulticurrencyWidget,
deactivateMulticurrency,
disableAllEnabledCurrencies,
restoreCurrencies,
} from '../../utils/merchant';
import * as navigation from '../../utils/merchant-navigation';

Expand All @@ -29,6 +30,7 @@ test.describe( 'Multi-currency', () => {
} );

test.afterAll( async () => {
await restoreCurrencies( page );
if ( ! wasMulticurrencyEnabled ) {
await deactivateMulticurrency( page );
}
Expand Down
7 changes: 7 additions & 0 deletions tests/e2e-pw/utils/merchant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ export const addCurrency = async ( page: Page, currencyCode: string ) => {
).toBeVisible();
};

export const restoreCurrencies = async ( page: Page ) => {
await disableAllEnabledCurrencies( page );
await addCurrency( page, 'USD' );
await addCurrency( page, 'EUR' );
await addCurrency( page, 'GBP' );
};

export const removeCurrency = async ( page: Page, currencyCode: string ) => {
await navigation.goToMultiCurrencySettings( page );
await page
Expand Down

0 comments on commit 30643ff

Please sign in to comment.