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

E2E tests setup and initial tests #1417

Merged
merged 30 commits into from
Sep 27, 2019
Merged

E2E tests setup and initial tests #1417

merged 30 commits into from
Sep 27, 2019

Conversation

mnzaki
Copy link
Contributor

@mnzaki mnzaki commented Aug 20, 2019

Resolves #1415

This builds on #1410 which must be merged first

NOTES

  • Android minSdkVersion bumped to 18
  • iOS not tested and may require more setup
  • No release build testing yet
  • yarn e2e:android to run the tests
  • yarn e2e:android -r to reuse last app installation and prevent detox from reinstalling
  • yarn e2e:android -r recovery to run the tests matching "recovery" (this is somewhat broken)

android/app/build.gradle Show resolved Hide resolved
android/build.gradle Show resolved Hide resolved
- It needs to be transpiled, so was excepted from the node_modules in
  transformIgnorePatterns
- The global window variable had to be removed because it was breaking this code:
  https://github.com/typeorm/typeorm/blob/e4de0403e1f666639c0198e216409f997121c1e8/src/platform/BrowserPlatformTools.template#L20
- Android Notes
  - increases android's minSdkVersion to 18
  - adds kotlin support
  - disables split ABI APKs for debug builds
- Yarn Scripts
  - test:e2e:android to run on device
  - test:e2e:android:emu to run on emulator
So we don't have to hardcode devices/emulators in package.json
This is somewhat hacky, there are dummy ones there or else detox
will complain. But the device name keys are only generated last second
before detox.init in e2e/init.js
DefinitelyTyped PR for missing testID props was merged
this includes some fixes we need, like android connectivity issue from
wix/Detox#1601
failures due to misconfiguration (or random node module breakages)
result in a whole bunch of unrelated/confusing failures in the tests,
and there's no point of continuing tests if there's no detox anyway
react-devtools --depends-on--> electron -> electron-download -> fs-extra 0.3

for some reason detox loads fs-extra 0.3, though it depends on ^4.0.2
and that's why we can't have nice things
- find Text element by type
- try to also find a Text child of the given testID
- handle matching multiple children and read each recursively
@mnzaki mnzaki force-pushed the 1415/e2e_tests_setup branch from 50811db to 5a90cf1 Compare September 12, 2019 16:58
@mnzaki mnzaki changed the title E2E tests setup E2E tests setup and initial tests Sep 12, 2019
Copy link

@saifahn saifahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Android Emulator

  • I start up an emulator and then run:
yarn start

# separate terminal
yarn run e2e:android:emu

BUILD SUCCESSFUL

01_landing.spec.ts passes

03_recovery.spec.ts and 02_creation.spec.ts fail to run with ReferenceError: device is not defined.

The others fail as they have no tests.

Android Device

yarn start

yarn run e2e:android

BUILD SUCCESSFUL

then same as above. 01 passes but the other two say that device is not defined from the e2e/utils.ts file

I assume this isn't as intended?

I'm going to see if I can get this to run on iOS now.

@saifahn
Copy link

saifahn commented Sep 13, 2019

iOS Device

I ran detox build -c ios.sim.debug && detox test -c ios.sim.debug and after the dev bundle loaded onto the simulator, it gave the same as above. The 01_landing_spec passed but the others had the device ReferenceError.

There should also be some documentation somewhere regarding the pitfalls - e.g. needing the bundle server started and having the bundle fully loaded before running the tests.

@mnzaki
Copy link
Contributor Author

mnzaki commented Sep 13, 2019

There's also a conflict with the new entropy screen, because the infinite loop animation hangs detox :/

can't access devices unless detox.init is called
 Conflicts:
	src/ui/recovery/components/inputSeedPhrase.tsx
@saifahn
Copy link

saifahn commented Sep 13, 2019

I can confirm the hanging on the entropy screen.

Next is:

Input Seed Phrase Screen
✓ should show a recoveryMsg (145ms)
✓ should show a seedWordFld (1853ms)
✓ should show word suggestions based on input prefix (8284ms)
✕ should add words to seed phrase on tap (2607ms)
✕ should show a restoreAccount button (35ms)
✕ should navigate home after a successful restore (10007ms)

'Multiple UI elements matched for given criteria.' as part of 'should add words to seed phrase on tap' test

At e2e/utils.ts:42

try {
   //console.error('expect with child')
   await expect(el).toBeVisible()
} catch (err) {

because it's an infinite loop animation using callbacks, always keeping
the UI module busy, so detox need to be told to ignore that.

Spoilers: it still doesn't work because the android
disableSynchronization support is broken
this has a branch merged from leanmazzu/Detox.git with unreleased
support for disableSynchronization

now the e2e/01_new_user/02_creation test should be able to work around
the hand animation screen

Spoilers: it can't, the loop is never broken....
@mnzaki
Copy link
Contributor Author

mnzaki commented Sep 17, 2019

There's also a conflict with the new entropy screen, because the infinite loop animation hangs detox :/

I'm using a fork of detox with an unreleased branch to support proper disabling of synchronization, so we can avoid the infinite animation issue.

Another issue with the new entropy screen was the the animation loop would continue even after the animation component was unmounted, so even in the step after the entropy collection detox would hang (and presumably would hang forever if the hand animation is ever rendered)

These issues have been addressed in the last couple commits

Clearing the timeout is not useful, it will have already fired.
The problem is with the recursive callbacks, which must be broken with a
flag
@mnzaki mnzaki force-pushed the 1415/e2e_tests_setup branch from b8b437a to 92984eb Compare September 17, 2019 12:11
@mnzaki
Copy link
Contributor Author

mnzaki commented Sep 17, 2019

I have moved the detox fork to the @jolocom organization and updated package.json.
Note that the fork contains a build of the branch https://github.com/jolocom/Detox/tree/jolocom on the tag detox-v9000.0.1-gitpkg using gitpkg.

The jolocom branch currently only has this PR merged in wix/Detox#1521

@mnzaki mnzaki added this to the Sprint N milestone Sep 22, 2019
@Exulansis
Copy link
Collaborator

Tested as well, this looks good, outside of the merge conflicts I think this can be merged.

An extra issue should be created to add documentation on how to run this. I found the comments left by @saifahn really helpful.

@Exulansis Exulansis self-requested a review September 26, 2019 08:37
Copy link
Collaborator

@Exulansis Exulansis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we should update the README with instructions for running these.

@mnzaki mnzaki self-assigned this Sep 27, 2019
@mnzaki mnzaki merged commit f2ce207 into develop Sep 27, 2019
@Exulansis Exulansis deleted the 1415/e2e_tests_setup branch October 10, 2019 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E2E Tests: Add and configure Detox
5 participants