diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-11-02 14:58:54 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-11-02 14:58:54 +0300 |
commit | 4d6830ec50ef1165324ced8ad70f01eb38d7aa76 (patch) | |
tree | 31bf5e7736e96295795703d30cd0777d5afbc9bc /doc/development/testing_guide/best_practices.md | |
parent | 95f9f05378cf0e92fb3d3b67a217f8de8cde9227 (diff) | |
parent | 0364e074479ac8204365fa6b6109011042431575 (diff) |
Merge branch 'patch-28' into 'master'
Add debugging section to testing_guide/best_practices.md.
See merge request gitlab-org/gitlab-ce!14858
Diffstat (limited to 'doc/development/testing_guide/best_practices.md')
-rw-r--r-- | doc/development/testing_guide/best_practices.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index 7ddd02e6c73..8b7b015427f 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -60,6 +60,35 @@ writing one](testing_levels.md#consider-not-writing-a-system-test)! - It's ok to look for DOM elements but don't abuse it since it makes the tests more brittle +#### Debugging Capybara + +Sometimes you may need to debug Capybara tests by observing browser behavior. + +You can pause Capybara and view the website on the browser by using the +`live_debug` method in your spec. The current page will be automatically opened +in your default browser. +You may need to sign in first (the current user's credentials are displayed in +the terminal). + +To resume the test run, press any key. + +For example: + +``` +$ bin/rspec spec/features/auto_deploy_spec.rb:34 +Running via Spring preloader in process 8999 +Run options: include {:locations=>{"./spec/features/auto_deploy_spec.rb"=>[34]}} + +Current example is paused for live debugging +The current user credentials are: user2 / 12345678 +Press any key to resume the execution of the example! +Back to the example! +. + +Finished in 34.51 seconds (files took 0.76702 seconds to load) +1 example, 0 failures +``` + ### `let` variables GitLab's RSpec suite has made extensive use of `let` variables to reduce |