Skip to content

Commit

Permalink
update selendroid-simple test so it passes
Browse files Browse the repository at this point in the history
  • Loading branch information
jlipps committed Jul 2, 2014
1 parent 8f8d716 commit 90f1a0e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions sample-code/examples/node/selendroid-simple.js
Expand Up @@ -11,7 +11,7 @@ describe("selendroid simple", function () {
var driver;
var allPassed = true;

before(function () {
before(function (done) {
var serverConfig = process.env.SAUCE ?
serverConfigs.sauce : serverConfigs.local;
driver = wd.promiseChainRemote(serverConfig);
Expand All @@ -23,38 +23,41 @@ describe("selendroid simple", function () {
desired.name = 'selendroid - simple';
desired.tags = ['sample'];
}
return driver
driver
.init(desired)
.setImplicitWaitTimeout(3000);
.setImplicitWaitTimeout(3000)
.nodeify(done);
});

after(function () {
return driver
after(function (done) {
driver
.quit()
.finally(function () {
if (process.env.SAUCE) {
return driver.sauceJobStatus(allPassed);
}
});
})
.nodeify(done);
});

afterEach(function () {
allPassed = allPassed && this.currentTest.state === 'passed';
});

it("should find elements", function () {
it("should find elements", function (done) {
return driver
.waitForElementByName('Animation')
.text().should.become('Animation')
.elementByClassName('android.widget.TextView')
.text().should.become('API Demos')
.text().should.become('Accessibility')
.elementByName('App').click()
.waitForElementByXPath('//TextView[@name=\'Action Bar\']')
.elementsByClassName('android.widget.TextView')
.should.eventually.have.length.above(20)
.back()
.sleep(3000)
.waitForElementByName('Animation', 5000, 500)
.text().should.become('Animation');
.text().should.become('Animation')
.nodeify(done);
});
});

3 comments on commit 90f1a0e

@sebv
Copy link
Member

@sebv sebv commented on 90f1a0e Jul 2, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the nodeify(done); anymore, latest mocha understands promises.

@jlipps
Copy link
Member Author

@jlipps jlipps commented on 90f1a0e Jul 2, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I needed it for the tests to pass. I guess another solution could have been to upgrade mocha?

@sebv
Copy link
Member

@sebv sebv commented on 90f1a0e Jul 2, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this recently to make sure packages are outdated, this is great:

npm install david -g
david -g

Also work for local package.json.

Please sign in to comment.