Merge pull request #3082 from woocommerce/visual-advanced-options-enable-sandbox-mode

Visual test - advanced options enable sandbox mode
This commit is contained in:
Sedat Beser 2025-02-11 11:57:38 +03:00 committed by GitHub
commit b10d06b994
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 34 additions and 9 deletions

View file

@ -40,7 +40,7 @@
"lint:md": "wp-scripts lint-md-docs ./**/*.md README.md", "lint:md": "wp-scripts lint-md-docs ./**/*.md README.md",
"lint:md:fix": "wp-scripts lint-md-docs --fix ./**/*.md README.md", "lint:md:fix": "wp-scripts lint-md-docs --fix ./**/*.md README.md",
"lint:js": "wp-scripts lint-js **/*.{ts,tsx,mjs} **/.*/*.{ts,tsx,mjs}", "lint:js": "wp-scripts lint-js **/*.{ts,tsx,mjs} **/.*/*.{ts,tsx,mjs}",
"lint:js:fix": "wp-scripts lint-js --resolve-plugins-relative-to ./ --fix ./**/*.{ts,tsx,mjs} ./**/.*/*.{ts,tsx,mjs}", "lint:js:fix": "wp-scripts lint-js --resolve-plugins-relative-to ./ --fix './**/*.{ts,tsx,mjs}'",
"all": "npx playwright test --workers=1 --project \"all\"" "all": "npx playwright test --workers=1 --project \"all\""
}, },
"eslintConfig": { "eslintConfig": {

View file

@ -75,6 +75,16 @@ test.describe.serial( () => {
await pcpOnboarding.page.waitForLoadState(); await pcpOnboarding.page.waitForLoadState();
await percy.takeSnapshot( testInfo.title, percyConfig ); await percy.takeSnapshot( testInfo.title, percyConfig );
} ); } );
test( 'PCP-0000 | Settings - Onboarding - Enable Sandbox mode - Default UI @percy', async ( {
pcpOnboarding,
percy,
}, testInfo ) => {
await pcpOnboarding.visit();
await pcpOnboarding.openAdvancedOptions();
await pcpOnboarding.enableSandboxMode();
await percy.takeSnapshot( testInfo.title, percyConfig );
} );
} ); } );
test( 'PCP-0000 | Settings - Badge values per country @percy', async ( { test( 'PCP-0000 | Settings - Badge values per country @percy', async ( {

View file

@ -36,20 +36,22 @@ export class PcpOnboarding extends PcpAdminPage {
this.page.locator( 'input[type="checkbox"][value="physical"]' ); this.page.locator( 'input[type="checkbox"][value="physical"]' );
enableOptionalPaymentMethodsRadio = () => enableOptionalPaymentMethodsRadio = () =>
this.page.locator( this.page.locator( 'input.ppcp-r__radio-value[value="true"]' );
'input.ppcp-r__radio-value[value="true"]'
);
disableOptionalPaymentMethodsRadio = () => disableOptionalPaymentMethodsRadio = () =>
this.page.locator( this.page.locator( 'input.ppcp-r__radio-value[value="false"]' );
'input.ppcp-r__radio-value[value="false"]'
);
connectToPayPalButton = () => connectToPayPalButton = () =>
this.page.getByRole( 'button', { name: 'Connect to PayPal' } ); this.page.getByRole( 'button', { name: 'Connect to PayPal' } );
enableSandboxModeLabel = () => this.page.getByText( 'Enable Sandbox Mode' );
enableSandboxModeToggle = () =>
this.page.locator( '.components-form-toggle' ).first();
// Actions // Actions
isCurrentStep = async ( title: Pcp.Admin.Onboarding.StepTitle ) => { isCurrentStep = async ( title: Pcp.Admin.Onboarding.StepTitle ) => {
await this.page.waitForFunction(() => !!document.querySelector('button.is-title')); await this.page.waitForFunction(
() => !! document.querySelector( 'button.is-title' )
);
return await this.pageTitle( String( title ) ).isVisible(); return await this.pageTitle( String( title ) ).isVisible();
}; };
@ -75,5 +77,16 @@ export class PcpOnboarding extends PcpAdminPage {
} }
}; };
enableSandboxMode = async () => {
const isChecked = await this.enableSandboxModeToggle().getAttribute(
'class'
);
const isToggleChecked = isChecked.includes( 'is-checked' );
if ( ! isToggleChecked ) {
await this.enableSandboxModeLabel().click();
await this.page.waitForLoadState( 'networkidle' );
}
};
// Assertions // Assertions
} }

View file

@ -489,7 +489,9 @@ export class PayPalUI {
openPayPalPupup = async ( dataFundingSource: string = 'paypal' ) => { openPayPalPupup = async ( dataFundingSource: string = 'paypal' ) => {
const popupPromise = this.page.waitForEvent( 'popup' ); const popupPromise = this.page.waitForEvent( 'popup' );
await expect( this.fundingSourceButton( dataFundingSource ) ).toBeVisible(); await expect(
this.fundingSourceButton( dataFundingSource )
).toBeVisible();
await this.fundingSourceButton( dataFundingSource ).click(); await this.fundingSourceButton( dataFundingSource ).click();
const popup = await popupPromise; const popup = await popupPromise;