1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 module FakeWebsocketHelper
6 def use_fake_websocket_driver
7 Capybara.current_driver = :poltergeist_with_fake_websocket
10 def fake_websocket_event(logdata)
11 stamp = Time.now.utc.in_time_zone.as_json
13 owner_uuid: api_fixture('users')['system_user']['uuid'],
18 event = {data: Oj.dump(defaults.merge(logdata), mode: :compat)}
19 script = '$(window).data("arv-websocket").onmessage('+Oj.dump(event, mode: :compat)+');'
20 page.evaluate_script(script)