Skip to content

Commit

Permalink
Fix promise and add timeout for more resilience
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasfoo committed Feb 6, 2025
1 parent fab519b commit e1ad8dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/calypso-e2e/src/lib/pages/signup/user-signup-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,13 @@ export class UserSignupPage {
async signupWoo( email: string ): Promise< NewUserResponse > {
await this.page.fill( selectors.emailInput, email );

const [ , response ] = await Promise.all( [
this.page.waitForURL( /.*woocommerce\.com*/, { waitUntil: 'networkidle' } ),
this.page.waitForResponse( /.*new\?.*/ ),
const [ response ] = await Promise.all( [
this.page.waitForResponse( /.*users\/new\?.*/ ),

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings with many repetitions of 'a'.
this.page.click( selectors.submitButton ),
this.page.waitForURL( /.*woocommerce\.com*/, {
waitUntil: 'networkidle',
timeout: 25000,
} ),

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings with many repetitions of 'a'.
] );

if ( ! response ) {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/onboarding/signup__woo-email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe(
} );

it( 'Activate account', async function () {
await page.goto( activationLink, { waitUntil: 'networkidle' } );
await page.goto( activationLink, { waitUntil: 'networkidle', timeout: 25000 } );
} );
} );

Expand Down

0 comments on commit e1ad8dd

Please sign in to comment.