Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js] Fix running the casting related methods in chromium #13479

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions javascript/node/selenium-webdriver/chromium.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,9 +835,8 @@ class Driver extends webdriver.WebDriver {
* containing the friendly device names of available cast sink targets.
*/
getCastSinks() {
return this.schedule(
new command.Command(Command.GET_CAST_SINKS),
'Driver.getCastSinks()'
return this.execute(
new command.Command(Command.GET_CAST_SINKS)
)
}

Expand All @@ -849,12 +848,11 @@ class Driver extends webdriver.WebDriver {
* when the target device has been selected to respond further webdriver commands.
*/
setCastSinkToUse(deviceName) {
return this.schedule(
return this.execute(
new command.Command(Command.SET_CAST_SINK_TO_USE).setParameter(
'sinkName',
deviceName
),
'Driver.setCastSinkToUse(' + deviceName + ')'
)
)
}

Expand All @@ -866,12 +864,11 @@ class Driver extends webdriver.WebDriver {
* when the mirror command has been issued to the device.
*/
startDesktopMirroring(deviceName) {
return this.schedule(
return this.execute(
new command.Command(Command.START_CAST_DESKTOP_MIRRORING).setParameter(
'sinkName',
deviceName
),
'Driver.startDesktopMirroring(' + deviceName + ')'
)
)
}

Expand All @@ -883,12 +880,11 @@ class Driver extends webdriver.WebDriver {
* when the mirror command has been issued to the device.
*/
startCastTabMirroring(deviceName) {
return this.schedule(
return this.execute(
new command.Command(Command.START_CAST_TAB_MIRRORING).setParameter(
'sinkName',
deviceName
),
'Driver.startCastTabMirroring(' + deviceName + ')'
)
)
}

Expand All @@ -898,9 +894,8 @@ class Driver extends webdriver.WebDriver {
* when the mirror command has been issued to the device.
*/
getCastIssueMessage() {
return this.schedule(
new command.Command(Command.GET_CAST_ISSUE_MESSAGE),
'Driver.getCastIssueMessage()'
return this.execute(
new command.Command(Command.GET_CAST_ISSUE_MESSAGE)
)
}

Expand All @@ -912,12 +907,11 @@ class Driver extends webdriver.WebDriver {
* when the stop command has been issued to the device.
*/
stopCasting(deviceName) {
return this.schedule(
return this.execute(
new command.Command(Command.STOP_CASTING).setParameter(
'sinkName',
deviceName
),
'Driver.stopCasting(' + deviceName + ')'
)
)
}
}
Expand Down
49 changes: 49 additions & 0 deletions javascript/node/selenium-webdriver/test/chrome/cast_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

'use strict'

const assert = require('assert')
const chrome = require('../../chrome')
const test = require('../../lib/test')
const { ignore } = require('../../lib/test')
const { Browser } = require('../../index')

test.suite(
function (env) {
let driver

beforeEach(async function () {
driver = await env
.builder()
.build()
})
afterEach(async () => await driver.quit())
describe('can cast to devices', () => {
it(
'get sinks returns a list of devices',
async function () {

// Just testing if we can set get cast sink command.
// Testing this is tough because we need a device to cast to for the test.
const castSinks = await driver.getCastSinks()
}
)
})
},
{ browsers: ['chrome'] }
)