Skip to content

Commit

Permalink
[not verified] E2E tests: remove broken selection of complete plan (#…
Browse files Browse the repository at this point in the history
…28232)

* Remove selection of complete plan in connection flow as it's broken and not used anywhere anyway.
  • Loading branch information
adimoldovan authored and n3f committed Jan 11, 2023
1 parent 26a3934 commit 97e025b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
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 );
}
}

0 comments on commit 97e025b

Please sign in to comment.