browserctl 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +27 -32
- data/bin/browserctl +146 -108
- data/bin/browserd +9 -3
- data/examples/cloudflare_hitl.rb +5 -5
- data/examples/smoke/params_file.rb +3 -2
- data/examples/smoke/store_fetch.rb +5 -5
- data/examples/test_automation_practices/advanced/ab_testing.rb +38 -0
- data/examples/test_automation_practices/advanced/broken_images.rb +25 -0
- data/examples/test_automation_practices/advanced/file_download.rb +40 -0
- data/examples/test_automation_practices/advanced/iframes.rb +37 -0
- data/examples/test_automation_practices/advanced/shadow_dom.rb +35 -0
- data/examples/test_automation_practices/auth/login.rb +34 -0
- data/examples/test_automation_practices/auth/login_negative.rb +28 -0
- data/examples/test_automation_practices/dialogs/alerts.rb +45 -0
- data/examples/test_automation_practices/dialogs/notifications.rb +57 -0
- data/examples/test_automation_practices/dynamic/dynamic_elements.rb +41 -0
- data/examples/test_automation_practices/dynamic/tables.rb +47 -0
- data/examples/test_automation_practices/forms/checkboxes.rb +39 -0
- data/examples/test_automation_practices/forms/file_upload.rb +30 -0
- data/examples/test_automation_practices/forms/forms.rb +47 -0
- data/examples/test_automation_practices/forms/slider.rb +51 -0
- data/examples/test_automation_practices/interactions/context_menu.rb +54 -0
- data/examples/test_automation_practices/interactions/drag_drop.rb +41 -0
- data/examples/test_automation_practices/interactions/exit_intent.rb +47 -0
- data/examples/test_automation_practices/interactions/hover.rb +30 -0
- data/examples/test_automation_practices/interactions/key_press.rb +38 -0
- data/examples/the_internet/add_remove_elements.rb +1 -1
- data/examples/the_internet/checkboxes.rb +1 -1
- data/examples/the_internet/dropdown.rb +1 -1
- data/examples/the_internet/dynamic_loading.rb +2 -2
- data/examples/the_internet/login.rb +1 -1
- data/lib/browserctl/client.rb +143 -28
- data/lib/browserctl/commands/ask.rb +20 -0
- data/lib/browserctl/commands/cookie.rb +59 -0
- data/lib/browserctl/commands/daemon.rb +77 -0
- data/lib/browserctl/commands/dialog.rb +33 -0
- data/lib/browserctl/commands/page.rb +47 -0
- data/lib/browserctl/commands/record.rb +1 -1
- data/lib/browserctl/commands/screenshot.rb +2 -2
- data/lib/browserctl/commands/session.rb +69 -0
- data/lib/browserctl/commands/snapshot.rb +2 -2
- data/lib/browserctl/commands/storage.rb +67 -0
- data/lib/browserctl/commands/workflow.rb +64 -0
- data/lib/browserctl/constants.rb +20 -1
- data/lib/browserctl/logger.rb +4 -4
- data/lib/browserctl/recording.rb +4 -4
- data/lib/browserctl/server/command_dispatcher.rb +30 -9
- data/lib/browserctl/server/handlers/cookies.rb +1 -1
- data/lib/browserctl/server/handlers/devtools.rb +1 -1
- data/lib/browserctl/server/handlers/hitl.rb +2 -1
- data/lib/browserctl/server/handlers/interaction.rb +87 -0
- data/lib/browserctl/server/handlers/navigation.rb +24 -2
- data/lib/browserctl/server/handlers/observation.rb +0 -26
- data/lib/browserctl/server/handlers/page_lifecycle.rb +14 -3
- data/lib/browserctl/server/handlers/session.rb +93 -0
- data/lib/browserctl/server/handlers/storage.rb +109 -0
- data/lib/browserctl/server.rb +2 -2
- data/lib/browserctl/session.rb +79 -0
- data/lib/browserctl/version.rb +1 -1
- data/lib/browserctl/workflow.rb +50 -11
- metadata +36 -11
- data/lib/browserctl/commands/export_cookies.rb +0 -18
- data/lib/browserctl/commands/import_cookies.rb +0 -23
- data/lib/browserctl/commands/inspect.rb +0 -21
- data/lib/browserctl/commands/open_page.rb +0 -21
- data/lib/browserctl/commands/pause.rb +0 -22
- data/lib/browserctl/commands/status.rb +0 -30
- data/lib/browserctl/commands/watch.rb +0 -27
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "json"
|
|
4
|
-
|
|
5
|
-
module Browserctl
|
|
6
|
-
module Commands
|
|
7
|
-
module Status
|
|
8
|
-
def self.run(client)
|
|
9
|
-
ping = client.ping
|
|
10
|
-
pages = client.list_pages[:pages] || []
|
|
11
|
-
page_info = pages.map do |name|
|
|
12
|
-
url_res = client.url(name)
|
|
13
|
-
{ name: name, url: url_res[:url] || url_res[:error] }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
puts JSON.pretty_generate(
|
|
17
|
-
daemon: "online",
|
|
18
|
-
pid: ping[:pid],
|
|
19
|
-
protocol_version: ping[:protocol_version],
|
|
20
|
-
pages: page_info
|
|
21
|
-
)
|
|
22
|
-
rescue RuntimeError => e
|
|
23
|
-
raise unless e.message.include?("browserd is not running")
|
|
24
|
-
|
|
25
|
-
puts JSON.pretty_generate(daemon: "offline", error: e.message)
|
|
26
|
-
exit 1
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "optimist"
|
|
4
|
-
require_relative "cli_output"
|
|
5
|
-
|
|
6
|
-
module Browserctl
|
|
7
|
-
module Commands
|
|
8
|
-
class Watch
|
|
9
|
-
extend CliOutput
|
|
10
|
-
|
|
11
|
-
def self.run(client, args)
|
|
12
|
-
opts = Optimist.options(args) do
|
|
13
|
-
banner "Usage: browserctl watch <page> <selector> [--timeout N]"
|
|
14
|
-
opt :timeout, "Seconds to wait (default: 30)", default: 30.0, short: "-t"
|
|
15
|
-
end
|
|
16
|
-
name = args.shift
|
|
17
|
-
selector = args.shift
|
|
18
|
-
abort "usage: browserctl watch <page> <selector> [--timeout N]" unless name && selector
|
|
19
|
-
unless opts[:timeout].positive?
|
|
20
|
-
warn "Error: --timeout must be a positive number"
|
|
21
|
-
exit 1
|
|
22
|
-
end
|
|
23
|
-
print_result(client.watch(name, selector, timeout: opts[:timeout]))
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|