Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: test/all.js

Issue 29866577: Issue 6887 - add Chrome to "npm test" (Closed)
Patch Set: Created Sept. 1, 2018, 2:46 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/.eslintrc.json ('k') | test/browsers/chromium.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "use strict";
19
20 const glob = require("glob");
21 const path = require("path");
22 const {exec} = require("child_process");
23
24 for (let browser of glob.sync("./test/browsers/*.js"))
25 {
26 let module = require(path.resolve(browser));
27
28 describe(module.platform, function()
29 {
30 this.timeout(0);
31
32 before(function()
33 {
34 return Promise.all([
35 module.ensureBrowser(),
36 new Promise((resolve, reject) =>
37 {
38 exec(`python build.py devenv -t ${module.platform}`,
39 (error, stdout, stderr) =>
40 {
41 if (error)
42 {
43 console.error(stderr);
44 reject(error);
45 }
46 else resolve(stdout);
47 });
48 })
49 ]).then(([browserBinary]) =>
50 {
51 this.driver = module.getDriver(
52 browserBinary,
53 path.resolve(`./devenv.${module.platform}`)
54 );
55 return this.driver.wait(() =>
56 this.driver.getAllWindowHandles().then(handles => handles[1])
57 );
58 }).then(handle =>
59 this.driver.switchTo().window(handle)
60 ).then(() =>
61 this.driver.executeScript("return location.origin;")
62 ).then(origin =>
63 {
64 this.origin = origin;
65 this.platform = module.platform;
66 });
67 });
68
69 for (let file of glob.sync("./test/wrappers/*.js"))
70 {
71 // Reload the module(s) for every browser
72 let modulePath = path.resolve(file);
73 delete require.cache[require.resolve(modulePath)];
74 require(modulePath);
75 }
76
77 after(function()
78 {
79 this.driver.quit();
80 });
81 });
82 }
OLDNEW
« no previous file with comments | « test/.eslintrc.json ('k') | test/browsers/chromium.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld