Skip to content
Browse files

enable orientation tests in webview app which supports them

  • Loading branch information...
1 parent ed5d5b9 commit 48ffc987911e9422f56fb084411b73ee8469760f @jlipps committed Feb 26, 2013
Showing with 24 additions and 17 deletions.
  1. +3 −3 app/uiauto/appium/app.js
  2. +0 −14 test/functional/testapp/basic.js
  3. +21 −0 test/functional/webview/orientation.js
View
6 app/uiauto/appium/app.js
@@ -55,17 +55,17 @@ $.extend(au, {
value: 'Unsupported orientation: ' + orientation
};
}
- var newOrientation = au.getScreenOrientation();
+ var newOrientation = au.getScreenOrientation().value;
if (newOrientation == orientation) {
return {
status: codes.Success.code
, value: newOrientation
};
} else {
- console.log("returning error");
return {
status: codes.UnknownError.code
- , value: "Orientation change did not take effect"
+ , value: "Orientation change did not take effect: expected " +
+ orientation + " but got " + newOrientation
};
}
}
View
14 test/functional/testapp/basic.js
@@ -130,20 +130,6 @@ describeWd('calc app', function(h) {
//});
- // TOFIX: THIS TEST ALWAYS RETURNS 'undefined' orientation
- // LOOKS like UIATargetClass.setDeviceOrientation is not working properly with simulator?
- //var testOrientation = function(specOrientation) {
- //it('should get and set the screen orientation - ' + specOrientation, function(done) {
- //h.driver.setOrientation(specOrientation, function(err, orientation) {
- //assert.equal(orientation, specOrientation);
- //h.driver.getOrientation(function(err, orientation) {
- //assert.equal(orientation, specOrientation);
- //done();
- //});
- //});
- //});
- //};
- //_.each(["PORTRAIT", "LANDSCAPE"], testOrientation);
it('should be able to get text of a button', function(done) {
h.driver.elementsByTagName('button', function(err, els) {
View
21 test/functional/webview/orientation.js
@@ -0,0 +1,21 @@
+/*global it:true */
+"use strict";
+
+var describeWd = require("../../helpers/driverblock.js").describeForApp('WebViewApp')
+ , _ = require('underscore')
+ , should = require('should');
+
+describeWd('orientation', function(h) {
+ var testOrientation = function(specOrientation) {
+ it('should get and set - ' + specOrientation, function(done) {
+ h.driver.setOrientation(specOrientation, function(err, orientation) {
+ orientation.should.eql(specOrientation);
+ h.driver.getOrientation(function(err, orientation) {
+ orientation.should.eql(specOrientation);
+ done();
+ });
+ });
+ });
+ };
+ _.each(["PORTRAIT", "LANDSCAPE"], testOrientation);
+});

0 comments on commit 48ffc98

Please sign in to comment.
Something went wrong with that request. Please try again.