Files
Testing/videocall1/RecordRTC/test/canvas-recording.js
sean 0e8a8b3028
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-17 16:15:01 -05:00

90 lines
3.1 KiB
JavaScript

describe('RecordRTC', function() {
it('canvas-recording', function() {
function addLine() {
console.log('\x1b[31m%s\x1b[0m ', (new Date).toUTCString() + ':');
}
console.log('------------------------------');
console.log('\x1b[31m%s\x1b[0m ', 'canvas-recording');
browser.driver.get('https://webrtcweb.com/RecordRTC/tests/canvas-recording.html').then(function() {
// wait until RecordRTC ends the recording
(function looper() {
var isRecordingStopped = false;
var onStateChanged = '';
browser.driver.findElement(by.id('isRecordingStopped')).getText().then(function(value) {
if (!value || !value.toString().length) {
return;
}
isRecordingStopped = value.toString() === 'true';
});
browser.driver.findElement(by.id('onStateChanged')).getText().then(function(value) {
if (!value || !value.toString().length) {
return;
}
onStateChanged = value;
});
browser.wait(function() {
return true;
}, 1000).then(function() {
addLine();
console.log('onStateChanged: ' + onStateChanged);
if (isRecordingStopped === false) {
looper();
return;
}
onRecordingStopped();
});
})();
function onRecordingStopped() {
addLine();
console.log('onRecordingStopped');
var blobSize = 0;
var logs = '';
browser.driver.findElement(by.id('blobSize')).getText().then(function(value) {
if (!value || !value.toString().length) {
return;
}
blobSize = value.toString();
});
browser.driver.findElement(by.id('logs')).getText().then(function(value) {
if (!value || !value.toString().length) {
return;
}
logs = value.toString();
});
browser.wait(function() {
addLine();
console.log('blobSize: ' + blobSize);
addLine();
console.log(logs);
if (blobSize === 0 || blobSize === '0 Bytes' || blobSize === '0' || !blobSize || blobSize === NaN || blobSize === 'NaN' || !blobSize.toString().length) {
addLine();
console.log('\x1b[31m%s\x1b[0m ', 'canvas-recording failed: ' + blobSize);
throw new Error('canvas-recording failed: ' + blobSize);
}
return true;
}, 1000, 'canvas-recording failed.');
}
});
});
});