Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #296 from maudineormsby/master

Add getWindowSize and test.
  • Loading branch information...
commit 39ad87e9f714e202301872b11885afe986101702 2 parents 29c959d + 0ee4efe
Jonathan Lipps jlipps authored
Showing with 27 additions and 1 deletion.
  1. +13 −1 app/ios.js
  2. +14 −0 test/helpers/webview.js
14 app/ios.js
View
@@ -798,7 +798,19 @@ IOS.prototype.getSize = function(elementId, cb) {
IOS.prototype.getWindowSize = function(windowHandle, cb) {
if (this.curWindowHandle) {
- cb(new NotImplementedError(), null);
+ if(windowHandle !== "current") {
+ cb(null, {
+ status: status.codes.NoSuchWindow.code
+ , value: "Currently only getting current window size is supported."
+ });
+ } else {
+ this.remote.executeAtom('get_window_size', [], function(err, res) {
+ cb(null, {
+ status: status.codes.Success.code
+ , value: res
+ });
+ });
+ }
} else {
if(windowHandle !== "current") {
cb(null, {
14 test/helpers/webview.js
View
@@ -341,6 +341,20 @@ module.exports.buildTests = function(webviewType) {
});
});
+ desc('getWindowSize', function(h) {
+ it('should return the right size', function(done) {
+ loadWebView(h.driver, function() {
+ h.driver.getWindowSize(function(err, size) {
+ should.not.exist(err);
+ // iphone and ipad
+ [356, 928, 788].should.include(size.height);
+ [320, 768, 414].should.include(size.width);
+ done();
+ });
+ });
+ });
+ });
+
desc('moveTo and click', function(h) {
it('should be able to click on arbitrary x-y elements', function(done) {
loadWebView(h.driver, function() {
Please sign in to comment.
Something went wrong with that request. Please try again.