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?