2

I'm testing my Stripe integration with Playwright. This is a part of the code for it

  await buyerPage.click('[data-testid="screenplay-side-modal-buy-screenplay"]')
  await buyerPage.waitForNavigation({ url: /^https:\/\/checkout.stripe.com\// })
  await buyerPage.click('[data-testid="hosted-payment-submit-button"]')
  await buyerPage.waitForURL(
    `${baseUrl}/screenplay/${authorScreenplayId}?success=true`,
    {
      timeout: 30000,
    }
  )

No matter what I do, 5 seconds after hosted-payment-submit-button is clicked, the whole test fails without an error.

But it's even crazier that this code repeat twice in the test, and first time it works without any issues.

What am I doing wrong? Also, is there a way to have a detailed message why the test failed in the first place?

1 Answer 1

0

waitForNavigation is deprecated , use waitForUrl instead.

I would re-write it like below:

 await buyerPage.click('[data-testid="screenplay-side-modal-buy-screenplay"]')
  await buyerPage.waitForURL('**//checkout.stripe.com')
  //verify an page element which confirms page loaded completely like may be an grid or button on the bottom
  await buyerPage.click('[data-testid="hosted-payment-submit-button"]')
  await buyerPage.waitForURL(
    `${baseUrl}/screenplay/${authorScreenplayId}?success=true`,
    {
      timeout: 30000,
    }
  )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.