Closed nilesmc closed 2 years ago
I also tried a version of the select override above w an event listener:
// Make Cypress wait for this promise which waits for the turbolinks:load event
return new Cypress.Promise(resolve => {
// Once we receive the event,
const onTurboLoad = () => {
// clean up
$document.removeEventListener('turbo:frame-load', onTurboLoad);
// signal to Cypress that we're done
resolve();
}
// Add our logic as event listener
$document.addEventListener('turbo:frame-load', onTurboLoad);
// Finally, we are ready to perform the actual select operation
originalFn(subject, ...args);
})
Please use discuss.hotwired.dev for usage help ✌️
@dhh - Cool. Done, I think it needs your approval over there: https://discuss.hotwired.dev/t/akismet-has-temporarily-hidden-your-post/4325
Im attempting to do a POC so that we can more widely adopt Turbo across 5 rails app, but Im running into a blocker. I can't seem to get a feature to work in CI.
Im using Turbo an a page w a simple select.
The AC is:
When the user selects a year, the results for the year should appear.
I've got a super simple stimulus controller I added to try to make sure caching is not an issue:
Ive written an overwrite for select to work with Turbo events in Cypresses' command.js.
I am calling the select method in this context:
The test passes 100/100 times locally, but is only sucesful 1/4 - 1/3 runs on Cypress Dashboard...
Giving the following error:
Ive tried just about everyhting I can think of...
Including implementing the test in Rspec / Capybara, but the feature does not work in the same way there as well, the page times out and never refreshes the data it should.
This seems like it should work.
Does anyone have any ideas why this is timing out? Is there something missing my configuration? Is there anyone out there that has had success w e2e / integration tests like this w Turbo?