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

31 commits

Author SHA1 Message Date
Thomas Walpole
54fa362ee2 minor style fix 2022-07-29 14:12:44 -07:00
Daniel Sheppard
8b04019512 Make animation disabler threadsafe
Animation Disabler is installed as a rack middleware - it will be
instantiated once and the call method will be called by multiple
requests.

The code was using instance variables on the middleware for information
about individual requests. When multiple requests were made at the same
time, the subsequent request would replace the status/headers/body of
the original request, causing the original request to return the
response of the subsequent request.
2022-07-12 11:32:43 +10:00
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
Thomas Walpole
70ab439726 Minor code cleanup 2022-04-30 17:02:14 -07:00
Thomas Walpole
71770a1b81 Insert nonces in animation disabler if available 2022-04-30 16:21:07 -07:00
Javi Martín
cad1efc952 Fix invalid HTML generated by AnimationDisabler
The W3C Validator was reporting an error:

> Element style not allowed as child of element body in this context.
>
> Contexts in which element style may be used:
>     Where metadata content is expected.
>     In a noscript element that is a child of a head element.
> Content model for element body:
>     Flow content.

It looks like there can't be any <style> tags inside the <body> element
[1].

The <script> part of the markup template remains at the end of the
<body> element because it only makes sense if jQuery has already been
defined, and jQuery could be defined anywhere inside the <head> or
<body> elements.

[1] https://html.spec.whatwg.org/multipage/semantics.html#the-style-element
2021-09-26 15:54:25 +02:00
michaelhwang
6b5476cc5b insert disable template at the end of body and remove script defer 2021-01-23 17:03:24 +08:00
Dale Morgan
849ec3f26c Wrapping injected disable_animation script in CDATA to prevent XHTML/XML parser errors 2020-12-02 10:59:56 +00:00
Nathan Broadbent
7be5795001 Add "scroll-behavior: auto;" CSS to Capybara::Server::AnimationDisabler to disable scroll animation 2020-10-01 00:23:38 +08:00
Thomas Walpole
f59df7ed86 Style updates 2020-09-05 12:24:43 -07: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
1410793107 Fix low hanging fruit for Ruby 2.7 keyword warnings 2019-11-29 09:47:28 -08: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
Daniel Heath
18d8e26fd8 Disable animations on pseudoelement content as well as regular elements 2019-06-19 13:14:04 +10:00
Thomas Walpole
320ee96bb8 Minor rubocop changes [ci skip] 2019-05-30 15:07:27 -07:00
Thomas Walpole
60d9f94fcb No need for automatic retries in checker 2019-05-01 11:23:47 -07:00
Thomas Walpole
32297d027c Update to rubocop 0.68 2019-04-29 11:11:01 -07:00
Thomas Walpole
08e0f610ec Prefer match? when match data not needed 2019-04-04 17:42:10 -07:00
Thomas Walpole
0873c9052d Update standard rescued variable names 2019-04-04 17:42:10 -07:00
Thomas Walpole
f6b2f3adf0 Code cleanup and enable line length cop 2018-11-03 13:03:48 -07:00
Thomas Walpole
bf084e379c annotate token 2018-10-11 19:15:47 -07:00
Thomas Walpole
1054005906 Add empty line after guard claues 2018-09-24 09:43:46 -07:00
Thomas Walpole
449f0ae47d Add Errno::ECONNRESET to the errors that trigger https attempt 2018-09-20 08:56:35 -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
Michael Glass
443617a995
Capybara.disable_animations can also accept a CSS selector
If it receives a falsey (false or nil) it won't do anything.
If it receives true, it will disable animations on the '*' css selector
If it receives a string, it will use that string as the css selector

It will still always disable css for jQuery if it's around.
2018-08-20 15:25:53 -07:00
Thomas Walpole
e320f5d7fc style updates 2018-07-16 15:04:52 -07:00
Thomas Walpole
c649295673 Refactor server SSL identification 2018-06-05 19:01:20 -07:00
Thomas Walpole
e8b49b6eed Disable animation on pages 2018-06-01 10:35:43 -07:00