Skip to content

Commit 1e2b8d6

Browse files
authored
[js] Fix running the casting related methods in chromium (#13479)
Casting methods call "this.schedule", but it does not exist in the class. Updating the methods to actually execute the commands.
1 parent f9ff9b3 commit 1e2b8d6

File tree

2 files changed

+61
-18
lines changed

2 files changed

+61
-18
lines changed

javascript/node/selenium-webdriver/chromium.js

+12-18
Original file line numberDiff line numberDiff line change
@@ -835,9 +835,8 @@ class Driver extends webdriver.WebDriver {
835835
* containing the friendly device names of available cast sink targets.
836836
*/
837837
getCastSinks() {
838-
return this.schedule(
839-
new command.Command(Command.GET_CAST_SINKS),
840-
'Driver.getCastSinks()'
838+
return this.execute(
839+
new command.Command(Command.GET_CAST_SINKS)
841840
)
842841
}
843842

@@ -849,12 +848,11 @@ class Driver extends webdriver.WebDriver {
849848
* when the target device has been selected to respond further webdriver commands.
850849
*/
851850
setCastSinkToUse(deviceName) {
852-
return this.schedule(
851+
return this.execute(
853852
new command.Command(Command.SET_CAST_SINK_TO_USE).setParameter(
854853
'sinkName',
855854
deviceName
856-
),
857-
'Driver.setCastSinkToUse(' + deviceName + ')'
855+
)
858856
)
859857
}
860858

@@ -866,12 +864,11 @@ class Driver extends webdriver.WebDriver {
866864
* when the mirror command has been issued to the device.
867865
*/
868866
startDesktopMirroring(deviceName) {
869-
return this.schedule(
867+
return this.execute(
870868
new command.Command(Command.START_CAST_DESKTOP_MIRRORING).setParameter(
871869
'sinkName',
872870
deviceName
873-
),
874-
'Driver.startDesktopMirroring(' + deviceName + ')'
871+
)
875872
)
876873
}
877874

@@ -883,12 +880,11 @@ class Driver extends webdriver.WebDriver {
883880
* when the mirror command has been issued to the device.
884881
*/
885882
startCastTabMirroring(deviceName) {
886-
return this.schedule(
883+
return this.execute(
887884
new command.Command(Command.START_CAST_TAB_MIRRORING).setParameter(
888885
'sinkName',
889886
deviceName
890-
),
891-
'Driver.startCastTabMirroring(' + deviceName + ')'
887+
)
892888
)
893889
}
894890

@@ -898,9 +894,8 @@ class Driver extends webdriver.WebDriver {
898894
* when the mirror command has been issued to the device.
899895
*/
900896
getCastIssueMessage() {
901-
return this.schedule(
902-
new command.Command(Command.GET_CAST_ISSUE_MESSAGE),
903-
'Driver.getCastIssueMessage()'
897+
return this.execute(
898+
new command.Command(Command.GET_CAST_ISSUE_MESSAGE)
904899
)
905900
}
906901

@@ -912,12 +907,11 @@ class Driver extends webdriver.WebDriver {
912907
* when the stop command has been issued to the device.
913908
*/
914909
stopCasting(deviceName) {
915-
return this.schedule(
910+
return this.execute(
916911
new command.Command(Command.STOP_CASTING).setParameter(
917912
'sinkName',
918913
deviceName
919-
),
920-
'Driver.stopCasting(' + deviceName + ')'
914+
)
921915
)
922916
}
923917
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
'use strict'
19+
20+
const assert = require('assert')
21+
const chrome = require('../../chrome')
22+
const test = require('../../lib/test')
23+
const { ignore } = require('../../lib/test')
24+
const { Browser } = require('../../index')
25+
26+
test.suite(
27+
function (env) {
28+
let driver
29+
30+
beforeEach(async function () {
31+
driver = await env
32+
.builder()
33+
.build()
34+
})
35+
afterEach(async () => await driver.quit())
36+
describe('can cast to devices', () => {
37+
it(
38+
'get sinks returns a list of devices',
39+
async function () {
40+
41+
// Just testing if we can set get cast sink command.
42+
// Testing this is tough because we need a device to cast to for the test.
43+
const castSinks = await driver.getCastSinks()
44+
}
45+
)
46+
})
47+
},
48+
{ browsers: ['chrome'] }
49+
)

0 commit comments

Comments
 (0)