2021-02-17 04:57:10 +08:00
|
|
|
const { ELEMENT_WAIT_TIME, ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
|
2020-03-25 02:13:51 +08:00
|
|
|
const se = require('./elements');
|
|
|
|
|
|
|
|
async function startSharedNotes(test) {
|
2021-08-20 04:22:31 +08:00
|
|
|
try {
|
|
|
|
await test.waitForSelector(se.sharedNotes, ELEMENT_WAIT_TIME);
|
|
|
|
await test.click(se.sharedNotes, true);
|
|
|
|
await test.waitForSelector(se.hideNoteLabel, ELEMENT_WAIT_LONGER_TIME);
|
|
|
|
const resp = await test.page.evaluate(getTestElement, se.etherpad);
|
|
|
|
await test.waitForSelector(se.etherpad, ELEMENT_WAIT_TIME);
|
|
|
|
return resp === true;
|
|
|
|
} catch (e) {
|
|
|
|
await test.logger(e);
|
|
|
|
return false;
|
|
|
|
}
|
2020-03-25 02:13:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async function getTestElement(element) {
|
2021-08-20 04:22:31 +08:00
|
|
|
return document.querySelectorAll(element).length >= 1;
|
2020-03-25 02:13:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.getTestElement = getTestElement;
|
|
|
|
exports.startSharedNotes = startSharedNotes;
|