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

Unified Diff: test/wrappers/pages.js

Issue 29892560: Noissue - Moved subscription link test to separate test case (Closed)
Patch Set: Created Sept. 26, 2018, 11:31 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
@@ -48,55 +48,6 @@
);
}
-function testSubscribeLink(driver)
-{
- return driver.findElement(By.id("subscribe-button")).click().then(() =>
- driver.wait(() =>
- driver.getAllWindowHandles().then(handles =>
- handles.length > 2 ? handles : null
- ), 3000
- )
- ).then(handles =>
- closeWindow(driver, handles[2], handles[1], () =>
- driver.wait(until.ableToSwitchToFrame(0), 1000).then(() =>
- driver.wait(until.elementLocated(By.id("dialog-content-predefined")),
- 1000)
- ).then(dialog =>
- Promise.all([
- dialog.isDisplayed(),
- dialog.findElement(By.css("h3")).getText()
- ]).then(([displayed, title]) =>
- {
- assert.ok(displayed, "subscribe link: dialog shown");
- assert.equal(title, "ABP Testcase Subscription",
- "subscribe link: title shown in dialog");
-
- return dialog.findElement(By.css("button")).click();
- })
- ).then(() =>
- driver.executeAsyncScript(`
- let callback = arguments[arguments.length - 1];
- browser.runtime.sendMessage({type: "subscriptions.get",
- ignoreDisabled: true,
- downloadable: true}).then(subs =>
- subs.some(s =>
- s.url == "${TEST_PAGES_URL}abp-testcase-subscription.txt"
- )
- ).then(
- res => callback([res, null]),
- err => callback([null, err])
- );
- `)
- ).then(([added, err]) =>
- {
- if (err)
- throw err;
- assert.ok(added, "subscribe link: subscription added");
- })
- )
- );
-}
-
function imageFromBase64(s)
{
return Jimp.read(Buffer.from(s, "base64"));
@@ -155,7 +106,7 @@
Promise.all(elements.map(elem => elem.getAttribute("href")))
).then(urls =>
{
- let p1 = testSubscribeLink(this.driver);
+ let p1 = Promise.resolve();
for (let url of urls)
p1 = p1.then(() =>
this.driver.navigate().to(url)
@@ -252,3 +203,54 @@
return p1;
});
});
+
+it("subscribe link", function()
+{
+ return this.driver.navigate().to(TEST_PAGES_URL).then(() =>
+ this.driver.findElement(By.id("subscribe-button")).click()
+ ).then(() =>
+ this.driver.wait(() =>
+ this.driver.getAllWindowHandles().then(handles =>
+ handles.length > 2 ? handles : null
+ ), 3000
+ )
+ ).then(handles =>
+ closeWindow(this.driver, handles[2], handles[1], () =>
+ this.driver.wait(until.ableToSwitchToFrame(0), 1000).then(() =>
+ this.driver.wait(
+ until.elementLocated(By.id("dialog-content-predefined")), 1000
+ )
+ ).then(dialog =>
+ Promise.all([
+ dialog.isDisplayed(),
+ dialog.findElement(By.css("h3")).getText()
+ ]).then(([displayed, title]) =>
+ {
+ assert.ok(displayed, "dialog shown");
+ assert.equal(title, "ABP Testcase Subscription", "title matches");
+
+ return dialog.findElement(By.css("button")).click();
+ })
+ ).then(() =>
+ this.driver.executeAsyncScript(`
+ let callback = arguments[arguments.length - 1];
+ browser.runtime.sendMessage({type: "subscriptions.get",
+ ignoreDisabled: true,
+ downloadable: true}).then(subs =>
+ subs.some(s =>
+ s.url == "${TEST_PAGES_URL}abp-testcase-subscription.txt"
+ )
+ ).then(
+ res => callback([res, null]),
+ err => callback([null, err])
+ );
+ `)
+ ).then(([added, err]) =>
+ {
+ if (err)
+ throw err;
+ assert.ok(added, "subscription added");
+ })
+ )
+ );
+});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld