bigbluebutton-Github/bigbluebutton-html5/tests/puppeteer/page-draw.js
browniecab b5bd5754a1 Use Jest for running tests
(cherry picked from commit d82cef50e99e9da6f0d6b94f2bd950bf063d6400)
2018-10-03 13:45:28 -04:00

44 lines
1.3 KiB
JavaScript

const Page = require('./page');
const helper = require('./helper');
const e = require('./elements');
class DrawTestPage extends Page
{
async test()
{
await this.createBBBMeeting();
await this.joinWithoutAudio();
await this.page.waitFor(e.tools);
await this.page.click(e.tools);
await this.page.waitFor(e.rectangle);
await this.page.click(e.rectangle);
await this.page.waitFor(e.whiteboard);
var shapes0 = await this.getTestElements();
var wb = await this.page.$(e.whiteboard);
var 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 helper.sleep(500);
await this.page.screenshot({path: "screenshots/test-draw.png"})
var shapes1 = await this.getTestElements();
console.log("\nShapes before drawing box:");
console.log(shapes0);
console.log("\nShapes after drawing box:");
console.log(shapes1);
}
async getTestElements()
{
var shapes = await this.page.evaluate(() =>{ return document.querySelector("svg g[clip-path]").children[1].outerHTML; });
return shapes;
}
};
module.exports = exports = DrawTestPage;