Visual test- Enable manually connection

Visual test for enabling manual connection added
This commit is contained in:
Sedat 2025-02-10 14:21:07 +03:00
parent 66d38f6f28
commit ce14200370
No known key found for this signature in database
GPG key ID: 84E6450C7FB0969F
3 changed files with 34 additions and 8 deletions

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 - Settings - Onboarding - See advanced options - Manually Connect by clicking on label - Default UI @percy', async ( {
pcpOnboarding,
percy,
}, testInfo ) => {
await pcpOnboarding.visit();
await pcpOnboarding.openAdvancedOptions();
await pcpOnboarding.enableManuallyConnect();
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,24 @@ 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' } );
enableManuallyConnectLabel = () =>
this.page.getByText( 'Manually Connect' );
enableManuallyConnectToggle = () =>
this.page.locator( '.components-form-toggle' ).nth( 1 );
// 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 +79,15 @@ export class PcpOnboarding extends PcpAdminPage {
} }
}; };
disableManuallyConnect = async () => {
const isChecked = await this.enableManuallyConnectToggle().getAttribute(
'class'
);
const isToggleChecked = isChecked.includes( 'is-checked' );
if ( isToggleChecked ) {
await this.enableManuallyConnectLabel().click();
}
};
// 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;