mirror of
https://github.com/appium/appium.git
synced 2026-02-05 00:58:56 -06:00
Merge pull request #406 from jlipps/master
fix misc android issues raised by testsuite
This commit is contained in:
@@ -39,7 +39,7 @@ describeWd('basic', function(h) {
|
||||
h.driver.elementByLinkText("foobar", function(err) {
|
||||
should.exist(err);
|
||||
err.status.should.equal(13);
|
||||
err.cause.value.origValue.should.eql("link text is not a supported selector strategy");
|
||||
err.cause.value.origValue.should.eql("Strategy link text is not valid.");
|
||||
h.driver.elementByName("Animation", function(err, el) {
|
||||
should.not.exist(err);
|
||||
should.exist(el);
|
||||
|
||||
@@ -27,6 +27,8 @@ describeWd('gestures', function(h) {
|
||||
});
|
||||
});
|
||||
it('should click via x/y pct', function(done) {
|
||||
// this test depends on having a certain size screen, obviously
|
||||
// I use a nexus something or other phone style thingo
|
||||
h.driver.execute("mobile: tap", [{x: 0.6, y: 0.8}], function(err) {
|
||||
should.not.exist(err);
|
||||
var next = function() {
|
||||
@@ -34,7 +36,7 @@ describeWd('gestures', function(h) {
|
||||
should.not.exist(err);
|
||||
els[1].text(function(err, text) {
|
||||
should.not.exist(err);
|
||||
text.should.equal("Assets");
|
||||
text.should.equal("Morse Code");
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -106,7 +108,7 @@ describeWd('gestures', function(h) {
|
||||
h.driver.elementByName("Views", function(err) {
|
||||
// shouldn't be visible
|
||||
should.exist(err);
|
||||
h.driver.flick(0, -500, function(err) {
|
||||
h.driver.flick(0, -100, function(err) {
|
||||
should.not.exist(err);
|
||||
h.driver.elementByName("Views", function(err, el) {
|
||||
should.not.exist(err);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.appium.android.bootstrap;
|
||||
|
||||
import io.appium.android.bootstrap.exceptions.AndroidCommandException;
|
||||
import io.appium.android.bootstrap.exceptions.UnallowedTagNameException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -35,10 +36,10 @@ public class AndroidElementClassMap {
|
||||
* @throws AndroidCommandException
|
||||
*/
|
||||
public static String match(String selector_text)
|
||||
throws AndroidCommandException {
|
||||
throws AndroidCommandException, UnallowedTagNameException {
|
||||
final AndroidElementClassMap inst = AndroidElementClassMap.getInstance();
|
||||
if (inst.unallowed.contains(selector_text)) {
|
||||
throw new AndroidCommandException(selector_text);
|
||||
throw new UnallowedTagNameException(selector_text);
|
||||
} else {
|
||||
final String mappedSel = inst.map.get(selector_text);
|
||||
if (mappedSel != null) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import io.appium.android.bootstrap.exceptions.AndroidCommandException;
|
||||
import io.appium.android.bootstrap.exceptions.ElementNotFoundException;
|
||||
import io.appium.android.bootstrap.exceptions.ElementNotInHashException;
|
||||
import io.appium.android.bootstrap.exceptions.InvalidStrategyException;
|
||||
import io.appium.android.bootstrap.exceptions.UnallowedTagNameException;
|
||||
import io.appium.android.bootstrap.selector.Strategy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -61,7 +62,7 @@ public class Find extends CommandHandler {
|
||||
+ " with the contextId: " + contextId);
|
||||
|
||||
final Boolean multiple = (Boolean) params.get("multiple");
|
||||
final boolean isXpath = strategy.equals("xpath");
|
||||
final boolean isXpath = strategy.equalsIgnoreCase("xpath");
|
||||
|
||||
if (isXpath) {
|
||||
final JSONArray xpathPath = (JSONArray) params.get("path");
|
||||
@@ -83,6 +84,8 @@ public class Find extends CommandHandler {
|
||||
return getErrorResult(e.getMessage());
|
||||
} catch (final ElementNotFoundException e) {
|
||||
return getErrorResult(e.getMessage());
|
||||
} catch (final UnallowedTagNameException e) {
|
||||
return getErrorResult(e.getMessage());
|
||||
} catch (final ElementNotInHashException e) {
|
||||
return getErrorResult(e.getMessage());
|
||||
} catch (final UiObjectNotFoundException e) {
|
||||
@@ -101,6 +104,8 @@ public class Find extends CommandHandler {
|
||||
} catch (final ElementNotFoundException e) {
|
||||
return new AndroidCommandResult(WDStatus.NO_SUCH_ELEMENT,
|
||||
e.getMessage());
|
||||
} catch (final UnallowedTagNameException e) {
|
||||
return getErrorResult(e.getMessage());
|
||||
} catch (final AndroidCommandException e) {
|
||||
return getErrorResult(e.getMessage());
|
||||
} catch (final ElementNotInHashException e) {
|
||||
@@ -173,7 +178,7 @@ public class Find extends CommandHandler {
|
||||
*/
|
||||
private UiSelector getSelector(final Strategy strategy, final String text,
|
||||
final Boolean many) throws InvalidStrategyException,
|
||||
AndroidCommandException {
|
||||
AndroidCommandException, UnallowedTagNameException {
|
||||
UiSelector sel = new UiSelector();
|
||||
|
||||
switch (strategy) {
|
||||
@@ -225,7 +230,7 @@ public class Find extends CommandHandler {
|
||||
*/
|
||||
private UiSelector getSelectorForXpath(final JSONArray path,
|
||||
final String attr, String constraint, final boolean substr)
|
||||
throws AndroidCommandException {
|
||||
throws AndroidCommandException, UnallowedTagNameException {
|
||||
UiSelector s = new UiSelector();
|
||||
JSONObject pathObj;
|
||||
String nodeType;
|
||||
|
||||
Reference in New Issue
Block a user