2023-06-22 22:09:28 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.describe "Network Disconnected", type: :system do
|
2023-08-28 12:59:22 +08:00
|
|
|
let(:cdp) { PageObjects::CDP.new }
|
2023-06-22 22:09:28 +08:00
|
|
|
|
|
|
|
it "NetworkConnectivity service adds class to DOM and displays offline indicator" do
|
2024-07-31 11:04:05 +08:00
|
|
|
skip_on_ci!(<<~TEXT)
|
2023-08-28 12:59:22 +08:00
|
|
|
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 22:09:28 +08:00
|
|
|
|
2023-08-28 12:59:22 +08:00
|
|
|
SiteSetting.enable_offline_indicator = true
|
2023-06-22 22:09:28 +08:00
|
|
|
|
2023-08-28 12:59:22 +08:00
|
|
|
visit("/c")
|
2023-06-22 22:09:28 +08:00
|
|
|
|
2023-08-28 12:59:22 +08:00
|
|
|
expect(page).to have_no_css("html.network-disconnected")
|
|
|
|
expect(page).to have_no_css(".offline-indicator")
|
2023-06-22 22:09:28 +08:00
|
|
|
|
2023-08-28 12:59:22 +08: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-15 01:24:16 +08:00
|
|
|
|
2023-08-28 12:59:22 +08:00
|
|
|
# Offline indicator is rendered
|
|
|
|
expect(page).to have_css(".offline-indicator")
|
|
|
|
end
|
2023-06-22 22:09:28 +08:00
|
|
|
end
|
|
|
|
end
|