mirror of
https://github.com/appium/appium.git
synced 2026-01-14 14:19:56 -06:00
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
var wd = require("wd")
|
|
, assert = require("assert")
|
|
, username = process.env.SAUCE_USERNAME // Omit for a local test run
|
|
, accessKey = process.env.SAUCE_ACCESS_KEY // Omit for a local test run
|
|
, appURL = "http://appium.s3.amazonaws.com/TestApp6.0.app.zip";
|
|
|
|
// Instantiate a new browser sessoin
|
|
var browser = wd.remote(
|
|
"ondemand.saucelabs.com" // Omit for a local test run
|
|
, 80, username, accessKey // Omit for a local test run
|
|
);
|
|
|
|
// See whats going on
|
|
browser.on('status', function(info) {
|
|
console.log('\x1b[36m%s\x1b[0m', info);
|
|
});
|
|
|
|
browser.on('command', function(meth, path, data) {
|
|
console.log(' > \x1b[33m%s\x1b[0m: %s', meth, path, data || '');
|
|
});
|
|
|
|
// Run the test
|
|
browser
|
|
.chain()
|
|
.init({
|
|
device: 'iPhone Simulator'
|
|
, name: "Appium: with WD"
|
|
, platform:'Mac 10.8'
|
|
, app: appURL
|
|
, version: ''
|
|
, browserName: ''
|
|
})
|
|
.elementsByTagName("textField", function(err, els) {
|
|
els[0].type('2', function(err) {
|
|
els[1].type('3', function(err) {
|
|
browser.elementsByTagName('button', function(err, btns) {
|
|
btns[0].click(function(err) {
|
|
browser.elementsByTagName('staticText', function(err, texts) {
|
|
texts[0].text(function(err, str) {
|
|
assert.equal(str, 5);
|
|
browser.quit();
|
|
})
|
|
})
|
|
});
|
|
})
|
|
});
|
|
});
|
|
})
|