Skip to content

Instantly share code, notes, and snippets.

@prolificcoder
Created July 12, 2013 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prolificcoder/5981646 to your computer and use it in GitHub Desktop.
Save prolificcoder/5981646 to your computer and use it in GitHub Desktop.
attempt to add a test for selected
/*global it:true */
"use strict";
var path = require('path')
, appPath = path.resolve(__dirname, "../../../sample-code/apps/ApiDemos/bin/ApiDemos-debug.apk")
, appPkg = "com.example.android.apis"
, appAct = ".ApiDemos"
, describeWd = require("../../helpers/driverblock.js").describeForApp(appPath,
"android", appPkg, appAct)
, should = require('should');
describeWd('get attribute', function(h) {
// it('should be able to find text attribute', function(done) {
// h.driver.elementByName('Animation', function(err, el) {
// should.not.exist(err);
// el.getAttribute('text', function(err, text) {
// should.not.exist(err);
// text.should.equal("Animation");
// done();
// });
// });
// });
// it('should be able to find name attribute', function(done) {
// h.driver.elementByName('Animation', function(err, el) {
// should.not.exist(err);
// el.getAttribute('name', function(err, text) {
// should.not.exist(err);
// text.should.equal("Animation");
// done();
// });
// });
// });
// it('should be able to find name attribute, falling back to text', function(done) {
// h.driver.elementByName('Animation', function(err, el) {
// should.not.exist(err);
// el.click(function(err) {
// should.not.exist(err);
// h.driver.elementsByTagName('text', function(err, els) {
// should.not.exist(err);
// els[1].getAttribute('name', function(err, text) {
// should.not.exist(err);
// text.should.equal("Bouncing Balls");
// done();
// });
// });
// });
// });
// });
// it('should be able to find displayed attribute', function(done) {
// h.driver.elementByName('Animation', function(err, el) {
// should.not.exist(err);
// el.getAttribute('displayed', function(err, val) {
// should.not.exist(err);
// val.should.equal(true);
// done();
// });
// });
// });
it('should be able to find selected attribute', function(done) {
h.driver.execute("mobile: find", [["scroll",[[3, "views"]],[[7, "views"]]]], function(err, el) {
should.not.exist(err);
el.click(function(err) {
should.not.exist(err);
h.driver.elementByName('Tabs', function(err, el1) {
should.not.exist(err);
el1.click(function(err) {
h.driver.elementByName('1. Content By Id', function(err, el2) {
should.not.exist(err);
el2.click(function(err) {
h.driver.elementByName('TAB1', function(err, el3) {
should.not.exist(err);
el3.click(function(err) {
el3.getAttribute('selected', function(err, val) {
should.not.exist(err);
val.should.equal(true);
done();
});
});
});
});
});
});
});
});
});
});
// it('should be able to find displayed attribute through normal func', function(done) {
// h.driver.elementByName('Animation', function(err, el) {
// should.not.exist(err);
// el.displayed(function(err, val) {
// should.not.exist(err);
// val.should.equal(true);
// done();
// });
// });
// });
// it('should be able to get element location', function(done) {
// h.driver.elementByName('Animation', function(err, el) {
// should.not.exist(err);
// el.getLocation(function(err, loc) {
// should.not.exist(err);
// [0].should.include(loc.x);
// [183].should.include(loc.y);
// done();
// });
// });
// });
// TODO: tests for checkable, checked, clickable, focusable, focused,
// longClickable, scrollable, selected
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment