Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(matchers): add by id matcher #1

Merged
merged 1 commit into from
Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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