2023-03-09 04:34:54 +08:00
|
|
|
const { test } = require('@playwright/test');
|
|
|
|
const e = require('../core/elements.js');
|
|
|
|
const { getSettings } = require('../core/settings.js');
|
|
|
|
|
|
|
|
async function openPoll(testPage) {
|
|
|
|
const { pollEnabled } = getSettings();
|
|
|
|
test.fail(!pollEnabled, 'Polling is disabled');
|
2023-03-10 22:24:14 +08:00
|
|
|
|
2023-03-09 04:34:54 +08:00
|
|
|
await testPage.waitAndClick(e.actions);
|
|
|
|
await testPage.waitAndClick(e.polling);
|
|
|
|
}
|
|
|
|
|
2023-03-10 22:24:14 +08:00
|
|
|
function timeInSeconds(locator){
|
2023-03-10 05:09:02 +08:00
|
|
|
const [hours, minutes, seconds] = locator.split(':').map(Number);
|
|
|
|
return hours * 3600 + minutes * 60 + seconds;
|
|
|
|
}
|
|
|
|
|
2023-03-30 21:01:01 +08:00
|
|
|
async function rowFilter(testPage, locator, role, selector) {
|
|
|
|
const locatorToFilter = await testPage.getLocator(locator);
|
|
|
|
return locatorToFilter.filter({ hasText: role }).locator(selector);
|
|
|
|
}
|
|
|
|
|
2023-03-10 05:09:02 +08:00
|
|
|
exports.openPoll = openPoll;
|
2023-04-04 04:21:24 +08:00
|
|
|
exports.timeInSeconds = timeInSeconds;
|
2023-04-06 02:16:44 +08:00
|
|
|
exports.rowFilter = rowFilter;
|