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

Side by Side Diff: test/wrappers/pages.js

Issue 29885555: Noissue - Automatically test popups on test pages (Closed)
Patch Set: Created Sept. 19, 2018, 7:45 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 }).then(() => callback(), callback); 133 }).then(() => callback(), callback);
134 `, filters.join("\n")) 134 `, filters.join("\n"))
135 ).then(error => 135 ).then(error =>
136 { 136 {
137 if (error) 137 if (error)
138 throw error; 138 throw error;
139 return this.driver.navigate().to(url); 139 return this.driver.navigate().to(url);
140 }).then(() => 140 }).then(() =>
141 getSections(this.driver) 141 getSections(this.driver)
142 ).then(sections => 142 ).then(sections =>
143 takeScreenshot(sections[i][1]) 143 {
144 ).then(screenshot => 144 let element = sections[i][1];
145 assert.ok( 145
146 screenshot.width == expectedScreenshot.width && 146 if (title.startsWith("$popup "))
147 screenshot.height == expectedScreenshot.height && 147 {
148 screenshot.data.compare(expectedScreenshot.data) == 0, 148 return element.findElement(
149 title 149 By.css("a[href],button")
150 ) 150 ).click().then(() =>
151 ); 151 this.driver.sleep(100)
152 ).then(() =>
153 this.driver.getAllWindowHandles()
154 ).then(handles =>
155 {
156 if (title.startsWith("$popup Exception -"))
157 {
158 assert.equal(handles.length, 3, title);
159
160 return this.driver.switchTo().window(handles[2]).then(() =>
161 this.driver.close()
162 ).then(() =>
163 this.driver.switchTo().window(handles[1])
164 );
165 }
166
167 assert.equal(handles.length, 2, title);
168 });
169 }
170
171 return takeScreenshot(element).then(screenshot =>
172 assert.ok(
173 screenshot.width == expectedScreenshot.width &&
174 screenshot.height == expectedScreenshot.height &&
175 screenshot.data.compare(expectedScreenshot.data) == 0,
176 title
177 )
178 );
179 });
152 } 180 }
153 return p2; 181 return p2;
154 }); 182 });
155 return p1; 183 return p1;
156 }); 184 });
157 }); 185 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld