LEFT | RIGHT |
(no file at all) | |
| 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 }); |
| 66 }); |
| 67 |
| 68 for (let file of glob.sync("./test/wrappers/*.js")) |
| 69 { |
| 70 // Reload the module(s) for every browser |
| 71 let modulePath = path.resolve(file); |
| 72 delete require.cache[require.resolve(modulePath)]; |
| 73 require(modulePath); |
| 74 } |
| 75 |
| 76 after(function() |
| 77 { |
| 78 this.driver.quit(); |
| 79 }); |
| 80 }); |
| 81 } |
LEFT | RIGHT |