bigbluebutton-Github/bigbluebutton-tests/puppeteer/audio/audio.obj.js

59 lines
1.7 KiB
JavaScript
Raw Normal View History

const Audio = require('./audio');
const Page = require('../core/page');
2020-10-09 03:25:35 +08:00
const { toMatchImageSnapshot } = require('jest-image-snapshot');
const { MAX_AUDIO_TEST_TIMEOUT } = require('../core/constants');
2020-10-09 03:25:35 +08:00
expect.extend({ toMatchImageSnapshot });
const audioTest = () => {
beforeEach(() => {
jest.setTimeout(MAX_AUDIO_TEST_TIMEOUT);
});
test('Join audio with Listen Only', async () => {
const test = new Audio();
let response;
2020-10-09 03:25:35 +08:00
let screenshot;
try {
const testName = 'joinWithListenOnly';
await test.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(true, false, testName);
await test.startRecording(testName);
response = await test.test();
await test.stopRecording();
2020-10-09 03:25:35 +08:00
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.logger(err);
} finally {
await test.close();
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(0.65, screenshot);
});
test('Join audio with Microphone', async () => {
const test = new Audio();
let response;
2020-10-09 03:25:35 +08:00
let screenshot;
try {
const testName = 'joinWithMicrophone';
await test.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(true, false, testName);
await test.startRecording(testName);
response = await test.microphone();
await test.stopRecording();
2020-10-09 03:25:35 +08:00
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.logger(err);
} finally {
await test.close();
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(0.52, screenshot);
});
};
module.exports = exports = audioTest;