Skip to content

Qa add test pcp 4366 4367 4368 4369 4370 4371 4372 4373 #3359

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

Merged
merged 17 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,46 @@ export const defaultUiTestData = [
wooCommerceGeneralSettings: shopSettings.usa.general,
},
];

export const onboardingCheckoutComparison = [
{
testKey: 'PCP-4366',
country: 'US',
wooCommerceGeneralSettings: shopSettings.usa.general,
},
{
testKey: 'PCP-4367',
country: 'UK',
wooCommerceGeneralSettings: shopSettings.uk.general,
},
{
testKey: 'PCP-4368',
country: 'Canada',
wooCommerceGeneralSettings: shopSettings.canada.general,
},
{
testKey: 'PCP-4369',
country: 'Australia',
wooCommerceGeneralSettings: shopSettings.australia.general,
},
{
testKey: 'PCP-4370',
country: 'France',
wooCommerceGeneralSettings: shopSettings.france.general,
},
{
testKey: 'PCP-4371',
country: 'Italy',
wooCommerceGeneralSettings: shopSettings.italy.general,
},
{
testKey: 'PCP-4372',
country: 'Germany',
wooCommerceGeneralSettings: shopSettings.germany.general,
},
{
testKey: 'PCP-4373',
country: 'Spain',
wooCommerceGeneralSettings: shopSettings.spain.general,
},
];
19 changes: 14 additions & 5 deletions tests/qa/tests/02-dashboard-ui/visual-onboarding-badges.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/**
* Internal dependencies
*/
import { test, expect, saveTestResultsToFile, getTestResultsFromFile } from '../../utils';
import {
test,
expect,
saveTestResultsToFile,
getTestResultsFromFile,
} from '../../utils';
import { storeConfigDefault } from '../../resources';
import { badgeTestsData } from './_test-data';

Expand Down Expand Up @@ -30,7 +35,9 @@ for ( const testData of badgeTestsData ) {
} );
await pcpOnboarding.visit();
await pcpOnboarding.gotoInitialOnboardingPage();
await pcpOnboarding.badgeContainer().waitFor( { state: 'visible' } );
await pcpOnboarding
.badgeContainer()
.waitFor( { state: 'visible' } );
await pcpOnboarding.closeAdvancedOptions();
await pcpOnboarding.page.waitForLoadState( 'load' );
await pcpOnboarding.snapshotLocator(
Expand All @@ -42,13 +49,15 @@ for ( const testData of badgeTestsData ) {
);

await pcpOnboarding.activatePayPalPaymentsButton().click();
if( country !== 'Germany' ) {
if ( country !== 'Germany' ) {
await pcpOnboarding.businessRadio().click();
await pcpOnboarding.continueButton().click();
}
await pcpOnboarding.virtualCheckbox().check();
await pcpOnboarding.continueButton().click();
await pcpOnboarding.disableOptionalPaymentMethodsRadio().click();
await pcpOnboarding
.disableOptionalPaymentMethodsRadio()
.click();
await pcpOnboarding.page.waitForLoadState( 'load' );
await pcpOnboarding.snapshotLocator(
pcpOnboarding.checkoutAlternativeOptionsContainer(),
Expand All @@ -59,7 +68,7 @@ for ( const testData of badgeTestsData ) {
);
} );
}

test.afterEach( async ( {}, testInfo ) => {
saveTestResultsToFile(
testInfo.title,
Expand Down
45 changes: 38 additions & 7 deletions tests/qa/tests/02-dashboard-ui/visual-onboarding-ui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { test, expect } from '../../utils';
import { storeConfigDefault } from '../../resources';
import { defaultUiTestData } from './_test-data';
import { defaultUiTestData, onboardingCheckoutComparison } from './_test-data';

test.beforeAll( async ( { utils, pcpApi } ) => {
await utils.configureStore( storeConfigDefault );
Expand All @@ -24,13 +24,12 @@ for ( const country of defaultUiTestData ) {
await pcpOnboarding.gotoInitialOnboardingPage();
await pcpOnboarding.page.waitForLoadState();

const noWarnings =
await pcpOnboarding.assertNoBadgeBoxUtilsWarnings();
const noWarnings = await pcpOnboarding.assertNoBadgeBoxUtilsWarnings();
expect( noWarnings ).toBeTruthy();

await pcpOnboarding.snapshotContent(
`${ testInfo.title } - ${ country }`,
3000,
3000
);
} );
}
Expand Down Expand Up @@ -97,14 +96,14 @@ test( 'PCP-4318 | Settings - US - Onboarding - Connect with business account, al
await pcpOnboarding.continueButton().click();
await pcpOnboarding.snapshotContent(
`${ testInfo.title } - Select product types - No option selected`,
3000,
3000
);

await pcpOnboarding.physicalGoodsCheckbox().check();
await pcpOnboarding.virtualCheckbox().check();
await pcpOnboarding.snapshotContent(
`${ testInfo.title } - Select product types - Products selected`,
3000,
3000
);
await pcpOnboarding.continueButton().click();
await pcpOnboarding.snapshotContent(
Expand All @@ -113,6 +112,38 @@ test( 'PCP-4318 | Settings - US - Onboarding - Connect with business account, al
await pcpOnboarding.disableOptionalPaymentMethodsRadio().click();
await pcpOnboarding.snapshotContent(
`${ testInfo.title } - Choose checkout options - Card payments disabled`,
3000,
3000
);
} );

test.describe( '', () => {
for ( const testData of onboardingCheckoutComparison ) {
const { testKey, country, wooCommerceGeneralSettings } = testData;
test( `${ testKey } | Settings - ${ country } - Onboarding - Compare initial onboarding page (right part) with expanded checkout screen`, async ( {
pcpOnboarding,
wooCommerceApi,
}, testInfo ) => {
await wooCommerceApi.updateGeneralSettings(
wooCommerceGeneralSettings
);

await pcpOnboarding.visit();
await pcpOnboarding.gotoInitialOnboardingPage();
await pcpOnboarding.page.waitForLoadState();
await pcpOnboarding.snapshotContent(
`${ testKey } - Initial Page`
);

await pcpOnboarding.activatePayPalPaymentsButton().click();
if ( country !== 'Germany' ) {
await pcpOnboarding.businessRadio().click();
await pcpOnboarding.continueButton().click();
}
await pcpOnboarding.physicalGoodsCheckbox().check();
await pcpOnboarding.continueButton().click();
await pcpOnboarding.snapshotContent(
`${ testKey } - Checkout Page`
);
} );
}
} );
13 changes: 5 additions & 8 deletions tests/qa/tests/_setup/woocommerce.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,9 @@ setup( 'Setup products', async ( { wooCommerceUtils } ) => {
process.env.PRODUCTS = JSON.stringify( cartItems );
} );

setup(
'Setup Deactivate Disable new UI plugin',
async ( { requestUtils } ) => {
const pluginSlug = 'disable-new-ui';
if ( await requestUtils.isPluginInstalled( pluginSlug ) ) {
await requestUtils.deactivatePlugin( pluginSlug );
}
setup( 'Setup Deactivate Disable new UI plugin', async ( { requestUtils } ) => {
const pluginSlug = 'disable-new-ui';
if ( await requestUtils.isPluginInstalled( pluginSlug ) ) {
await requestUtils.deactivatePlugin( pluginSlug );
}
);
} );
9 changes: 4 additions & 5 deletions tests/qa/utils/admin/pcp-admin-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ export class PcpAdminPage extends WpPage {
* @param snapshotName
* @param timeout
*/
snapshotContent = async ( snapshotName: string, timeout = 500 ) => this.snapshotLocator(
this.contentContainer(),
snapshotName,
{ timeout }
);
snapshotContent = async ( snapshotName: string, timeout = 500 ) =>
this.snapshotLocator( this.contentContainer(), snapshotName, {
timeout,
} );
}
1 change: 1 addition & 0 deletions tests/qa/utils/admin/pcp-onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { Pcp } from '../../resources';
import { PcpAdminPage } from './pcp-admin-page';
import urls from '../urls';
import { expect } from '../../utils';

export class PcpOnboarding extends PcpAdminPage {
url = urls.admin.pcp.onboarding;
Expand Down
5 changes: 1 addition & 4 deletions tests/qa/utils/admin/pcp-pay-later-messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,6 @@ export class PcpPayLaterMessaging extends PcpAdminPage {
// Assert message is displayed
await expect( this.previewMessageTextPart() ).toBeVisible();
// Screenshot configurator
this.snapshotLocator(
this.configContainer(),
snapshotName,
);
this.snapshotLocator( this.configContainer(), snapshotName );
};
}
9 changes: 4 additions & 5 deletions tests/qa/utils/admin/pcp-payment-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ export class PcpPaymentMethods extends PcpAdminPage {
*
* @param snapshotName
*/
snapshotModalWindow = async ( snapshotName: string ) => this.snapshotLocator(
this.modalWindow(),
snapshotName,
{ threshold: 0.9, }
);
snapshotModalWindow = async ( snapshotName: string ) =>
this.snapshotLocator( this.modalWindow(), snapshotName, {
threshold: 0.9,
} );
}
5 changes: 1 addition & 4 deletions tests/qa/utils/admin/pcp-styling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ export class PcpStyling extends PcpAdminPage {
// Assert message is displayed
await expect( this.payPalButtonsPreviewContainer() ).toBeVisible();
// Screenshot configurator
this.snapshotLocator(
this.configContainer(),
snapshotName,
);
this.snapshotLocator( this.configContainer(), snapshotName );
};
}
Loading