Skip to content

Commit a18c26c

Browse files
committed
Add all special features examples for edge using ruby
1 parent f50ca21 commit a18c26c

File tree

5 files changed

+62
-16
lines changed

5 files changed

+62
-16
lines changed

examples/ruby/spec/browsers/edge_spec.rb

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,57 @@
113113
end
114114
end
115115

116+
describe 'Special Features' do
117+
it 'casts' do
118+
@driver = Selenium::WebDriver.for :edge
119+
sinks = @driver.cast_sinks
120+
unless sinks.empty?
121+
device_name = sinks.first['name']
122+
@driver.start_cast_tab_mirroring(device_name)
123+
expect { @driver.stop_casting(device_name) }.not_to raise_exception
124+
end
125+
end
126+
127+
it 'gets and sets network conditions' do
128+
@driver = Selenium::WebDriver.for :edge
129+
@driver.network_conditions = {offline: false, latency: 100, throughput: 200}
130+
expect(@driver.network_conditions).to eq(
131+
'offline' => false,
132+
'latency' => 100,
133+
'download_throughput' => 200,
134+
'upload_throughput' => 200)
135+
end
136+
137+
it 'gets the browser logs' do
138+
@driver = Selenium::WebDriver.for :edge
139+
@driver.navigate.to 'https://www.selenium.dev/selenium/web/'
140+
sleep 1
141+
logs = @driver.logs.get(:browser)
142+
143+
expect(logs.first.message).to include 'Failed to load resource'
144+
end
145+
146+
it 'sets permissions' do
147+
@driver = Selenium::WebDriver.for :edge
148+
@driver.navigate.to 'https://www.selenium.dev/selenium/web/'
149+
@driver.add_permission('camera', 'denied')
150+
@driver.add_permissions('clipboard-read' => 'denied', 'clipboard-write' => 'prompt')
151+
expect(permission('camera')).to eq('denied')
152+
expect(permission('clipboard-read')).to eq('denied')
153+
expect(permission('clipboard-write')).to eq('prompt')
154+
end
155+
end
156+
116157
def driver_finder
117158
options = Selenium::WebDriver::Options.edge(browser_version: 'stable')
118159
service = Selenium::WebDriver::Service.edge
119160
finder = Selenium::WebDriver::DriverFinder.new(options, service)
120161
ENV['EDGEDRIVER_BIN'] = finder.driver_path
121162
ENV['EDGE_BIN'] = finder.browser_path
122163
end
164+
165+
def permission(name)
166+
@driver.execute_async_script('callback = arguments[arguments.length - 1];' \
167+
'callback(navigator.permissions.query({name: arguments[0]}));', name)['state']
168+
end
123169
end

website_and_docs/content/documentation/webdriver/browsers/edge.en.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
380380
{{< badge-code >}}
381381
{{< /tab >}}
382382
{{< tab header="Ruby" >}}
383-
{{< badge-code >}}
383+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L119-L123" >}}
384384
{{< /tab >}}
385385
{{< tab header="JavaScript" >}}
386386
{{< badge-code >}}
@@ -405,7 +405,7 @@ You can simulate various network conditions.
405405
{{< badge-code >}}
406406
{{< /tab >}}
407407
{{< tab header="Ruby" >}}
408-
{{< badge-code >}}
408+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L129" >}}
409409
{{< /tab >}}
410410
{{< tab header="JavaScript" >}}
411411
{{< badge-code >}}
@@ -428,7 +428,7 @@ You can simulate various network conditions.
428428
{{< badge-code >}}
429429
{{< /tab >}}
430430
{{< tab header="Ruby" >}}
431-
{{< badge-code >}}
431+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L141" >}}
432432
{{< /tab >}}
433433
{{< tab header="JavaScript" >}}
434434
{{< badge-code >}}
@@ -451,7 +451,7 @@ You can simulate various network conditions.
451451
{{< badge-code >}}
452452
{{< /tab >}}
453453
{{< tab header="Ruby" >}}
454-
{{< badge-code >}}
454+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L149-L150" >}}
455455
{{< /tab >}}
456456
{{< tab header="JavaScript" >}}
457457
{{< badge-code >}}

website_and_docs/content/documentation/webdriver/browsers/edge.ja.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
382382
{{< badge-code >}}
383383
{{< /tab >}}
384384
{{< tab header="Ruby" >}}
385-
{{< badge-code >}}
385+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L119-L123" >}}
386386
{{< /tab >}}
387387
{{< tab header="JavaScript" >}}
388388
{{< badge-code >}}
@@ -407,7 +407,7 @@ You can simulate various network conditions.
407407
{{< badge-code >}}
408408
{{< /tab >}}
409409
{{< tab header="Ruby" >}}
410-
{{< badge-code >}}
410+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L129" >}}
411411
{{< /tab >}}
412412
{{< tab header="JavaScript" >}}
413413
{{< badge-code >}}
@@ -430,7 +430,7 @@ You can simulate various network conditions.
430430
{{< badge-code >}}
431431
{{< /tab >}}
432432
{{< tab header="Ruby" >}}
433-
{{< badge-code >}}
433+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L141" >}}
434434
{{< /tab >}}
435435
{{< tab header="JavaScript" >}}
436436
{{< badge-code >}}
@@ -453,7 +453,7 @@ You can simulate various network conditions.
453453
{{< badge-code >}}
454454
{{< /tab >}}
455455
{{< tab header="Ruby" >}}
456-
{{< badge-code >}}
456+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L149-L150" >}}
457457
{{< /tab >}}
458458
{{< tab header="JavaScript" >}}
459459
{{< badge-code >}}

website_and_docs/content/documentation/webdriver/browsers/edge.pt-br.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
382382
{{< badge-code >}}
383383
{{< /tab >}}
384384
{{< tab header="Ruby" >}}
385-
{{< badge-code >}}
385+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L119-L123" >}}
386386
{{< /tab >}}
387387
{{< tab header="JavaScript" >}}
388388
{{< badge-code >}}
@@ -407,7 +407,7 @@ You can simulate various network conditions.
407407
{{< badge-code >}}
408408
{{< /tab >}}
409409
{{< tab header="Ruby" >}}
410-
{{< badge-code >}}
410+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L129" >}}
411411
{{< /tab >}}
412412
{{< tab header="JavaScript" >}}
413413
{{< badge-code >}}
@@ -430,7 +430,7 @@ You can simulate various network conditions.
430430
{{< badge-code >}}
431431
{{< /tab >}}
432432
{{< tab header="Ruby" >}}
433-
{{< badge-code >}}
433+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L141" >}}
434434
{{< /tab >}}
435435
{{< tab header="JavaScript" >}}
436436
{{< badge-code >}}
@@ -453,7 +453,7 @@ You can simulate various network conditions.
453453
{{< badge-code >}}
454454
{{< /tab >}}
455455
{{< tab header="Ruby" >}}
456-
{{< badge-code >}}
456+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L149-L150" >}}
457457
{{< /tab >}}
458458
{{< tab header="JavaScript" >}}
459459
{{< badge-code >}}

website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
382382
{{< badge-code >}}
383383
{{< /tab >}}
384384
{{< tab header="Ruby" >}}
385-
{{< badge-code >}}
385+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L119-L123" >}}
386386
{{< /tab >}}
387387
{{< tab header="JavaScript" >}}
388388
{{< badge-code >}}
@@ -407,7 +407,7 @@ You can simulate various network conditions.
407407
{{< badge-code >}}
408408
{{< /tab >}}
409409
{{< tab header="Ruby" >}}
410-
{{< badge-code >}}
410+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L129" >}}
411411
{{< /tab >}}
412412
{{< tab header="JavaScript" >}}
413413
{{< badge-code >}}
@@ -430,7 +430,7 @@ You can simulate various network conditions.
430430
{{< badge-code >}}
431431
{{< /tab >}}
432432
{{< tab header="Ruby" >}}
433-
{{< badge-code >}}
433+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L141" >}}
434434
{{< /tab >}}
435435
{{< tab header="JavaScript" >}}
436436
{{< badge-code >}}
@@ -453,7 +453,7 @@ You can simulate various network conditions.
453453
{{< badge-code >}}
454454
{{< /tab >}}
455455
{{< tab header="Ruby" >}}
456-
{{< badge-code >}}
456+
{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L149-L150" >}}
457457
{{< /tab >}}
458458
{{< tab header="JavaScript" >}}
459459
{{< badge-code >}}

0 commit comments

Comments
 (0)