summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-10-20 18:53:42 +0000
committerRémy Coutable <remy@rymai.me>2017-10-20 18:53:42 +0000
commitcc8af554fdfa6d54315ae50465c42603a44780b1 (patch)
tree090fc17687c84cf655dc4737ae885cc5f45d7d26 /doc
parent82397f386a443ae19b7fdd7dcf4dacadbc3f93a5 (diff)
parent43377979c6cfee922702a5dc6324fded96b1f111 (diff)
downloadgitlab-ce-cc8af554fdfa6d54315ae50465c42603a44780b1.tar.gz
Merge branch 'feature/reliable-rspec-with-eval-script' into 'master'
Check for element before execute_script See merge request gitlab-org/gitlab-ce!14898
Diffstat (limited to 'doc')
-rw-r--r--doc/development/testing_guide/best_practices.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md
index 613423dbd9a..7ddd02e6c73 100644
--- a/doc/development/testing_guide/best_practices.md
+++ b/doc/development/testing_guide/best_practices.md
@@ -35,6 +35,8 @@ Here are some things to keep in mind regarding test performance:
[Gotchas](../gotchas.md#dont-assert-against-the-absolute-value-of-a-sequence-generated-attribute)).
- Don't supply the `:each` argument to hooks since it's the default.
- On `before` and `after` hooks, prefer it scoped to `:context` over `:all`
+- When using `evaluate_script("$('.js-foo').testSomething()")` (or `execute_script`) which acts on a given element,
+ use a Capyabara matcher beforehand (e.g. `find('.js-foo')`) to ensure the element actually exists.
[four-phase-test]: https://robots.thoughtbot.com/four-phase-test