Skip to content

Commit 6c62161

Browse files
committed
re-add old tests
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/ \;
1 parent c19438e commit 6c62161

File tree

14 files changed

+625
-0
lines changed

14 files changed

+625
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
export default {
9+
'It should transfer text over data channel': (browser) => {
10+
const path = '/src/content/datachannel/basic/index.html';
11+
const url = 'file://' + process.cwd() + path;
12+
13+
browser
14+
.url(url)
15+
.click('#startButton')
16+
.expect.element('#sendButton').to.be.enabled.before(50);
17+
browser.expect.element('#dataChannelSend').to.be.enabled.before(50);
18+
19+
browser.setValue('#dataChannelSend', 'HELLO, WORLD!');
20+
browser
21+
.click('#sendButton')
22+
.pause(50)
23+
.assert.value('#dataChannelReceive', 'HELLO, WORLD!');
24+
25+
browser
26+
.click('#closeButton')
27+
.expect.element('#sendButton').to.not.be.enabled.before(50);
28+
29+
browser.end();
30+
}
31+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
export default {
9+
'It should transfer data over data channel': (browser) => {
10+
const path = '/src/content/datachannel/datatransfer/index.html';
11+
const url = 'file://' + process.cwd() + path;
12+
13+
browser
14+
.url(url)
15+
.click('#sendTheData')
16+
.pause(1000)
17+
.assert.value('#receiveProgress', '16777200')
18+
.end();
19+
}
20+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
9+
export default {
10+
'It should transfer a file over a datachannel': (browser) => {
11+
const path = '/src/content/datachannel/filetransfer/index.html';
12+
const url = 'file://' + process.cwd() + path;
13+
14+
browser
15+
.url(url)
16+
.waitForElementNotVisible('#download', 100, 'File download link is not visible')
17+
.waitForElementVisible('#fileInput', 1000)
18+
.setValue('#fileInput', process.cwd() + '/src/content/devices/multi/images/poster.jpg')
19+
.waitForElementVisible('#download', 10000, 'File download link is visible')
20+
.end();
21+
}
22+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
export default {
9+
'It should have select elements for each media device': (browser) => {
10+
const path = '/src/content/devices/input-output/index.html';
11+
const url = 'file://' + process.cwd() + path;
12+
13+
browser
14+
.url(url)
15+
.waitForElementVisible('#audioSource option:nth-of-type(1)', 1000, 'Check that there is at least one audio source')
16+
.waitForElementVisible('#audioOutput option:nth-of-type(1)', 1000, 'Check that there is at least one audio output')
17+
.waitForElementVisible('#videoSource option:nth-of-type(1)', 1000, 'Check that there is at least one video source')
18+
.end();
19+
}
20+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
export default {
9+
'It should have a video element': (browser) => {
10+
const path = '/src/content/getusermedia/gum/index.html';
11+
const url = 'file://' + process.cwd() + path;
12+
13+
browser
14+
.url(url)
15+
.waitForElementVisible('video', 5000)
16+
.waitForClientConnected('video', 5000)
17+
.end();
18+
}
19+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
export default {
9+
'It should have a video element with specific width': (browser) => {
10+
const path = '/src/content/getusermedia/resolution/index.html';
11+
const url = 'file://' + process.cwd() + path;
12+
13+
browser
14+
.url(url)
15+
.click('button#qvga')
16+
.waitForElementVisible('video', 5000)
17+
.waitForClientConnected('video', 5000)
18+
.assert.videoWidth('video', 320, 'Video width is 320 wide.')
19+
.click('button#vga')
20+
.waitForElementVisible('video', 5000)
21+
.waitForClientConnected('video', 5000)
22+
.assert.videoWidth('video', 640, 'Video width is 640 wide.')
23+
.click('button#hd')
24+
.waitForElementVisible('video', 5000)
25+
.waitForClientConnected('video', 5000)
26+
.assert.videoWidth('video', 1280, 'Video width is 1280 wide.')
27+
.end();
28+
}
29+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
export default {
9+
'It should play audio remote': (browser) => {
10+
const path = '/src/content/peerconnection/audio/index.html';
11+
const url = 'file://' + process.cwd() + path;
12+
13+
// TODO Test all codecs?
14+
browser
15+
.url(url)
16+
.click('#callButton')
17+
.waitForClientConnected('#audio2', 5000, 'Receiving remote audio.')
18+
.end();
19+
}
20+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
export default {
9+
'It should send DTMF codes': (browser) => {
10+
const path = '/src/content/peerconnection/dtmf/index.html';
11+
const url = 'file://' + process.cwd() + path;
12+
13+
// TODO Test all codecs?
14+
browser
15+
.url(url)
16+
.click('#callButton')
17+
.waitForClientConnected('audio', 1000, 'Receiving remote audio.')
18+
.useXpath()
19+
.click('/html/body/div/div[@id=\'dialPad\']/div[1]/button[1]') // 1
20+
.click('/html/body/div/div[@id=\'dialPad\']/div[3]/button[1]') // 9
21+
.click('/html/body/div/div[@id=\'dialPad\']/div[3]/button[4]') // #
22+
.click('/html/body/div/div[@id=\'dialPad\']/div[4]/button[1]') // A
23+
.useCss()
24+
.assert.value('input#sentTones', '1 9 # A ')
25+
.click('#hangupButton')
26+
.end();
27+
}
28+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
/* eslint-env node */
9+
10+
'use strict';
11+
// This is a basic test file for use with testling.
12+
// The test script language comes from tape.
13+
const test = require('tape');
14+
15+
const webdriver = require('selenium-webdriver');
16+
const seleniumHelpers = require('webrtc-utilities').seleniumLib;
17+
18+
test('PeerConnection multiple sample', t => {
19+
const driver = seleniumHelpers.buildDriver();
20+
const path = '/src/content/peerconnection/multiple/index.html';
21+
const url = (process.env.BASEURL ? process.env.BASEURL : ('file://' + process.cwd())) + path;
22+
23+
driver.get(url)
24+
.then(() => {
25+
t.pass('page loaded');
26+
return driver.findElement(webdriver.By.id('startButton')).click();
27+
})
28+
.then(() => {
29+
t.pass('got media');
30+
return driver.wait(() => driver.findElement(webdriver.By.id('callButton')).isEnabled());
31+
})
32+
.then(() => {
33+
driver.findElement(webdriver.By.id('callButton')).click();
34+
return driver.wait(() => driver.executeScript(
35+
'return pc1Remote && pc1Remote.iceConnectionState === \'connected\'' +
36+
' && pc2Remote && pc2Remote.iceConnectionState === \'connected\';'), 30 * 1000);
37+
})
38+
.then(() => {
39+
t.pass('multiple connections connected');
40+
return driver.findElement(webdriver.By.id('hangupButton')).click();
41+
})
42+
.then(() => driver.wait(() => driver.executeScript('return pc1Local === null && ' +
43+
'pc2Local === null'), 30 * 1000))
44+
.then(() => {
45+
t.pass('hangup');
46+
t.end();
47+
})
48+
.then(null, err => {
49+
t.fail(err);
50+
t.end();
51+
});
52+
});
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
/* eslint-env node */
9+
10+
'use strict';
11+
// This is a basic test file for use with testling.
12+
// The test script language comes from tape.
13+
const test = require('tape');
14+
15+
const webdriver = require('selenium-webdriver');
16+
const seleniumHelpers = require('webrtc-utilities').seleniumLib;
17+
18+
test('Munge SDP sample', t => {
19+
const driver = seleniumHelpers.buildDriver();
20+
const path = '/src/content/peerconnection/munge-sdp/index.html';
21+
const url = (process.env.BASEURL ? process.env.BASEURL : ('file://' + process.cwd())) + path;
22+
23+
driver.get(url)
24+
.then(() => {
25+
t.pass('page loaded');
26+
return driver.findElement(webdriver.By.id('getMedia')).click();
27+
})
28+
.then(() => driver.wait(() => driver.executeScript('return typeof window.localStream !== \'undefined\'')))
29+
.then(() => {
30+
t.pass('got media');
31+
return driver.findElement(webdriver.By.id('createPeerConnection')).click();
32+
})
33+
.then(() => {
34+
return driver.wait(webdriver.until.elementIsVisible(driver.findElement(webdriver.By.id('createOffer')))).click();
35+
})
36+
.then(() => {
37+
// Need to wait for createOffer to succeed which takes some time
38+
// on travis.
39+
const script = 'return document.querySelector(\'#local>textarea\').value !== \'\'';
40+
return driver.wait(() => driver.executeScript(script));
41+
})
42+
.then(() => driver.findElement(webdriver.By.css('#local>textarea')).getAttribute('value'))
43+
.then(value => {
44+
t.ok(value !== '', 'local SDP is shown in textarea');
45+
return driver.findElement(webdriver.By.id('setOffer')).click();
46+
})
47+
.then(() => driver.findElement(webdriver.By.id('createAnswer')).click())
48+
.then(() => {
49+
// Need to wait for createAnswer to succeed which takes some time
50+
// on travis.
51+
return driver.wait(() => driver.executeScript(
52+
'return document.querySelector(\'#remote>textarea\').value !== \'\''));
53+
})
54+
.then(() => driver.findElement(webdriver.By.css('#remote>textarea'))
55+
.getAttribute('value'))
56+
.then(value => {
57+
t.ok(value !== '', 'remote SDP is shown in textarea');
58+
return driver.findElement(webdriver.By.id('setAnswer')).click();
59+
})
60+
.then(() => driver.wait(() => driver.executeScript(
61+
'return remotePeerConnection && ' +
62+
'remotePeerConnection.iceConnectionState === \'connected\';'), 30 * 1000))
63+
.then(() => {
64+
t.pass('remotePeerConnection ICE connected');
65+
// Need to make sure some data has had time to transfer.
66+
return driver.wait(() => driver.executeScript('return typeof dataChannelDataReceived !== \'undefined\';'));
67+
})
68+
.then(() => driver.executeScript('return dataChannelDataReceived;'))
69+
.then(value => t.ok(value !== '', 'dataChannelDataReceived is not empty.'))
70+
.then(() => {
71+
t.pass('remotePeerConnection ICE connected');
72+
t.end();
73+
})
74+
.then(null, err => {
75+
t.fail(err);
76+
t.end();
77+
});
78+
});
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree.
7+
*/
8+
/* eslint-env node */
9+
10+
'use strict';
11+
// This is a basic test file for use with testling.
12+
// The test script language comes from tape.
13+
const test = require('tape');
14+
15+
test('PeerConnection pc1 sample', t => {
16+
const webdriver = require('selenium-webdriver');
17+
const seleniumHelpers = require('webrtc-utilities').seleniumLib;
18+
const driver = seleniumHelpers.buildDriver();
19+
20+
const path = '/src/content/peerconnection/pc1/index.html';
21+
const url = (process.env.BASEURL ? process.env.BASEURL : ('file://' + process.cwd())) + path;
22+
driver.get(url)
23+
.then(() => {
24+
t.pass('page loaded');
25+
return driver.findElement(webdriver.By.id('startButton')).click();
26+
})
27+
.then(() => driver.wait(() => driver.executeScript('return localStream !== null'), 30 * 1000))
28+
.then(() => {
29+
t.pass('got media');
30+
return driver.findElement(webdriver.By.id('callButton')).click();
31+
})
32+
.then(() => driver.wait(() => driver.executeScript(
33+
'return pc2 && pc2.iceConnectionState === \'connected\';'), 30 * 1000))
34+
.then(() => {
35+
t.pass('pc2 ICE connected');
36+
return driver.findElement(webdriver.By.id('hangupButton')).click();
37+
})
38+
.then(() => driver.wait(() => driver.executeScript('return pc1 === null'), 30 * 1000))
39+
.then(() => {
40+
t.pass('hangup');
41+
t.end();
42+
})
43+
.then(null, err => {
44+
t.fail(err);
45+
t.end();
46+
});
47+
});

0 commit comments

Comments
 (0)