Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
3 * Copyright (C) 2006-present eyeo GmbH | |
4 * | |
5 * Adblock Plus is free software: you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License version 3 as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * Adblock Plus is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
16 */ | |
17 | |
18 /* eslint-env mocha */ | |
19 | |
20 "use strict"; | |
21 | |
22 const glob = require("glob"); | |
23 const path = require("path"); | |
24 const {exec} = require("child_process"); | |
25 | |
26 for (let browser of glob.sync("./test/browsers/*.js")) | |
27 { | |
28 let module = require(path.resolve(browser)); | |
29 | |
30 describe(module.platform, function() | |
31 { | |
32 this.timeout(0); | |
33 | |
34 let driver; | |
35 let origin; | |
36 | |
37 before(() => | |
38 new Promise((resolve, reject) => | |
39 { | |
40 exec(`python build.py devenv -t ${module.platform}`, | |
41 (error, stdout, stderr) => | |
42 { | |
43 if (error) | |
44 { | |
45 console.error(error); | |
46 reject(stderr); | |
Sebastian Noack
2018/08/28 14:44:58
It seems you got it the wrong way around. You want
tlucas
2018/08/29 09:16:53
Done.
| |
47 } | |
48 else resolve(stdout); | |
49 }); | |
50 } | |
51 ).then(() => | |
Sebastian Noack
2018/08/28 14:44:58
Nit: The indention is off here. Closing parenthesi
tlucas
2018/08/29 09:16:53
re indented here and above (at "new Promise")
| |
52 module.getDriver().then(d => | |
53 { | |
54 driver = d; | |
55 return driver.wait(() => | |
56 driver.getAllWindowHandles().then(handles => handles[1]) | |
57 ); | |
58 }).then(handle => | |
59 driver.switchTo().window(handle) | |
60 ).then(() => | |
61 driver.executeScript("return location.origin;") | |
62 ).then(o => | |
63 { | |
64 origin = o; | |
65 }) | |
66 )); | |
67 | |
68 for (let file of glob.sync("./test/wrappers/*.js")) | |
69 { | |
70 let testModule = require(path.resolve(file)); | |
71 | |
72 it(testModule.title, () => | |
73 { | |
74 return testModule.it(driver, origin); | |
75 }); | |
76 } | |
77 | |
78 after(() => driver.quit()); | |
79 }); | |
80 } | |
OLD | NEW |