bigbluebutton-Github/bigbluebutton-html5/tests/puppeteer/whiteboard/draw.js
Mohamed Amine Ben Salah d8c5aa46d9
multiple automated tests suites updates + add missing polling specs and move them with old ones to a polling test suite (#10766)
* updating old tests + collecting more snapshots [WIP]

* updates old test suites and collects more visual regressions screenshots

* remove snapshots and their collection temporary

* run tests from packages.json

* update test execution command/export constants from .env to core/constants.js

* update tests/puppeteer/README.md file

* update LOOP_INTERVAL variable call and assign timeouts to the webcam share spec

* redefine waitForSelector func in page.js, update chat test suite specs and add poll chat message test spec

* Merge remote-tracking branch 'upstream/develop' into updating-old-tests-visual-with-visual-regressions

* update webcam test specs collecting videoPreviewTimeout and use it to wait for videoPreview selector

* update custom parameters test suite

* update breakout test suite

* update webcam layout test suite

* update multiusers test suite

* update notifications test suite

* update presentation test suite

* whiteboard test suite

* screenshare test suite

* update sharednotes test suite

* user ELEMENT_WAIT_TIME variable from timeouts constants.js

* list TEST CONSTANTS by category

* add poll test suite and assigns the right unassigned timeouts

* set test pages to headless
2021-02-16 15:57:10 -05:00

46 lines
1.4 KiB
JavaScript

const { ELEMENT_WAIT_TIME } = require('../core/constants');
const Page = require('../core/page');
const e = require('./elements');
class Draw extends Page {
constructor() {
super('whiteboard-draw');
}
async test() {
try {
await this.waitForSelector(e.tools, ELEMENT_WAIT_TIME);
await this.click(e.tools, true);
await this.waitForSelector(e.rectangle, ELEMENT_WAIT_TIME);
await this.click(e.rectangle, true);
await this.waitForSelector(e.whiteboard, ELEMENT_WAIT_TIME);
const shapes0 = await this.getTestElements();
shapes0 === '<g></g>';
const wb = await this.page.$(e.whiteboard);
const wbBox = await wb.boundingBox();
await this.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
await this.page.mouse.down();
await this.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height);
await this.page.mouse.up();
await this.waitForSelector(e.drawnRectangle, ELEMENT_WAIT_TIME);
const shapes1 = await this.getTestElements();
shapes1 !== '<g></g>';
return true;
} catch (e) {
await this.logger(e);
return false;
}
}
async getTestElements() {
await this.waitForSelector('g[clip-path="url(#viewBox)"]', ELEMENT_WAIT_TIME);
const shapes = await this.page.evaluate(() => document.querySelector('svg g[clip-path]').children[1].outerHTML);
return shapes;
}
}
module.exports = exports = Draw;