| 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(() => new Promise((resolve, reject) => | |
|
Sebastian Noack
2018/08/30 02:02:40
I just noticed, getting the driver and setting up
tlucas
2018/09/01 09:38:31
Correct me if i'm wrong - but couldn't it then hap
Sebastian Noack
2018/09/01 10:42:47
My bad, you are right. However, what we can do, an
tlucas
2018/09/01 11:54:23
Done (almost, nodejs complained about an unexpecte
Sebastian Noack
2018/09/01 12:26:33
Right, you have to use parenthesis if you want to
tlucas
2018/09/01 14:46:44
Done.
| |
| 38 { | |
| 39 exec(`python build.py devenv -t ${module.platform}`, | |
| 40 (error, stdout, stderr) => | |
| 41 { | |
| 42 if (error) | |
| 43 { | |
| 44 console.error(stderr); | |
| 45 reject(error); | |
| 46 } | |
| 47 else resolve(stdout); | |
| 48 }); | |
| 49 }).then(() => module.getDriver(path.resolve(`./devenv.${module.platform}`)) | |
| 50 .then(d => | |
|
Sebastian Noack
2018/08/29 15:22:12
Nit: The indentation seems a little inconsistent.
tlucas
2018/09/01 09:38:31
Should be resolved now.
| |
| 51 { | |
| 52 driver = d; | |
| 53 return driver.wait(() => | |
| 54 driver.getAllWindowHandles().then(handles => handles[1]) | |
| 55 ); | |
| 56 }).then(handle => | |
| 57 driver.switchTo().window(handle) | |
| 58 ).then(() => | |
| 59 driver.executeScript("return location.origin;") | |
| 60 ).then(o => | |
| 61 { | |
| 62 origin = o; | |
| 63 })) | |
| 64 ); | |
| 65 | |
| 66 for (let file of glob.sync("./test/wrappers/*.js")) | |
| 67 { | |
| 68 let testModule = require(path.resolve(file)); | |
| 69 | |
| 70 it(testModule.title, () => | |
| 71 { | |
| 72 return testModule.it(driver, origin); | |
| 73 }); | |
| 74 } | |
| 75 | |
| 76 after(() => driver.quit()); | |
| 77 }); | |
| 78 } | |
| OLD | NEW |