Skip to content

Commit

Permalink
Added appium 1.0 ios test
Browse files Browse the repository at this point in the history
  • Loading branch information
sebv committed Apr 18, 2014
1 parent 324d7c7 commit 6a0ee06
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions examples/mobile/appium_1_0_ios7_local.js
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();

0 comments on commit 6a0ee06

Please sign in to comment.