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(iOS): add system-dialogs interaction support. #4457

Merged
merged 43 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f947eb5
feat(ios, system): add system APIs, no implementation.
asafkorem Apr 14, 2024
1b5860c
test(ios, system): initial acceptance tests.
asafkorem Apr 14, 2024
7efed02
docs(ios, system): initial system APIs docs
asafkorem Apr 14, 2024
78f1f77
DetoxXCUITestRunner: initial commit.
asafkorem Apr 21, 2024
344c54d
build: add xcuitest-runner build scripts.
asafkorem Apr 21, 2024
96bed7d
docs(cli): update Detox CLI docs.
asafkorem Apr 21, 2024
125855d
feat(iOS): implement `system` APIs.
asafkorem Apr 21, 2024
2395ce8
docs(system): make doclint happy.
asafkorem Apr 21, 2024
d7dc870
test(unit): fix unit tests.
asafkorem Apr 21, 2024
e45d8db
test(unit): add tests for XCUITestRunner.
asafkorem Apr 23, 2024
0c70eaf
refactor: remove redundant import.
asafkorem Apr 23, 2024
6ce24f4
test(unit): add missing tests for expectTwo.
asafkorem Apr 23, 2024
47856b0
test(unit): add tests for unsupported error message.
asafkorem Apr 23, 2024
55f9ca7
test(coverage): add missing test.
asafkorem Apr 23, 2024
07555ec
test(coverage): add expectTwo test.
asafkorem Apr 23, 2024
f8ab47a
refactor(ios): remove unused parameter.
asafkorem Apr 23, 2024
c32082e
refactor(ios): remove unused parameter.
asafkorem Apr 23, 2024
3da624c
test(unit): fix tests.
asafkorem Apr 23, 2024
009a99e
test(e2e): make element accessible by adding top-padding.
asafkorem Apr 24, 2024
07672c6
docs(system): update API note and description.
asafkorem Apr 30, 2024
37ea53a
refactor(environment.js): use `crypto` and `memoize`.
asafkorem May 1, 2024
a0d0154
refactor: move `XCUITestRunner.js` to `src/ios/`.
asafkorem May 1, 2024
a86483f
refactor(XCUITestRunner): use `exec` instead of `execWithRetriesAndLo…
asafkorem May 1, 2024
ad9e137
feat(detox cli): add flag params to `build-framework-cache`.
asafkorem May 2, 2024
d54c569
refactor(detox cli): make aliases to build-framework-cache.
asafkorem May 2, 2024
1f3e650
docs(detox cli): update with new build-framework-cache api.
asafkorem May 2, 2024
63232af
fix(detox-cli): fix command name.
asafkorem May 2, 2024
bdc09e3
docs: make doclint happy.
asafkorem May 2, 2024
93ef6d5
test(unit): fix XCUITestRunner tests.
asafkorem May 2, 2024
e57beab
feat: use `detox` and `xcuitest` flags in framework cache commands.
asafkorem May 12, 2024
4932336
refactor(XCUITestRunner): replace `JSON.stringify` with `%j`.
asafkorem May 13, 2024
9b292bc
refactor: implement `assertDefined`.
asafkorem May 13, 2024
7310f6e
refactor(environment.js): use `_.once` instead of `_.memoize`.
asafkorem May 13, 2024
52cefa9
chore(ios): remove dead code.
asafkorem May 13, 2024
b7c8353
docs(system): add note about API subject to changes (experimental).
asafkorem May 13, 2024
c07f728
test: fix unit test.
asafkorem May 13, 2024
7e2726f
test: ignore branch coverage on covered line.
asafkorem May 13, 2024
8d9dd81
fix: use hint when asserting trace description.
asafkorem May 13, 2024
f4074c0
fix: assert internal error with `DetoxInternalError`.
asafkorem May 13, 2024
3a522cb
types: add note for system APIs - experimental.
asafkorem May 13, 2024
86d0dcb
test(unit): update snapshots.
asafkorem May 13, 2024
7cea0f4
chore: apply code review suggestions.
asafkorem May 19, 2024
e01a78a
docs(system): rephrase experimental API message.
asafkorem May 21, 2024
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
79 changes: 78 additions & 1 deletion detox/detox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ declare global {

readonly web: WebFacade;

readonly system: SystemFacade;

readonly DetoxConstants: {
userNotificationTriggers: {
push: 'push';
Expand Down Expand Up @@ -1038,6 +1040,12 @@ declare global {
* Collection of web matchers
*/
readonly web: ByWebFacade;

/**
* Collection of system-level matchers
* @note System APIs are still in experimental phase and are subject to changes in the near future.
*/
readonly system: BySystemFacade;
}

interface ByWebFacade {
Expand Down Expand Up @@ -1106,6 +1114,24 @@ declare global {
tag(tagName: string): WebMatcher;
}

interface BySystemFacade {
/**
* Find an element on the System-level by its label
* @note System APIs are still in experimental phase and are subject to changes in the near future.
* @example
* system.element(by.system.text('Allow'))
*/
label(text: string): SystemMatcher;

/**
* Find an element on the System-level by its type
* @note System APIs are still in experimental phase and are subject to changes in the near future.
* @example
* system.element(by.system.type('button'))
*/
type(type: string): SystemMatcher;
}

interface NativeMatcher {
/**
* Find an element satisfying all the matchers
Expand All @@ -1127,13 +1153,19 @@ declare global {
}

interface WebMatcher {
__web__: any; // prevent type coersion
__web__: any; // prevent type coercion
}

interface SystemMatcher {
__system__: any; // prevent type coercion
}

interface ExpectFacade {
(element: NativeElement): Expect;

(webElement: WebElement): WebExpect;

(systemElement: SystemElement): SystemExpect;
}

interface WebViewElement {
Expand Down Expand Up @@ -1164,6 +1196,35 @@ declare global {
(matcher?: NativeMatcher): WebViewElement;
}

interface SystemFacade {
/**
* Find an element on the System-level using a system matcher.
* @param systemMatcher a system matcher for the system element.
* @note System APIs are still in experimental phase and are subject to changes in the near future.
* @example
* system.element(by.system.label('Allow'))
*/
element(systemMatcher: SystemMatcher): IndexableSystemElement;
}

interface IndexableSystemElement extends SystemElement {
/**
* Choose from multiple elements matching the same matcher using index
* @note System APIs are still in experimental phase and are subject to changes in the near future.
* @example await system.element(by.system.type('button')).atIndex(1).tap();
*/
atIndex(index: number): SystemElement;
}

interface SystemElement {
/**
* Simulate a tap on the element.
* @note System APIs are still in experimental phase and are subject to changes in the near future.
* @example await system.element(by.system.label('Allow')).tap();
*/
tap(): Promise<void>;
}

interface Expect<R = Promise<void>> {

/**
Expand Down Expand Up @@ -1531,6 +1592,22 @@ declare global {
toExist(): R;
}

interface SystemExpect<R = Promise<void>> {
/**
* Negate the expectation.
* @note System APIs are still in experimental phase and are subject to changes in the near future.
* @example await expect(system.element(by.system.text('Allow'))).not.toExist();
*/
not: this;

/**
* Expect the view to exist in the system-level.
* @note System APIs are still in experimental phase and are subject to changes in the near future.
* @example await expect(system.element(by.system.text('Allow'))).toExist();
*/
toExist(): R;
}

interface IndexableWebElement extends WebElement {
/**
* Choose from multiple elements matching the same matcher using index.
Expand Down
2 changes: 2 additions & 0 deletions detox/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ declare global {
const expect: Detox.DetoxExportWrapper['expect'];
const by: Detox.DetoxExportWrapper['by'];
const web: Detox.DetoxExportWrapper['web'];
const system: Detox.DetoxExportWrapper['system'];

namespace NodeJS {
interface Global {
Expand All @@ -18,6 +19,7 @@ declare global {
expect: Detox.DetoxExportWrapper['expect'];
by: Detox.DetoxExportWrapper['by'];
web: Detox.DetoxExportWrapper['web'];
system: Detox.DetoxExportWrapper['system'];
}
}
}
Loading
Loading