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

222 lines
7.6 KiB
JavaScript
Raw Normal View History

const Page = require('../core/page');
const Poll = require('./poll');
const { closePages } = require('../core/util');
const { MAX_POLLING_TEST_TIMEOUT, TEST_DURATION_TIME } = require('../core/constants'); // core constants (Timeouts vars imported)
const { toMatchImageSnapshot } = require('jest-image-snapshot');
expect.extend({ toMatchImageSnapshot });
const pollingTest = () => {
beforeEach(() => {
jest.setTimeout(MAX_POLLING_TEST_TIMEOUT);
});
2021-03-09 05:11:36 +08:00
// Create Poll
test('Create Poll', async () => {
const test = new Poll();
2021-03-09 05:11:36 +08:00
let response;
let screenshot;
try {
const testName = 'createPoll';
await test.modPage.logger('begin of ', testName);
await test.initModPage(true, testName);
await test.modPage.startRecording(testName);
response = await test.createPoll(testName);
await test.modPage.logger('end of ', testName);
await test.modPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.modPage.logger(err);
2021-03-09 05:11:36 +08:00
} finally {
await test.modPage.close();
2021-03-09 05:11:36 +08:00
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(1.37, screenshot);
2021-04-15 00:16:41 +08:00
}, TEST_DURATION_TIME);
2021-10-21 22:11:43 +08:00
// Create anonymous poll and check if its possible to see the user's response
test('Create anonymous poll', async () => {
const test = new Poll();
let response;
let screenshot;
try {
const testName = 'pollAnonymous';
await test.modPage.logger('begin of ', testName);
await test.initPages(testName);
await test.modPage.startRecording(testName);
response = await test.pollAnonymous(testName);
await test.modPage.logger('end of ', testName);
await test.modPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
} catch (err) {
await test.modPage.logger(err);
} finally {
await closePages(test.modPage, test.userPage);
}
expect(response).toBe(true);
Page.checkRegression(0.9, screenshot);
}, TEST_DURATION_TIME);
2021-10-22 23:37:37 +08:00
// Create quick poll
test('Create quick poll - from the slide', async () => {
const test = new Poll();
let response;
let screenshot;
try {
const testName = 'createQuickPoll';
await test.modPage.logger('begin of ', testName);
await test.initPages(testName);
await test.modPage.startRecording(testName);
response = await test.quickPoll(testName);
await test.modPage.logger('end of ', testName);
await test.modPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
} catch (err) {
await test.modPage.logger(err);
} finally {
await closePages(test.modPage, test.userPage);
}
expect(response).toBe(true);
Page.checkRegression(0.9, screenshot);
}, TEST_DURATION_TIME);
test('Create poll with user response', async () => {
const test = new Poll();
let response;
let screenshot;
try {
const testName = 'pollUserResponse';
await test.modPage.logger('begin of ', testName);
await test.initPages(testName);
response = await test.pollUserResponse(testName);
await test.modPage.logger('end of ', testName);
await test.modPage.stopRecording();
await test.userPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
} catch (err) {
await test.modPage.logger(err);
} finally {
await closePages(test.modPage, test.userPage);
}
expect(response).toBe(true);
Page.checkRegression(0.5, screenshot);
}, TEST_DURATION_TIME);
2021-10-23 01:21:17 +08:00
// Stop a poll manually
test('Stop a poll manually', async () => {
const test = new Poll();
let response;
let screenshot;
try {
const testName = 'stopManuallyPoll';
await test.modPage.logger('begin of ', testName);
await test.initPages(testName);
await test.modPage.startRecording(testName);
response = await test.stopPoll(testName);
await test.modPage.logger('end of ', testName);
await test.modPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
} catch (err) {
await test.modPage.logger(err);
} finally {
await closePages(test.modPage, test.userPage);
}
expect(response).toBe(true);
Page.checkRegression(0.9, screenshot);
}, TEST_DURATION_TIME);
// Check for Poll Results in chat message and return true when it appears
test('Poll results in chat message', async () => {
2021-03-09 05:11:36 +08:00
const test = new Poll();
let response;
let screenshot;
try {
const testName = 'pollResultsInChatMessage';
await test.modPage.logger('begin of ', testName);
await test.initModPage(true, testName);
await test.modPage.startRecording(testName);
response = await test.pollResultsOnChat(testName);
await test.modPage.logger('end of ', testName);
await test.modPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.modPage.logger(err);
2021-03-09 05:11:36 +08:00
} finally {
await test.modPage.close();
}
expect(response).toBe(true);
Page.checkRegression(0.9, screenshot);
}, TEST_DURATION_TIME);
2021-10-23 01:22:23 +08:00
// Check for Poll Results on the whiteboard and return true when it appears
test('Poll results on whiteboard', async () => {
const test = new Poll();
let response;
let screenshot;
try {
2021-10-23 01:22:23 +08:00
const testName = 'pollResultsOnWhiteboard';
await test.modPage.logger('begin of ', testName);
await test.initModPage(true, testName);
await test.modPage.startRecording(testName);
response = await test.pollResultsOnWhiteboard(testName);
await test.modPage.logger('end of ', testName);
await test.modPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
} catch (err) {
await test.modPage.logger(err);
} finally {
await test.modPage.close();
}
expect(response).toBe(true);
Page.checkRegression(0.9, screenshot);
}, TEST_DURATION_TIME);
// Check for Poll Results in whiteboard and return true when it appears
test('Poll results in a different presentation', async () => {
const test = new Poll();
let response;
let screenshot;
try {
const testName = 'pollResultsInDifferentPresentation';
await test.modPage.logger('begin of ', testName);
await test.initModPage(true, testName);
await test.modPage.startRecording(testName);
response = await test.pollResultsInDifferentPresentation(testName);
await test.modPage.logger('end of ', testName);
await test.modPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
} catch (err) {
await test.modPage.logger(err);
} finally {
await test.modPage.close();
2021-03-09 05:11:36 +08:00
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(0.9, screenshot);
2021-04-15 00:16:41 +08:00
}, TEST_DURATION_TIME);
// This test check all possible actions with
// response choice: add, delete and edit
test('Manage response choices', async () => {
const test = new Poll();
let response;
let screenshot;
try {
const testName = 'manageResponseChoices';
await test.modPage.logger('begin of ', testName);
await test.initPages(testName);
response = await test.manageResponseChoices(testName);
await test.modPage.logger('end of ', testName);
await test.modPage.stopRecording();
await test.userPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.modPage.logger(err);
} finally {
await closePages(test.modPage, test.userPage);
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(0.5, screenshot);
2021-04-15 00:16:41 +08:00
}, TEST_DURATION_TIME);
};
2021-09-30 20:36:08 +08:00
module.exports = exports = pollingTest;