1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00
Commit graph

10 commits

Author SHA1 Message Date
Thomas Walpole
8350c78823 Just use a negative index 2022-06-17 17:04:37 -07:00
alex-konoval
346d7db032 Fix wrong counter behavior with changed uri 2022-06-16 18:21:40 +03:00
Blake Williams
772ddc831c Fix middleware request uri race condition
When writing a new Rails system test I ran into an issue where the
browser would hang and not close, eventually failing the test due to
pending requests. There were no clear pending requests and the requests
mentioned were AJAX calls that should have been made several pages ago.

I believe the cause is an AJAX call being cancelled almost immediately
after it was initiated, but I'm not 100% positive.

Code wise, it looks like the value of `env['REQUEST_URI']` that
increments the counter is different from the `env['REQUEST_URI']` that's
decremented in the `ensure` block.

This resolves the issue by storing the `env['REQUEST_URI']` value in a
variable so it will be consistent between counter calls.
2020-08-06 23:04:17 -04:00
Thomas Walpole
6b2d6a1012 Dup array to prevent race conditions 2019-10-07 17:34:17 -07:00
Juan Carlos Medina
009320d3bf Display pending requests (#2250)
* Backfill tests on pending requests behavior

* Implement parameterized wait time for wait_for_oending_requests

At some point, this might be worth being a top-level configuration.

* Re-implement counter mutex with a list of pending request envs

Set up for exposing more information to developers about pending requests.

* Expose pending requests in error message

This provides a bit more information to other developers about the state of their tests. Whether we include further information would require more feedback from other developers and how the community use the error message for debugging.

* Add safe fallback value to avoid passing `nil`

* Use a memory barrier on read operations for array

* Only store REQUEST_URI instead of env

* Revert back to fixed wait_time (60)

Keeping initial PR tidy and focused.

* Remove redundant attr reader

We already defined a getter for the value to ensure proper concurrent accessing.

* Ruby linter: single-line body for modifier if usage

* Ruby linter: single quotes
2019-10-07 17:26:48 -07:00
Thomas Walpole
0873c9052d Update standard rescued variable names 2019-04-04 17:42:10 -07:00
Thomas Walpole
744e9907a7 Code cleanup 2018-08-22 15:15:48 -07:00
Thomas Walpole
2f8f15e11e minor cleanup/improve some variable names 2018-08-21 10:21:24 -07:00
Thomas Walpole
e320f5d7fc style updates 2018-07-16 15:04:52 -07:00
Thomas Walpole
e8b49b6eed Disable animation on pages 2018-06-01 10:35:43 -07:00