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

Delta Between Two Patch Sets: test/firefox.js

Issue 29864561: Issue 6884 - Migrate from nodeunit to mocha (Closed)
Left Patch Set: Move after() to bottom, use textContent instead of innerHTML Created Aug. 26, 2018, 6:59 p.m.
Right Patch Set: Inline reportElements() for better code locality Created Aug. 26, 2018, 7:09 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « package.json ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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 });
LEFTRIGHT
« package.json ('k') | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld