DEV: Remove the use of Capybara::Session#quit (#24978)

Why this change?

This is what `Capybara::Session#quit` does:

```
    def quit
      @driver.quit if @driver.respond_to? :quit
      @document = @driver = nil
      @touched = false
      @server&.reset_error!
    end
```

One notable thing is that it resets server errors which means that any
server errors encountered by a session is cleared. That is not what we
want since it hides errors even though `Capybara.raise_server_errors`
has been set to `true`.
This commit is contained in:
Alan Guo Xiang Tan
2023-12-20 13:20:14 +08:00
committed by GitHub
parent 043fa28fab
commit 68a3f7783e
12 changed files with 21 additions and 49 deletions

View File

@ -23,12 +23,11 @@ RSpec.describe "Edited message", type: :system do
it "shows as edited for all users" do
chat_page.visit_channel(channel_1)
using_session(:user_1) do |session|
using_session(:user_1) do
sign_in(editing_user)
chat_page.visit_channel(channel_1)
channel_page.edit_message(message_1, "a different message")
expect(page).to have_content(I18n.t("js.chat.edited"))
session.quit
end
expect(page).to have_content(I18n.t("js.chat.edited"))