node sample fix

This commit is contained in:
sebv
2014-07-03 21:44:01 +08:00
parent 71efceca68
commit d4416339d8
3 changed files with 15 additions and 14 deletions

View File

@@ -1,5 +1,9 @@
#Node.js samples
## prerequisites
Upgrade Mocha to the latest version before running the tests.
##iOS
### local

View File

@@ -1,7 +1,7 @@
/*
The appium specific methods are not yet implemented by selenium-webdriver.
However it is possible to attach an existing selenium-webdriver to a wd
browser instance as below.
However it is possible to attach an existing selenium-webdriver session to
a wd browser instance as below.
prerequisite:
npm install selenium-webdriver

View File

@@ -11,7 +11,7 @@ describe("selendroid simple", function () {
var driver;
var allPassed = true;
before(function (done) {
before(function () {
var serverConfig = process.env.SAUCE ?
serverConfigs.sauce : serverConfigs.local;
driver = wd.promiseChainRemote(serverConfig);
@@ -23,33 +23,31 @@ describe("selendroid simple", function () {
desired.name = 'selendroid - simple';
desired.tags = ['sample'];
}
driver
return driver
.init(desired)
.setImplicitWaitTimeout(3000)
.nodeify(done);
.setImplicitWaitTimeout(3000);
});
after(function (done) {
driver
after(function () {
return 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 (done) {
it("should find elements", function () {
return driver
.waitForElementByName('Animation')
.text().should.become('Animation')
.elementByClassName('android.widget.TextView')
.text().should.become('Accessibility')
.text().should.eventually.match(/Accessibility|API Demos/)
.elementByName('App').click()
.waitForElementByXPath('//TextView[@name=\'Action Bar\']')
.elementsByClassName('android.widget.TextView')
@@ -57,7 +55,6 @@ describe("selendroid simple", function () {
.back()
.sleep(3000)
.waitForElementByName('Animation', 5000, 500)
.text().should.become('Animation')
.nodeify(done);
.text().should.become('Animation');
});
});