2018-08-27 23:00:42 +08:00
|
|
|
const Page = require('./page');
|
|
|
|
const helper = require('./helper');
|
|
|
|
const e = require('./elements');
|
|
|
|
|
2018-10-13 02:46:26 +08:00
|
|
|
class DrawTestPage extends Page {
|
|
|
|
async test() {
|
2018-08-27 23:00:42 +08:00
|
|
|
await this.createBBBMeeting();
|
|
|
|
await this.joinWithoutAudio();
|
|
|
|
|
2018-11-21 07:51:40 +08:00
|
|
|
await this.click(e.tools);
|
|
|
|
await this.click(e.rectangle);
|
2018-08-27 23:00:42 +08:00
|
|
|
await this.page.waitFor(e.whiteboard);
|
|
|
|
|
2018-10-13 02:46:26 +08:00
|
|
|
const shapes0 = await this.getTestElements();
|
2018-08-27 23:00:42 +08:00
|
|
|
|
2018-10-13 02:46:26 +08:00
|
|
|
const wb = await this.page.$(e.whiteboard);
|
|
|
|
const wbBox = await wb.boundingBox();
|
2018-08-27 23:00:42 +08:00
|
|
|
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();
|
|
|
|
|
2018-11-21 07:51:40 +08:00
|
|
|
await this.screenshot('test-draw.png', true);
|
2018-10-13 02:46:26 +08:00
|
|
|
const shapes1 = await this.getTestElements();
|
2018-08-27 23:00:42 +08:00
|
|
|
|
2018-10-13 02:46:26 +08:00
|
|
|
console.log('\nShapes before drawing box:');
|
2018-08-27 23:00:42 +08:00
|
|
|
console.log(shapes0);
|
2018-10-13 02:46:26 +08:00
|
|
|
console.log('\nShapes after drawing box:');
|
2018-08-27 23:00:42 +08:00
|
|
|
console.log(shapes1);
|
|
|
|
}
|
|
|
|
|
2018-10-13 02:46:26 +08:00
|
|
|
async getTestElements() {
|
|
|
|
const shapes = await this.page.evaluate(() => document.querySelector('svg g[clip-path]').children[1].outerHTML);
|
2018-08-27 23:00:42 +08:00
|
|
|
return shapes;
|
|
|
|
}
|
2018-10-13 02:46:26 +08:00
|
|
|
}
|
2018-08-27 23:00:42 +08:00
|
|
|
|
2018-10-13 02:46:26 +08:00
|
|
|
module.exports = exports = DrawTestPage;
|