|
@@ -0,0 +1,42 @@
|
|
1
|
+const fs = require("../server/fs_promises.js");
|
|
2
|
+const os = require("os");
|
|
3
|
+const path = require("path");
|
|
4
|
+
|
|
5
|
+let wbo, data_path;
|
|
6
|
+
|
|
7
|
+async function beforeEach(browser, done) {
|
|
8
|
+ data_path = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'wbo-test-data-'));
|
|
9
|
+ process.env["PORT"] = 8487;
|
|
10
|
+ process.env["WBO_HISTORY_DIR"] = data_path;
|
|
11
|
+ console.log("Launching WBO in " + data_path);
|
|
12
|
+ wbo = require("../server/server.js");
|
|
13
|
+ done();
|
|
14
|
+}
|
|
15
|
+
|
|
16
|
+async function afterEach(browser, done) {
|
|
17
|
+ wbo.close();
|
|
18
|
+ done();
|
|
19
|
+}
|
|
20
|
+
|
|
21
|
+function testBoard(browser) {
|
|
22
|
+ browser
|
|
23
|
+ .url('http://localhost:8487/boards/anonymous?lang=fr')
|
|
24
|
+ .waitForElementVisible('.tool[title ~= Crayon]') // pencil
|
|
25
|
+ .assert.titleContains('WBO')
|
|
26
|
+ .click('.tool[title ~= Crayon]')
|
|
27
|
+ .assert.cssClassPresent('.tool[title ~= Crayon]', ['curTool'])
|
|
28
|
+ .executeAsync(function (done) {
|
|
29
|
+ Tools.setColor('#123456');
|
|
30
|
+ Tools.curTool.listeners.press(100, 200, new Event("mousedown"));
|
|
31
|
+ setTimeout(() => {
|
|
32
|
+ Tools.curTool.listeners.move(300, 400, new Event("mousemove"));
|
|
33
|
+ done();
|
|
34
|
+ }, 100);
|
|
35
|
+ })
|
|
36
|
+ .assert.visible("path[d='M 100 200 C 100 200 300 400 300 400'][stroke='#123456']")
|
|
37
|
+ .refresh()
|
|
38
|
+ .assert.visible("path[d='M 100 200 C 100 200 300 400 300 400'][stroke='#123456']")
|
|
39
|
+ .end();
|
|
40
|
+}
|
|
41
|
+
|
|
42
|
+module.exports = { beforeEach, testBoard, afterEach };
|