module Turbo::SystemTestHelper
def assert_no_turbo_cable_stream_source(...)
In addition to the filters listed above, accepts any valid Capybara global
argument to Turbo::Streams::StreamName#signed_stream_name.
attribute. Can be of any type that is a valid
* :signed_stream_name matches the element's `[signed-stream-name]`
String, Symbol, or Regexp
* :channel matches the `[channel]` attribute. Can be a Class,
* :connected matches the `[connected]` attribute
==== Options
argument to Turbo::Streams::StreamName#signed_stream_name.
`[signed-stream-name]` attribute. Can be of any type that is a valid
* locator optional locator to determine the element's
==== Arguments
document
Asserts that a `
def assert_no_turbo_cable_stream_source(...) assert_no_selector(:turbo_cable_stream_source, ...) end
def assert_turbo_cable_stream_source(...)
In addition to the filters listed above, accepts any valid Capybara global
argument to Turbo::Streams::StreamName#signed_stream_name.
attribute. Can be of any type that is a valid
* :signed_stream_name matches the element's `[signed-stream-name]`
String, Symbol, or Regexp
* :channel matches the `[channel]` attribute. Can be a Class,
* :connected matches the `[connected]` attribute
==== Options
argument to Turbo::Streams::StreamName#signed_stream_name.
`[signed-stream-name]` attribute. Can be of any type that is a valid
* locator optional locator to determine the element's
==== Arguments
document
Asserts that a `
def assert_turbo_cable_stream_source(...) assert_selector(:turbo_cable_stream_source, ...) end
def connect_turbo_cable_stream_sources(**options, &block)
config.turbo.test_connect_after_actions = []
# config/environments/test.rb
To disable automatic connecting, set the configuration to `[]`:
config.turbo.test_connect_after_actions << :click_link
# config/environments/test.rb
`#click_link`, add the following to `config/environments/test.rb`:
`config.turbo.test_connect_after_actions`. For example, to wait after calls to
elements to connect. You can control this by modifying the
By default, calls to `#visit` will wait for all `
end
assert_text message.content
message.save! # execute server-side code to broadcast a Message
click_link "All Messages"
visit "/"
message = Message.new content: "Hello, from Action Cable"
test "renders broadcasted Messages" do
is ready to receive broadcasts
Delay until every `
def connect_turbo_cable_stream_sources(**options, &block) all(:turbo_cable_stream_source, **options, connected: false, wait: 0).each do |element| element.assert_matches_selector(:turbo_cable_stream_source, **options, connected: true, &block) end end