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

Unified 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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/wrappers/pages.js
===================================================================
--- a/test/wrappers/pages.js
+++ b/test/wrappers/pages.js
@@ -140,15 +140,43 @@
}).then(() =>
getSections(this.driver)
).then(sections =>
- takeScreenshot(sections[i][1])
- ).then(screenshot =>
- assert.ok(
- screenshot.width == expectedScreenshot.width &&
- screenshot.height == expectedScreenshot.height &&
- screenshot.data.compare(expectedScreenshot.data) == 0,
- title
- )
- );
+ {
+ let element = sections[i][1];
+
+ if (title.startsWith("$popup "))
+ {
+ return element.findElement(
+ By.css("a[href],button")
+ ).click().then(() =>
+ this.driver.sleep(100)
+ ).then(() =>
+ this.driver.getAllWindowHandles()
+ ).then(handles =>
+ {
+ if (title.startsWith("$popup Exception -"))
+ {
+ assert.equal(handles.length, 3, title);
+
+ return this.driver.switchTo().window(handles[2]).then(() =>
+ this.driver.close()
+ ).then(() =>
+ this.driver.switchTo().window(handles[1])
+ );
+ }
+
+ assert.equal(handles.length, 2, title);
+ });
+ }
+
+ return takeScreenshot(element).then(screenshot =>
+ assert.ok(
+ screenshot.width == expectedScreenshot.width &&
+ screenshot.height == expectedScreenshot.height &&
+ screenshot.data.compare(expectedScreenshot.data) == 0,
+ title
+ )
+ );
+ });
}
return p2;
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld