Skip to content

Commit

Permalink
Merge pull request #1 from ofirdagan/master
Browse files Browse the repository at this point in the history
feat(matchers): add by id matcher
  • Loading branch information
Tal Kol authored Jul 28, 2016
2 parents c8281ea + b478a90 commit 2b44465
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
####
# Webstrom

.idea
11 changes: 10 additions & 1 deletion detox/src/ios/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ class LabelMatcher extends Matcher {
}
}

class IdMatcher extends Matcher {
constructor(value) {
super();
if (typeof value !== 'string') throw new Error(`IdMatcher ctor argument must be a string, got ${typeof value}`);
this._call = invoke.call(invoke.IOS.Class('GREYMatchers'), 'matcherForAccessibilityId:', value);
}
}

class VisibleMatcher extends Matcher {
constructor() {
super();
Expand Down Expand Up @@ -110,7 +118,8 @@ function element(matcher) {
}

const by = {
label: (value) => new LabelMatcher(value)
label: (value) => new LabelMatcher(value),
id: (value) => new IdMatcher(value)
};

const exportGlobals = function () {
Expand Down

0 comments on commit 2b44465

Please sign in to comment.