bigbluebutton-Github/bigbluebutton-html5/tests/puppeteer/screenshare.obj.js
Mohamed Amine Ben Salah 2a9fdebd61
Mobile/Tablet devices automated tests for mobile/tablet on ios/android devices (#12173)
* adds unability to see screenshare button on mobile devices test specs

* simplify code in testMobileDevice()

* userlist and chat panels should not appear at page load in mobile devices

* lint

* updates outdated audio specs due to leaveAudio changes

* correct clicks on disconnectAudio elements

* whiteboard not visible on userlistPanel or on chatPanel

* reworks mobile devices/usersagents

* fixes screenshare mobile/tablet specs

* adds whiteboardNotAppearOnMobile spec

* adds Chat Panel specification to Mobile-Tablet specs

* simplify getArgs() functions for all devices
2021-05-25 12:05:11 -04:00

123 lines
3.8 KiB
JavaScript

const { toMatchImageSnapshot } = require('jest-image-snapshot');
const ShareScreen = require('./screenshare/screenshare');
const Page = require('./core/page');
const { MAX_SCREENSHARE_TEST_TIMEOUT } = require('./core/constants'); // core constants (Timeouts vars imported)
const devices = require('./core/devices');
const iPhonex = devices['iPhone X'];
const galaxyNote3 = devices['Galaxy Note 3'];
const ipadPro = devices['iPad Pro'];
expect.extend({ toMatchImageSnapshot });
const screenShareTest = () => {
beforeEach(() => {
jest.setTimeout(MAX_SCREENSHARE_TEST_TIMEOUT);
});
test('Share screen', async () => {
const test = new ShareScreen();
let response;
let screenshot;
try {
const testName = 'shareScreen';
await test.logger('begin of ', testName);
await test.init(Page.getArgs(), undefined, undefined, undefined, testName);
await test.startRecording(testName);
await test.closeAudioModal();
response = await test.test();
await test.logger('end of ', testName);
await test.stopRecording();
screenshot = await test.page.screenshot();
} catch (e) {
await test.logger(e);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 1.37,
failureThresholdType: 'percent',
});
}
});
test('Share screen unvailable on Mobile Android', async () => {
process.env.IS_MOBILE = true;
const test = new ShareScreen();
let response;
let screenshot;
try {
const testName = 'shareScreenAndroidMobile';
await test.logger('begin of ', testName);
response = await test.testMobileDevice(Page.getArgs(), testName, galaxyNote3);
await test.logger('end of ', testName);
await test.stopRecording();
screenshot = await test.page.screenshot();
} catch (e) {
await test.logger(e);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 1.37,
failureThresholdType: 'percent',
});
}
});
test('Share screen unvailable on Mobile iPhone', async () => {
process.env.IS_MOBILE = true;
const test = new ShareScreen();
let response;
let screenshot;
try {
const testName = 'shareScreenIphoneMobile';
await test.logger('begin of ', testName);
response = await test.testMobileDevice(Page.getArgs(), testName, iPhonex);
await test.logger('end of ', testName);
await test.stopRecording();
screenshot = await test.page.screenshot();
} catch (e) {
await test.logger(e);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 1.37,
failureThresholdType: 'percent',
});
}
});
test('Share screen unvailable on Tablet iPad', async () => {
process.env.IS_MOBILE = true;
const test = new ShareScreen();
let response;
let screenshot;
try {
const testName = 'shareScreenTabletIpad';
await test.logger('begin of ', testName);
response = await test.testMobileDevice(Page.getArgs(), testName, ipadPro);
await test.logger('end of ', testName);
await test.stopRecording();
screenshot = await test.page.screenshot();
} catch (e) {
await test.logger(e);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 1.37,
failureThresholdType: 'percent',
});
}
});
};
module.exports = exports = screenShareTest;