-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
var host = process.env.APPIUM_HOST || "localhost"; | ||
var port = parseInt(process.env.APPIUM_PORT, 10) || 4723; | ||
var username = process.env.SAUCE_USERNAME; | ||
var accessKey = process.env.SAUCE_ACCESS_KEY; | ||
|
||
require('colors'); | ||
var chai = require("chai"); | ||
var chaiAsPromised = require("chai-as-promised"); | ||
chai.use(chaiAsPromised); | ||
chai.should(); | ||
|
||
var wd; | ||
try { | ||
wd = require('wd'); | ||
} catch( err ) { | ||
wd = require('../../lib/main'); | ||
} | ||
|
||
// enables chai assertion chaining | ||
chaiAsPromised.transferPromiseness = wd.transferPromiseness; | ||
|
||
var browser = wd.promiseChainRemote(host, port, username, accessKey); | ||
|
||
// optional extra logging | ||
browser.on('status', function(info) { | ||
console.log(info.cyan); | ||
}); | ||
browser.on('command', function(eventType, command, response) { | ||
console.log(' > ' + eventType.cyan, command, (response || '').grey); | ||
}); | ||
browser.on('http', function(meth, path, data) { | ||
console.log(' > ' + meth.magenta, path, (data || '').grey); | ||
}); | ||
|
||
var caps; | ||
|
||
caps = {device: 'iPhone Simulator'}; | ||
caps.deviceName = 'iPhone Retina (4-inch 64-bit)'; | ||
caps.platform = 'ios'; | ||
caps.version = '7.1'; | ||
caps['device-orientation'] = 'portrait'; | ||
caps.app = 'safari'; | ||
|
||
caps.name = 'Sauce Ios7 Appium Example'; | ||
|
||
browser.init(caps).then(function() { | ||
return browser | ||
.get("http://admc.io/wd/mobile-test-pages/index.html") | ||
.title() | ||
.should.become('WD Tests - Mobile') | ||
.elementById('theDiv').text() | ||
.should.eventually.include('bonjour') | ||
.elementsByCss('#theDiv .hello') | ||
.should.eventually.have.length(3) | ||
.shake() | ||
.contexts().print("contexts --> ") | ||
.fin(function() { return browser.quit(); }); | ||
}).done(); |