discourse/spec/system/network_disconnected_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.2 KiB
Ruby
Raw Normal View History

2023-06-05 12:08:04 -04:00
# frozen_string_literal: true
RSpec.describe "Network Disconnected", type: :system, js: true do
fab!(:current_user) { Fabricate(:user) }
def with_network_disconnected
page.driver.browser.network_conditions = { offline: true }
yield
page.driver.browser.network_conditions = { offline: false }
end
DEV: Skip flaky system test (#21941) Failure message on CI ``` Failures: 1) Network Disconnected Doesn't show the offline indicator when the site setting isn't present Failure/Error: expect(page).to have_css("html.message-bus-offline") expected to find css "html.message-bus-offline" but there were no matches [Screenshot Image]: /__w/discourse/discourse/tmp/capybara/failures_r_spec_example_groups_network_disconnected_doesn_t_show_the_offline_indicator_when_the_site_setting_isn_t_present_764.png ~~~~~~~ JS LOGS ~~~~~~~ http://localhost:31338/uploads/default/test_0/optimized/1X/_129430568242d1b7f853bb13ebea28b3f6af4e7_2_512x512.png - Failed to load resource: net::ERR_INTERNET_DISCONNECTED http://localhost:31338/categories - Error while trying to use the following icon from the Manifest: http://localhost:31338/uploads/default/test_0/optimized/1X/_129430568242d1b7f853bb13ebea28b3f6af4e7_2_512x512.png (Download error or resource isn't a valid image) ~~~~~ END JS LOGS ~~~~~ # ./spec/system/network_disconnected_spec.rb:35:in `block (3 levels) in <main>' # ./spec/system/network_disconnected_spec.rb:8:in `with_network_disconnected' # ./spec/system/network_disconnected_spec.rb:34:in `block (2 levels) in <main>' # ./spec/rails_helper.rb:380:in `block (3 levels) in <top (required)>' # ./spec/rails_helper.rb:380:in `block (2 levels) in <top (required)>' # ./spec/rails_helper.rb:372:in `block (3 levels) in <top (required)>' # ./vendor/bundle/ruby/3.2.0/gems/timeout-0.3.2/lib/timeout.rb:189:in `block in timeout' # ./vendor/bundle/ruby/3.2.0/gems/timeout-0.3.2/lib/timeout.rb:196:in `timeout' # ./spec/rails_helper.rb:367:in `block (2 levels) in <top (required)>' # ./spec/rails_helper.rb:356:in `block (2 levels) in <top (required)>' # ./vendor/bundle/ruby/3.2.0/gems/webmock-3.18.1/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>' ```
2023-06-05 20:50:32 -04:00
xit "Message bus connectivity service adds class to DOM and displays offline indicator" do
2023-06-05 12:08:04 -04:00
SiteSetting.enable_offline_indicator = true
visit("/c")
expect(page).to have_no_css("html.message-bus-offline")
expect(page).to have_no_css(".offline-indicator")
with_network_disconnected do
# Message bus connectivity services adds the disconnected class to the DOM
expect(page).to have_css("html.message-bus-offline")
# Offline indicator is rendered
expect(page).to have_css(".offline-indicator")
end
end
it "Doesn't show the offline indicator when the site setting isn't present" do
SiteSetting.enable_offline_indicator = false
visit("/c")
with_network_disconnected do
expect(page).to have_css("html.message-bus-offline")
expect(page).not_to have_css(".offline-indicator")
end
end
end