-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
'element is not defined' when running detox in CI #670
Comments
maybe some more context will help, here is the circleci job config:
here are the package scripts:
here is the jest and detox config in the package.json:
here is the e2e/config.json:
and finally the e2e/init.js:
|
there is a case in the circleci discuss forum that is remarkably similar, no resolution or activity there though https://discuss.circleci.com/t/wix-detox-ui-tests-dont-run-on-circleci/20920 |
Can you provide a non-verbose log with time stamps. Our experience: We got tests running on AppCenter (also fairly low end build machines), and had to increase our default Jest timeout from 120s to some 520s (could probably reduce it a bit but we didn’t bother). In addition, the first test in any given suite should start with a waitFor of 20sec just in case of slowness. |
@kristfal I have struggled to attach timestamps to each detox output, closest I got is turning jest verbose mode on (time taken for each unit), and piping the test cmd to moreutils ts. Hopefully you can see from the logs a situation much like the one you described, only the first test of the first suite is failing. I have put in a waitFor as you suggested in the first test:
But that is either not helping or not long enough. |
@Angry-Potato I'd suggest an even higher timeout for testing, both the // Set the default test timeout of 520s for it to pass on AppCenter
jest.setTimeout(520000);
// Used in by initial test in all suites and screen navigations
export const INITIAL_SCREEN_TIMEOUT = 20000; Try doubling the initial |
@kristfal thanks for the suggestions but neither have helped (increased timeout to 60000, changed selector to one that was passing later on in the suite). It seems the first assertion / expectation fails regardless of what it is. |
to clarify, I increased the initial test screen timeout to 60000, and I have also increased the jest timeout to 520000 as you suggested. |
Ok, that is strange, its probably not timing related then. Since all other selectors do pass, are you certain of the following:
One longshot fix: We were unable to run the debug build (that is using the js bundle served by metro) on the CI. So we're building a release build with an embedded JS bundle and running the CI tests on that release build instead. Can you try that? We're building release / debug based on schemes, so our detox config looks like this:
Here is how they are called:
|
@kristfal I am positive the tests pass locally, and we have not integrated any code push services. I have tried with a release build as you suggest but the same issue occurs. A hacky work-around might be to duplicate the first expectation in each suite, and wrap it in a try-catch. Far from what I would like but unable to see any other options 😢 |
@kristfal I have reproduced the issue in this repo https://github.com/Angry-Potato/detox-testing |
though to repro, you need to run a macos build in circleci 😬 |
I updated the https://github.com/Angry-Potato/detox-testing repo's readme to consolidate the issue tracking around this |
closing this as the original issue was my mistake, and now the title is a little misleading, opened a separate issue #717 |
Thank you for this awesome lib, it works fantastically well locally!
Description (Detox version 7.3.3)
I am building a RN app, and testing it using Detox in Jest. I followed the setup guide in the Detox documentation (also checked the linked Medium post to make sure I set things up correctly) for running detox under Jest.
So far I have created two Detox spec files; one for the initial screen that opens on app load, and one for the login screen that is navigated to via a 'Log In' button on the initial screen.
Running locally is no problem, Detox behaves exactly as expected and all tests pass.
Running on CI (CircleCI) is extremely slow (slowness is likely a machine resource issue, not Detox), and fails with:
Steps to Reproduce
Detox, Node, Device, Xcode and macOS Versions
There is a more comprehensive list of the environment in which Detox is run here https://circle-macos-docs.s3.amazonaws.com/image-manifest/build-298/index.html
Device and verbose Detox logs
detox_circleci_fail_logs.txt
The text was updated successfully, but these errors were encountered: