Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 return driver.wait(() => | 62 return driver.wait(() => |
63 driver.getAllWindowHandles().then(handles => handles[1]) | 63 driver.getAllWindowHandles().then(handles => handles[1]) |
64 ).then(handle => | 64 ).then(handle => |
65 driver.switchTo().window(handle) | 65 driver.switchTo().window(handle) |
66 ).then(() => | 66 ).then(() => |
67 driver.executeScript("return location.origin;") | 67 driver.executeScript("return location.origin;") |
68 ).then(result => { origin = result; }); | 68 ).then(result => { origin = result; }); |
69 }) | 69 }) |
70 ); | 70 ); |
71 | 71 |
72 function reportElements(success) | |
73 { | |
74 return driver.findElements( | |
75 By.css(`#qunit-tests ${success ? ".pass" : ".fail"} .test-name`) | |
76 ).then(elements => Promise.all(elements.map(elem => | |
77 elem.getAttribute("textContent").then(data => assert.ok(success, data)) | |
Sebastian Noack
2018/08/26 19:02:00
While changing this code anyway, I now, also use t
tlucas
2018/08/26 21:13:50
Acknowledged.
| |
78 ))); | |
79 } | |
80 | |
81 it("qunit", () => | 72 it("qunit", () => |
82 driver.navigate().to(origin + "/qunit/index.html").then(() => | 73 driver.navigate().to(origin + "/qunit/index.html").then(() => |
83 // Wait for qunit-results to be present | 74 // Wait for qunit-results to be present |
84 driver.wait(until.elementLocated(By.id("qunit-testresult"))) | 75 driver.wait(until.elementLocated(By.id("qunit-testresult"))) |
85 ).then(() => | 76 ).then(() => |
86 // Wait for tests to finish | 77 // Wait for tests to finish |
87 driver.wait(() => | 78 driver.wait(() => |
88 driver.findElement(By.id("qunit-testresult")) | 79 driver.findElement(By.id("qunit-testresult")) |
89 .getAttribute("innerHTML").then(data => | 80 .getAttribute("innerHTML").then(data => |
90 data.includes("Tests completed"))) | 81 data.includes("Tests completed"))) |
91 ).then(() => Promise.all([ | 82 ).then(() => Promise.all([[true, ".pass"], [false, ".fail"]].map( |
92 reportElements(true), | 83 ([success, sel]) => driver.findElements( |
93 reportElements(false) | 84 By.css(`#qunit-tests ${sel} .test-name`) |
94 ])) | 85 ).then(elements => Promise.all(elements.map(elem => |
86 elem.getAttribute("textContent").then(data => assert.ok(success, data)) | |
87 ))) | |
88 ))) | |
95 ); | 89 ); |
96 | 90 |
97 after(() => driver.quit()); | 91 after(() => driver.quit()); |
98 }); | 92 }); |
LEFT | RIGHT |