bigbluebutton-Github/bigbluebutton-tests/playwright/polling/util.js

37 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-06-08 02:52:22 +08:00
const { test } = require('@playwright/test');
2021-11-26 02:23:58 +08:00
const e = require('../core/elements.js');
2022-03-29 21:53:07 +08:00
const { getSettings } = require('../core/settings.js');
const path = require('path');
2021-11-26 02:23:58 +08:00
2022-06-08 02:52:22 +08:00
async function openPoll(testPage) {
2022-03-29 21:53:07 +08:00
const { pollEnabled } = getSettings();
test.fail(!pollEnabled, 'Polling is disabled');
2022-06-08 02:52:22 +08:00
await testPage.waitAndClick(e.actions);
await testPage.waitAndClick(e.polling);
await testPage.waitForSelector(e.hidePollDesc);
await testPage.waitAndClick(e.pollLetterAlternatives);
await testPage.waitForSelector(e.pollOptionItem);
2021-11-26 02:23:58 +08:00
}
2024-03-05 00:44:47 +08:00
async function startPoll(test, isAnonymous = false) {
2021-11-26 02:23:58 +08:00
await openPoll(test);
2023-04-28 20:30:29 +08:00
if (isAnonymous) await test.getLocator(e.anonymousPoll).setChecked();
2021-11-26 02:23:58 +08:00
await test.waitAndClick(e.startPoll);
}
async function uploadSPresentationForTestingPolls(test, fileName) {
await test.waitAndClick(e.actions);
await test.waitAndClick(e.managePresentations);
await test.waitForSelector(e.presentationFileUpload);
await test.page.setInputFiles(e.presentationFileUpload, path.join(__dirname, `../core/media/${fileName}`));
await test.hasText('body', e.statingUploadPresentationToast);
await test.waitAndClick(e.confirmManagePresentation);
}
2021-11-26 02:23:58 +08:00
exports.openPoll = openPoll;
2021-12-04 01:01:36 +08:00
exports.startPoll = startPoll;
exports.uploadSPresentationForTestingPolls = uploadSPresentationForTestingPolls;