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

E2E tests: remove broken selection of complete plan #28232

Merged
merged 2 commits into from
Jan 10, 2023
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
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: small e2e test update


Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test.describe( 'Connection', () => {

test( 'Classic', async ( { page } ) => {
await test.step( 'Can start classic connection', async () => {
await doClassicConnection( page, true );
await doClassicConnection( page );
} );

await test.step( 'Can assert that site is connected', async () => {
Expand Down
6 changes: 3 additions & 3 deletions tools/e2e-commons/flows/jetpack-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ import { expect } from '@playwright/test';

const cardCredentials = config.get( 'testCardCredentials' );

export async function doClassicConnection( page, freePlan = true ) {
export async function doClassicConnection( page, plan = 'free' ) {
const jetpackPage = await JetpackPage.init( page );
await jetpackPage.connect();
await ( await AuthorizePage.init( page ) ).approve();

if ( freePlan ) {
if ( plan === 'free' ) {
await ( await PickAPlanPage.init( page ) ).select( 'free' );
await RecommendationsPage.init( page );
} else {
await ( await PickAPlanPage.init( page ) ).select( 'complete' );
await ( await PickAPlanPage.init( page ) ).select( plan );
await ( await CheckoutPage.init( page ) ).processPurchase( cardCredentials );
await ( await ThankYouPage.init( page ) ).waitForSetupAndProceed();
}
Expand Down
19 changes: 5 additions & 14 deletions tools/e2e-commons/pages/wpcom/pick-a-plan.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import WpPage from '../wp-page.js';
import logger from '../../logger.cjs';

export default class PickAPlanPage extends WpPage {
constructor( page ) {
Expand All @@ -10,22 +11,12 @@ export default class PickAPlanPage extends WpPage {

async select( product = 'free' ) {
switch ( product ) {
case 'complete':
return await this.selectComplete();
case 'free':
const freePlanButton = '.jetpack-product-store__jetpack-free a';
await this.click( freePlanButton );
break;
default:
return await this.selectFreePlan();
logger.error( `Selecting plan '${ product }' is not implemented! Add it yourself?` );
}
}

async selectFreePlan() {
const freePlanButton = '.jetpack-product-store__jetpack-free a';
return await this.click( freePlanButton );
}

async selectComplete() {
const buttonSelector =
'div[data-e2e-product-slug="jetpack_complete"] [class*="summary"] button';
return await this.click( buttonSelector );
}
}