Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Use done cb in Selenium tests. (#4109) (#4123)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenba authored and jaredhirsch committed Feb 16, 2018
1 parent da60008 commit ec53f04
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ describe("Test Screenshots", function() {
return null;
});

it("should find the add-on button", function() {
it("should find the add-on button", function(done) {
this.timeout(15000);
return promiseFinally(
promiseFinally(
getChromeElement(driver, shooterSelector)
.then((button) => button.getAttribute("label"))
.then((label) => {
Expand All @@ -190,14 +190,15 @@ describe("Test Screenshots", function() {
} else {
assert.equal(label, "Firefox Screenshots");
}
done();
}),
() => {
driver.setContext(firefox.Context.CONTENT);
});
}).catch(done);
});

it("should take a shot", function() {
return driver.get(backend).then(() => {
it("should take a shot", function(done) {
driver.get(backend).then(() => {
return startScreenshots(driver);
}).then((onboarding) => {
if (!onboarding) {
Expand Down Expand Up @@ -234,11 +235,12 @@ describe("Test Screenshots", function() {
if (!/^\/[^/]+\/localhost$/.test(restUrl)) {
throw new Error(`Unexpected URL: ${shotUrl}`);
}
});
done();
}).catch(done);
});

it("should take an auto selection shot", function() {
return driver.get(backend).then(() => {
it("should take an auto selection shot", function(done) {
driver.get(backend).then(() => {
return startScreenshots(driver);
}).then(() => {
return driver.wait(
Expand Down Expand Up @@ -270,12 +272,13 @@ describe("Test Screenshots", function() {
if (!/^\/[^/]+\/localhost$/.test(restUrl)) {
throw new Error(`Unexpected URL: ${shotUrl}`);
}
});
done();
}).catch(done);
});

it("should navigate to My Shots", function() {
it("should navigate to My Shots", function(done) {
let currentTabs, startingTabCount;
return driver.getAllWindowHandles().then(tabs => {
driver.getAllWindowHandles().then(tabs => {
startingTabCount = tabs.length;
}).then(() => {
return driver.get(backend);
Expand Down Expand Up @@ -310,7 +313,8 @@ describe("Test Screenshots", function() {
return driver.getCurrentUrl();
}).then(url => {
assert.equal(url, `${backend}/shots`, `Navigated to ${url} instead of My Shots at ${backend}/shots`);
});
done();
}).catch(done);
});

});

0 comments on commit ec53f04

Please sign in to comment.