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
|
2023-08-28 12:59:22 +08: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 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
|