DEV: introduces `pause_test` system tests helper (#19378)

This helper is intended only for dev purposes. It allows you to pause a test while still being able to interact with the browser.

Usage:

```
it "works" do
  visit("/")
  pause_test
  expect(page).to have_css(".foo")
end
```
This commit is contained in:
Joffrey JAFFEUX 2022-12-08 13:03:18 +01:00 committed by GitHub
parent 22cae0022a
commit ae40965896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,16 @@
# frozen_string_literal: true
require "highline/import"
module SystemHelpers
def pause_test
result =
ask(
"\n\e[33mTest paused, press enter to resume, type `d` and press enter to start debugger.\e[0m",
)
byebug if result == "d" # rubocop:disable Lint/Debugger
self
end
def sign_in(user)
visit "/session/#{user.encoded_username}/become"
end