One of our tests fails on CI, while running the test locally results in the test passing. I've been trying to figure out why for hours/days now, and I still can't seem to fix it.
The test
The steps of the test are as follows:
- Register as a new user
- Confirm the sent email in order to login by clicking a link
- Once logged in, click a link in the dashboard and check if you're on the page.
// $signup & $address are dusk pages
$browser->visit($signup)
->acceptCookies()
->signup([
'firstName' => 'John',
'email' => 'john.doe@example.org',
'password' => 'john.doe',
])
->on($thanks)
->visitMail($confirmationMail)
->withinMail(fn (DuskBrowser $browser) => $browser->click('@confirmLink'))
->switchToLatestWindow()
->on($dashboard)
->click('@editAddressButton')
->on($address)
Every step succeeds until the last line. When the browser asserts it's on the "address" page, the assertion fails. The assertion is based on seeing certain text displayed.
This makes sense, because when dumping the page (on CI) after clicking @editAddressButton, the page is empty like so: <html><body></body></html>.
All dependencies are up-to-date and the same version, as well for chrome-driver.
Conclusion
I'm just baffled why it fails at that specific point on CI, but not locally. Our other tests do succeed, so it's not like our .env files are setup incorrectly.
Thank you for your time reading this, I sincerely hope that someone can help us figure this out.