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

Delta Between Two Patch Sets: test/wrappers/pages.js

Issue 29938555: Noissue - Upgrade to selenium-webdriver 4.0.0-alpha (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Fixed timing issue on Chrome by taking screenshots in order Created Nov. 9, 2018, 10:17 p.m.
Right Patch Set: Renamed loc to rect Created Nov. 9, 2018, 10:26 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 | « test/browsers/firefox.js ('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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return element.takeScreenshot().then( 60 return element.takeScreenshot().then(
61 imageFromBase64, 61 imageFromBase64,
62 62
63 // Chrome doesn't support taking screenshots of individual elements. So as 63 // Chrome doesn't support taking screenshots of individual elements. So as
64 // a workaround, we scroll to the position of the element, take a screenshot 64 // a workaround, we scroll to the position of the element, take a screenshot
65 // of the viewport and crop it to the size and position of our element. 65 // of the viewport and crop it to the size and position of our element.
66 // This is not guaranteed to work on other browsers (mostly because 66 // This is not guaranteed to work on other browsers (mostly because
67 // the behavior of Driver.takeScreenshot() may vary across browsers). 67 // the behavior of Driver.takeScreenshot() may vary across browsers).
68 () => 68 () =>
69 lastScreenshot = Promise.all([element.getRect(), 69 lastScreenshot = Promise.all([element.getRect(),
70 lastScreenshot]).then(([loc]) => 70 lastScreenshot]).then(([rect]) =>
hub 2018/11/09 22:23:31 you might have taken the wrong version of the patc
Sebastian Noack 2018/11/09 22:26:53 Oops, I indeed missed your last patch set. Fixed.
71 element.getDriver().executeScript(` 71 element.getDriver().executeScript(`
72 window.scrollTo(${loc.x}, ${loc.y}); 72 window.scrollTo(${rect.x}, ${rect.y});
73 return [window.scrollX, window.scrollY]; 73 return [window.scrollX, window.scrollY];
74 `).then(result => 74 `).then(result =>
75 { 75 {
76 let x = loc.x - result[0]; 76 let x = rect.x - result[0];
77 let y = loc.y - result[1]; 77 let y = rect.y - result[1];
78 78
79 return element.getDriver().takeScreenshot() 79 return element.getDriver().takeScreenshot()
80 .then(imageFromBase64) 80 .then(imageFromBase64)
81 .then(img => img.crop(x, y, loc.width, loc.height)); 81 .then(img => img.crop(x, y, rect.width, rect.height));
82 }) 82 })
83 ) 83 )
84 ).then(img => img.bitmap); 84 ).then(img => img.bitmap);
85 } 85 }
86 86
87 function getSections(driver) 87 function getSections(driver)
88 { 88 {
89 return driver.findElements(By.css("section")).then(elements => 89 return driver.findElements(By.css("section")).then(elements =>
90 Promise.all(elements.map(e => 90 Promise.all(elements.map(e =>
91 Promise.all([ 91 Promise.all([
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 `) 247 `)
248 ).then(([added, err]) => 248 ).then(([added, err]) =>
249 { 249 {
250 if (err) 250 if (err)
251 throw err; 251 throw err;
252 assert.ok(added, "subscription added"); 252 assert.ok(added, "subscription added");
253 }) 253 })
254 ) 254 )
255 ); 255 );
256 }); 256 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld