mirror of
https://github.com/appium/appium.git
synced 2026-02-11 12:29:48 -06:00
add appium android on sauce test for node
This commit is contained in:
42
sample-code/examples/node/sauce-android.js
Normal file
42
sample-code/examples/node/sauce-android.js
Normal file
@@ -0,0 +1,42 @@
|
||||
/*global it:true */
|
||||
|
||||
/* EXAMPLE APPIUM + SAUCE LABS INTEGRATION
|
||||
First: npm install mocha -g; npm install wd
|
||||
Usage: SAUCE_USERNAME=xxx SAUCE_ACCESS_KEY=yyy mocha sauce-android.js */
|
||||
|
||||
"use strict";
|
||||
|
||||
var should = require("should")
|
||||
, appUrl = 'http://appium.s3.amazonaws.com/NotesList.apk'
|
||||
, dbPath = "../../../test/helpers/driverblock.js"
|
||||
, describeSauce = require(dbPath).describeForSauce(appUrl, 'Android')
|
||||
, extraCaps = {
|
||||
name: "Appium Test on Sauce"
|
||||
, "app-activity": "NotesList"
|
||||
, "app-package": "com.example.android.notepad"
|
||||
};
|
||||
|
||||
describeSauce('notes app', function(h) {
|
||||
it('should save a note', function(done) {
|
||||
h.driver.elementByName("New note", function(err, el) {
|
||||
el.click(function() {
|
||||
h.driver.elementByTagName("textfield", function(err, el) {
|
||||
el.sendKeys("This is a new note!", function() {
|
||||
h.driver.elementByName("Save", function(err, el) {
|
||||
el.click(function() {
|
||||
h.driver.elementsByTagName("text", function(err, els) {
|
||||
els[2].text(function(err, text) {
|
||||
text.should.equal("This is a new note!");
|
||||
els[2].click(function() {
|
||||
h.driver.quit(done);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}, extraCaps);
|
||||
Reference in New Issue
Block a user