2023-06-22 09:09:28 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.describe "Network Disconnected", type: :system do
|
2023-08-27 23:59:22 -05:00
|
|
|
let(:cdp) { PageObjects::CDP.new }
|
2023-06-22 09:09:28 -05:00
|
|
|
|
|
|
|
it "NetworkConnectivity service adds class to DOM and displays offline indicator" do
|
2023-08-27 23:59:22 -05:00
|
|
|
skip(<<~TEXT) if ENV["CI"]
|
|
|
|
In CI this test will randomly flake - timing issue with the offline indicator
|
|
|
|
not being rendered soon enough after network conditions change
|
|
|
|
TEXT
|
2023-06-22 09:09:28 -05:00
|
|
|
|
2023-08-27 23:59:22 -05:00
|
|
|
SiteSetting.enable_offline_indicator = true
|
2023-06-22 09:09:28 -05:00
|
|
|
|
2023-08-27 23:59:22 -05:00
|
|
|
visit("/c")
|
2023-06-22 09:09:28 -05:00
|
|
|
|
2023-08-27 23:59:22 -05:00
|
|
|
expect(page).to have_no_css("html.network-disconnected")
|
|
|
|
expect(page).to have_no_css(".offline-indicator")
|
2023-06-22 09:09:28 -05:00
|
|
|
|
2023-08-27 23:59:22 -05:00
|
|
|
cdp.with_network_disconnected do
|
|
|
|
# Message bus connectivity services adds the disconnected class to the DOM
|
|
|
|
expect(page).to have_css("html.network-disconnected")
|
2023-08-14 12:24:16 -05:00
|
|
|
|
2023-08-27 23:59:22 -05:00
|
|
|
# Offline indicator is rendered
|
|
|
|
expect(page).to have_css(".offline-indicator")
|
|
|
|
end
|
2023-06-22 09:09:28 -05:00
|
|
|
end
|
|
|
|
end
|