forked from webrtc/samples
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restored by checking out the version from e7c29f6 and then doing a find/cp retaining the folder structure: find . -name 'test.js' -exec cp --parents \{\} /tmp/samples/ \;
- Loading branch information
Showing
14 changed files
with
625 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
export default { | ||
'It should transfer text over data channel': (browser) => { | ||
const path = '/src/content/datachannel/basic/index.html'; | ||
const url = 'file://' + process.cwd() + path; | ||
|
||
browser | ||
.url(url) | ||
.click('#startButton') | ||
.expect.element('#sendButton').to.be.enabled.before(50); | ||
browser.expect.element('#dataChannelSend').to.be.enabled.before(50); | ||
|
||
browser.setValue('#dataChannelSend', 'HELLO, WORLD!'); | ||
browser | ||
.click('#sendButton') | ||
.pause(50) | ||
.assert.value('#dataChannelReceive', 'HELLO, WORLD!'); | ||
|
||
browser | ||
.click('#closeButton') | ||
.expect.element('#sendButton').to.not.be.enabled.before(50); | ||
|
||
browser.end(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
export default { | ||
'It should transfer data over data channel': (browser) => { | ||
const path = '/src/content/datachannel/datatransfer/index.html'; | ||
const url = 'file://' + process.cwd() + path; | ||
|
||
browser | ||
.url(url) | ||
.click('#sendTheData') | ||
.pause(1000) | ||
.assert.value('#receiveProgress', '16777200') | ||
.end(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
|
||
export default { | ||
'It should transfer a file over a datachannel': (browser) => { | ||
const path = '/src/content/datachannel/filetransfer/index.html'; | ||
const url = 'file://' + process.cwd() + path; | ||
|
||
browser | ||
.url(url) | ||
.waitForElementNotVisible('#download', 100, 'File download link is not visible') | ||
.waitForElementVisible('#fileInput', 1000) | ||
.setValue('#fileInput', process.cwd() + '/src/content/devices/multi/images/poster.jpg') | ||
.waitForElementVisible('#download', 10000, 'File download link is visible') | ||
.end(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
export default { | ||
'It should have select elements for each media device': (browser) => { | ||
const path = '/src/content/devices/input-output/index.html'; | ||
const url = 'file://' + process.cwd() + path; | ||
|
||
browser | ||
.url(url) | ||
.waitForElementVisible('#audioSource option:nth-of-type(1)', 1000, 'Check that there is at least one audio source') | ||
.waitForElementVisible('#audioOutput option:nth-of-type(1)', 1000, 'Check that there is at least one audio output') | ||
.waitForElementVisible('#videoSource option:nth-of-type(1)', 1000, 'Check that there is at least one video source') | ||
.end(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
export default { | ||
'It should have a video element': (browser) => { | ||
const path = '/src/content/getusermedia/gum/index.html'; | ||
const url = 'file://' + process.cwd() + path; | ||
|
||
browser | ||
.url(url) | ||
.waitForElementVisible('video', 5000) | ||
.waitForClientConnected('video', 5000) | ||
.end(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
export default { | ||
'It should have a video element with specific width': (browser) => { | ||
const path = '/src/content/getusermedia/resolution/index.html'; | ||
const url = 'file://' + process.cwd() + path; | ||
|
||
browser | ||
.url(url) | ||
.click('button#qvga') | ||
.waitForElementVisible('video', 5000) | ||
.waitForClientConnected('video', 5000) | ||
.assert.videoWidth('video', 320, 'Video width is 320 wide.') | ||
.click('button#vga') | ||
.waitForElementVisible('video', 5000) | ||
.waitForClientConnected('video', 5000) | ||
.assert.videoWidth('video', 640, 'Video width is 640 wide.') | ||
.click('button#hd') | ||
.waitForElementVisible('video', 5000) | ||
.waitForClientConnected('video', 5000) | ||
.assert.videoWidth('video', 1280, 'Video width is 1280 wide.') | ||
.end(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
export default { | ||
'It should play audio remote': (browser) => { | ||
const path = '/src/content/peerconnection/audio/index.html'; | ||
const url = 'file://' + process.cwd() + path; | ||
|
||
// TODO Test all codecs? | ||
browser | ||
.url(url) | ||
.click('#callButton') | ||
.waitForClientConnected('#audio2', 5000, 'Receiving remote audio.') | ||
.end(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
export default { | ||
'It should send DTMF codes': (browser) => { | ||
const path = '/src/content/peerconnection/dtmf/index.html'; | ||
const url = 'file://' + process.cwd() + path; | ||
|
||
// TODO Test all codecs? | ||
browser | ||
.url(url) | ||
.click('#callButton') | ||
.waitForClientConnected('audio', 1000, 'Receiving remote audio.') | ||
.useXpath() | ||
.click('/html/body/div/div[@id=\'dialPad\']/div[1]/button[1]') // 1 | ||
.click('/html/body/div/div[@id=\'dialPad\']/div[3]/button[1]') // 9 | ||
.click('/html/body/div/div[@id=\'dialPad\']/div[3]/button[4]') // # | ||
.click('/html/body/div/div[@id=\'dialPad\']/div[4]/button[1]') // A | ||
.useCss() | ||
.assert.value('input#sentTones', '1 9 # A ') | ||
.click('#hangupButton') | ||
.end(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
/* eslint-env node */ | ||
|
||
'use strict'; | ||
// This is a basic test file for use with testling. | ||
// The test script language comes from tape. | ||
const test = require('tape'); | ||
|
||
const webdriver = require('selenium-webdriver'); | ||
const seleniumHelpers = require('webrtc-utilities').seleniumLib; | ||
|
||
test('PeerConnection multiple sample', t => { | ||
const driver = seleniumHelpers.buildDriver(); | ||
const path = '/src/content/peerconnection/multiple/index.html'; | ||
const url = (process.env.BASEURL ? process.env.BASEURL : ('file://' + process.cwd())) + path; | ||
|
||
driver.get(url) | ||
.then(() => { | ||
t.pass('page loaded'); | ||
return driver.findElement(webdriver.By.id('startButton')).click(); | ||
}) | ||
.then(() => { | ||
t.pass('got media'); | ||
return driver.wait(() => driver.findElement(webdriver.By.id('callButton')).isEnabled()); | ||
}) | ||
.then(() => { | ||
driver.findElement(webdriver.By.id('callButton')).click(); | ||
return driver.wait(() => driver.executeScript( | ||
'return pc1Remote && pc1Remote.iceConnectionState === \'connected\'' + | ||
' && pc2Remote && pc2Remote.iceConnectionState === \'connected\';'), 30 * 1000); | ||
}) | ||
.then(() => { | ||
t.pass('multiple connections connected'); | ||
return driver.findElement(webdriver.By.id('hangupButton')).click(); | ||
}) | ||
.then(() => driver.wait(() => driver.executeScript('return pc1Local === null && ' + | ||
'pc2Local === null'), 30 * 1000)) | ||
.then(() => { | ||
t.pass('hangup'); | ||
t.end(); | ||
}) | ||
.then(null, err => { | ||
t.fail(err); | ||
t.end(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
/* eslint-env node */ | ||
|
||
'use strict'; | ||
// This is a basic test file for use with testling. | ||
// The test script language comes from tape. | ||
const test = require('tape'); | ||
|
||
const webdriver = require('selenium-webdriver'); | ||
const seleniumHelpers = require('webrtc-utilities').seleniumLib; | ||
|
||
test('Munge SDP sample', t => { | ||
const driver = seleniumHelpers.buildDriver(); | ||
const path = '/src/content/peerconnection/munge-sdp/index.html'; | ||
const url = (process.env.BASEURL ? process.env.BASEURL : ('file://' + process.cwd())) + path; | ||
|
||
driver.get(url) | ||
.then(() => { | ||
t.pass('page loaded'); | ||
return driver.findElement(webdriver.By.id('getMedia')).click(); | ||
}) | ||
.then(() => driver.wait(() => driver.executeScript('return typeof window.localStream !== \'undefined\''))) | ||
.then(() => { | ||
t.pass('got media'); | ||
return driver.findElement(webdriver.By.id('createPeerConnection')).click(); | ||
}) | ||
.then(() => { | ||
return driver.wait(webdriver.until.elementIsVisible(driver.findElement(webdriver.By.id('createOffer')))).click(); | ||
}) | ||
.then(() => { | ||
// Need to wait for createOffer to succeed which takes some time | ||
// on travis. | ||
const script = 'return document.querySelector(\'#local>textarea\').value !== \'\''; | ||
return driver.wait(() => driver.executeScript(script)); | ||
}) | ||
.then(() => driver.findElement(webdriver.By.css('#local>textarea')).getAttribute('value')) | ||
.then(value => { | ||
t.ok(value !== '', 'local SDP is shown in textarea'); | ||
return driver.findElement(webdriver.By.id('setOffer')).click(); | ||
}) | ||
.then(() => driver.findElement(webdriver.By.id('createAnswer')).click()) | ||
.then(() => { | ||
// Need to wait for createAnswer to succeed which takes some time | ||
// on travis. | ||
return driver.wait(() => driver.executeScript( | ||
'return document.querySelector(\'#remote>textarea\').value !== \'\'')); | ||
}) | ||
.then(() => driver.findElement(webdriver.By.css('#remote>textarea')) | ||
.getAttribute('value')) | ||
.then(value => { | ||
t.ok(value !== '', 'remote SDP is shown in textarea'); | ||
return driver.findElement(webdriver.By.id('setAnswer')).click(); | ||
}) | ||
.then(() => driver.wait(() => driver.executeScript( | ||
'return remotePeerConnection && ' + | ||
'remotePeerConnection.iceConnectionState === \'connected\';'), 30 * 1000)) | ||
.then(() => { | ||
t.pass('remotePeerConnection ICE connected'); | ||
// Need to make sure some data has had time to transfer. | ||
return driver.wait(() => driver.executeScript('return typeof dataChannelDataReceived !== \'undefined\';')); | ||
}) | ||
.then(() => driver.executeScript('return dataChannelDataReceived;')) | ||
.then(value => t.ok(value !== '', 'dataChannelDataReceived is not empty.')) | ||
.then(() => { | ||
t.pass('remotePeerConnection ICE connected'); | ||
t.end(); | ||
}) | ||
.then(null, err => { | ||
t.fail(err); | ||
t.end(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license | ||
* that can be found in the LICENSE file in the root of the source | ||
* tree. | ||
*/ | ||
/* eslint-env node */ | ||
|
||
'use strict'; | ||
// This is a basic test file for use with testling. | ||
// The test script language comes from tape. | ||
const test = require('tape'); | ||
|
||
test('PeerConnection pc1 sample', t => { | ||
const webdriver = require('selenium-webdriver'); | ||
const seleniumHelpers = require('webrtc-utilities').seleniumLib; | ||
const driver = seleniumHelpers.buildDriver(); | ||
|
||
const path = '/src/content/peerconnection/pc1/index.html'; | ||
const url = (process.env.BASEURL ? process.env.BASEURL : ('file://' + process.cwd())) + path; | ||
driver.get(url) | ||
.then(() => { | ||
t.pass('page loaded'); | ||
return driver.findElement(webdriver.By.id('startButton')).click(); | ||
}) | ||
.then(() => driver.wait(() => driver.executeScript('return localStream !== null'), 30 * 1000)) | ||
.then(() => { | ||
t.pass('got media'); | ||
return driver.findElement(webdriver.By.id('callButton')).click(); | ||
}) | ||
.then(() => driver.wait(() => driver.executeScript( | ||
'return pc2 && pc2.iceConnectionState === \'connected\';'), 30 * 1000)) | ||
.then(() => { | ||
t.pass('pc2 ICE connected'); | ||
return driver.findElement(webdriver.By.id('hangupButton')).click(); | ||
}) | ||
.then(() => driver.wait(() => driver.executeScript('return pc1 === null'), 30 * 1000)) | ||
.then(() => { | ||
t.pass('hangup'); | ||
t.end(); | ||
}) | ||
.then(null, err => { | ||
t.fail(err); | ||
t.end(); | ||
}); | ||
}); |
Oops, something went wrong.