Skip to content

Commit 15060fb

Browse files
committed
[examples] update Ruby BiDi code
1 parent f068e27 commit 15060fb

File tree

4 files changed

+33
-14
lines changed

4 files changed

+33
-14
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
RSpec.describe 'Logging' do
6+
let(:driver) { start_session }
7+
8+
it 'sets cookie' do
9+
driver.execute_cdp('Network.setCookie',
10+
name: 'cheese',
11+
value: 'gouda',
12+
domain: 'www.selenium.dev',
13+
secure: true)
14+
15+
driver.get('https://www.selenium.dev')
16+
cheese = driver.manage.cookie_named('cheese')
17+
18+
expect(cheese[:value]).to eq 'gouda'
19+
end
20+
end

examples/ruby/spec/bidi/chrome_devtools/network_spec.rb renamed to examples/ruby/spec/bidi/cdp/network_spec.rb

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
driver.get('https://www.selenium.dev/selenium/web/frameset.html')
5555

5656
driver.devtools.performance.enable
57-
5857
metric_list = driver.devtools.performance.get_metrics.dig('result', 'metrics')
5958

6059
metrics = metric_list.each_with_object({}) do |metric, hash|
@@ -65,6 +64,18 @@
6564
expect(metrics['Frames']).to eq 12
6665
end
6766

67+
it 'sets cookie' do
68+
driver.devtools.network.set_cookie(name: 'cheese',
69+
value: 'gouda',
70+
domain: 'www.selenium.dev',
71+
secure: true)
72+
73+
driver.get('https://www.selenium.dev')
74+
cheese = driver.manage.cookie_named('cheese')
75+
76+
expect(cheese[:value]).to eq 'gouda'
77+
end
78+
6879
it 'waits for downloads', except: {platform: :windows} do
6980
driver.get('https://www.selenium.dev/selenium/web/downloads/download.html')
7081

@@ -80,16 +91,4 @@
8091

8192
expect { Selenium::WebDriver::Wait.new.until { @completed } }.not_to raise_exception
8293
end
83-
84-
it 'sets cookie' do
85-
driver.devtools.network.set_cookie(name: 'cheese',
86-
value: 'gouda',
87-
domain: 'www.selenium.dev',
88-
secure: true)
89-
90-
driver.get('https://www.selenium.dev')
91-
cheese = driver.manage.cookie_named('cheese')
92-
93-
expect(cheese[:value]).to eq 'gouda'
94-
end
9594
end

examples/ruby/spec/bidi/chrome_devtools/scripts_spec.rb renamed to examples/ruby/spec/bidi/cdp/script_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require 'spec_helper'
44

5-
RSpec.describe 'Scripts' do
5+
RSpec.describe 'Script' do
66
let(:driver) { start_session }
77

88
it 'pins script' do

0 commit comments

Comments
 (0)