Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appium-uiauto

Package Overview
Dependencies
Maintainers
2
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appium-uiauto - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

2

package.json
{
"name": "appium-uiauto",
"version": "1.5.0",
"version": "1.5.1",
"description": "appium uiauto ios driver",

@@ -5,0 +5,0 @@ "main": "lib/main.js",

@@ -9,3 +9,3 @@ /* globals commands, chai */

#import "<ROOT_DIR>/uiauto/lib/mechanic-ext/basics-ext.js"
#import "<ROOT_DIR>/uiauto/lib/errors.js"
#import "<ROOT_DIR>/uiauto/lib/status.js"
#import "<ROOT_DIR>/uiauto/lib/commands.js"

@@ -12,0 +12,0 @@ "<POST_IMPORTS>"

@@ -1,2 +0,2 @@

/* globals $ */
/* globals $, rootPage */
'use strict';

@@ -10,3 +10,2 @@

describe("textfields", function () {
/* globals rootPage: true */
var ctx;

@@ -57,2 +56,102 @@ base.instrumentsInstanceInit()

describe("byUIAutomation", function () {
var ctx;
base.instrumentsInstanceInit()
.then(function (_ctx) { ctx = _ctx; }).done();
afterEach(function () {
return ctx.execFunc(
function () {
$('#UICatalog').first().tap();
$.delay(1000);
}
);
});
it('should use global context by default', function () {
return ctx.execFunc(
function () {
rootPage.clickMenuItem('Text Fields');
$.delay(2000);
var res = $.getElementsByUIAutomation('.getAllWithPredicate("type contains[c] \'textfield\'", true)');
return res;
}
).then(function (res) {
res.should.have.length(5);
res[0].ELEMENT.should.exist;
});
});
it('should retrieve context from cache when ctx param is a string', function () {
return ctx.execFunc(
function () {
rootPage.clickMenuItem('Text Fields');
$.delay(2000);
var parent = $.getElementByType('UIATableCell');
var parentId = $.getId(parent);
var res = $.getElementsByUIAutomation(
'.getAllWithPredicate("type contains[c] \'textfield\'", true)',
parentId
);
return res;
}
).then(function (res) {
res.should.have.length(1);
res[0].ELEMENT.should.exist;
});
});
it('should use context when ctx param is an object', function () {
return ctx.execFunc(
function () {
rootPage.clickMenuItem('Text Fields');
$.delay(2000);
var parent = $.getElementByType('UIATableCell');
var res = $.getElementsByUIAutomation(
'.getAllWithPredicate("type contains[c] \'textfield\'", true)',
parent
);
return res;
}
).then(function (res) {
res.should.have.length(1);
res[0].ELEMENT.should.exist;
});
});
it('should work when retrieving only one element', function () {
return ctx.execFunc(
function () {
rootPage.clickMenuItem('Text Fields');
$.delay(2000);
var res = [], parent;
var el = $.getElementByUIAutomation(
'.getAllWithPredicate("type contains[c] \'textfield\'", true)'
);
res.push(el);
parent = $.getElementsByType('UIATableCell')[1];
var parentId = $.getId(parent);
el = $.getElementByUIAutomation(
'.getAllWithPredicate("type contains[c] \'textfield\'", true)',
parentId
);
res.push(el);
parent = $.getElementsByType('UIATableCell')[2];
el = $.getElementByUIAutomation(
'.getAllWithPredicate("type contains[c] \'textfield\'", true)',
parent
);
res.push(el);
return res;
}
).then(function (res) {
res.should.have.length(3);
res[0].ELEMENT.should.exist;
});
});
});
});

@@ -1,2 +0,2 @@

/* globals $, STATUS */
/* globals $ */

@@ -3,0 +3,0 @@ (function () {

@@ -139,21 +139,21 @@ /* globals ERROR, $ */

elems = $.smartWrap(elems);
return elems.dedup();
return $.smartWrap(elems).dedup();
}
, _getElementsByUIAutomation: function (selectorCode, ctx) {
/* jshint evil: true */
var rootElement = this.mainWindow();
if (!selectorCode) throw new Error('No code provided.');
if (typeof ctx === 'string') {
rootElement = this.cache[ctx];
} else if (typeof ctx !== 'undefined') {
rootElement = ctx;
}
//There may not be a '.' at the beginning of the string, add for convenience
var code;
if (selectorCode[0] !== '.') {
selectorCode = '.' + selectorCode;
code = selectorCode;
} else if (ctx === null || typeof ctx === 'undefined') {
code = 'this.mainWindow()' + selectorCode;
} else if (typeof ctx === 'string') {
code = '$.getElement(\'' + ctx + '\')' + selectorCode;
} else {
code = 'ctx' + selectorCode;
}
//convert the string we were given into the element we want
var elems = eval("rootElement" + selectorCode);
$.debug('byUIAutomation: evaluating code: ' + code);
/* jshint evil: true */
var elems = eval(code);
return $.smartWrap(elems);

@@ -160,0 +160,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc