-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This enables us to refactor matchers more easily
- Loading branch information
1 parent
30eeefd
commit 7a98196
Showing
4 changed files
with
561 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,262 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`android matcher invocations should remain the same 1`] = ` | ||
Object { | ||
"args": Array [ | ||
"mySelector", | ||
], | ||
"method": "matcherForContentDescription", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 2`] = ` | ||
Object { | ||
"args": Array [ | ||
"mySelector", | ||
], | ||
"method": "matcherForTestId", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 3`] = ` | ||
Object { | ||
"args": Array [ | ||
"mySelector", | ||
], | ||
"method": "matcherForClass", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 4`] = ` | ||
Object { | ||
"args": Array [ | ||
"mySelector", | ||
], | ||
"method": "matcherForText", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 5`] = ` | ||
Object { | ||
"args": Array [ | ||
"mySelector", | ||
], | ||
"method": "matcherForContentDescription", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 6`] = ` | ||
Object { | ||
"args": Array [ | ||
Object { | ||
"type": "Invocation", | ||
"value": Object { | ||
"args": Array [ | ||
"mySelector", | ||
], | ||
"method": "matcherForContentDescription", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
}, | ||
}, | ||
Object { | ||
"type": "Invocation", | ||
"value": Object { | ||
"args": Array [ | ||
"myOtherSelector", | ||
], | ||
"method": "matcherForContentDescription", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
}, | ||
}, | ||
], | ||
"method": "matcherWithAncestor", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 7`] = ` | ||
Object { | ||
"args": Array [ | ||
Object { | ||
"type": "Invocation", | ||
"value": Object { | ||
"args": Array [ | ||
"mySelector", | ||
], | ||
"method": "matcherForContentDescription", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
}, | ||
}, | ||
Object { | ||
"type": "Invocation", | ||
"value": Object { | ||
"args": Array [ | ||
"myOtherSelector", | ||
], | ||
"method": "matcherForContentDescription", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
}, | ||
}, | ||
], | ||
"method": "matcherWithDescendant", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 8`] = ` | ||
Object { | ||
"args": Array [ | ||
Object { | ||
"type": "Invocation", | ||
"value": Object { | ||
"args": Array [ | ||
"mySelector", | ||
], | ||
"method": "matcherForContentDescription", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
}, | ||
}, | ||
Object { | ||
"type": "Invocation", | ||
"value": Object { | ||
"args": Array [ | ||
"myOtherSelector", | ||
], | ||
"method": "matcherForContentDescription", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
}, | ||
}, | ||
], | ||
"method": "matcherForAnd", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 9`] = ` | ||
Object { | ||
"args": Array [ | ||
Object { | ||
"type": "Invocation", | ||
"value": Object { | ||
"args": Array [ | ||
"mySelector", | ||
], | ||
"method": "matcherForContentDescription", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
}, | ||
}, | ||
Object { | ||
"type": "Invocation", | ||
"value": Object { | ||
"args": Array [ | ||
"myOtherSelector", | ||
], | ||
"method": "matcherForContentDescription", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
}, | ||
}, | ||
], | ||
"method": "matcherForOr", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 10`] = ` | ||
Object { | ||
"args": Array [], | ||
"method": "matcherForSufficientlyVisible", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 11`] = ` | ||
Object { | ||
"args": Array [], | ||
"method": "matcherForNotVisible", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 12`] = ` | ||
Object { | ||
"args": Array [], | ||
"method": "matcherForNotNull", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`android matcher invocations should remain the same 13`] = ` | ||
Object { | ||
"args": Array [], | ||
"method": "matcherForNull", | ||
"target": Object { | ||
"type": "Class", | ||
"value": "com.wix.detox.espresso.DetoxMatcher", | ||
}, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
describe('android matcher', async () => { | ||
let m; | ||
|
||
beforeEach(() => { | ||
m = require('./matcher'); | ||
}); | ||
|
||
it("invocations should remain the same", () => { | ||
const textBasedMatchers = ['LabelMatcher', 'IdMatcher', 'TypeMatcher', 'TextMatcher', 'ValueMatcher']; | ||
const chainableMatchers = ['withAncestor', 'withDescendant', 'and', 'or']; | ||
const noArgsMatchers = ['VisibleMatcher', 'NotVisibleMatcher', 'ExistsMatcher', 'NotExistsMatcher']; | ||
|
||
textBasedMatchers.forEach(matcher => { | ||
expect(new m[matcher]("mySelector")._call()).toMatchSnapshot(); | ||
}); | ||
|
||
chainableMatchers.forEach(matcher => { | ||
expect(new m.LabelMatcher("mySelector")[matcher](new m.LabelMatcher("myOtherSelector"))._call()).toMatchSnapshot() | ||
}); | ||
|
||
noArgsMatchers.forEach(matcher => { | ||
expect(new m[matcher]()._call()).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.