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

The app is busy with the following tasks #3992

Closed
GittyAjay opened this issue Mar 21, 2023 · 10 comments
Closed

The app is busy with the following tasks #3992

GittyAjay opened this issue Mar 21, 2023 · 10 comments

Comments

@GittyAjay
Copy link

GittyAjay commented Mar 21, 2023

Description

The app is busy with the following tasks:
• Run loop "Main Run Loop" is awake.
• The event "Network Request" is taking place with object: "URL: “https://api-dev.gigflex.com:8088/socket/347/oxxy2uxi/xhr_streaming?t=1679374217817”".
• There are 1 work items pending on the dispatch queue: "Main Queue (<OS_dispatch_queue_main: com.apple.main-thread>)".
• The event "Network Request" is taking place with object: "URL: “https://api-dev.gigflex.com:8088/socket/501/o2tr5ber/xhr_streaming?t=1679374218301”".

Code

`import { device } from 'detox';
describe('App Test', () => {

beforeAll(async () => {
await device.launchApp();
});

beforeEach(async () => {
await device.reloadReactNative();
});

it('should have login screen', async () => {

await expect(element(by.id('login-container'))).toBeVisible();

});
});`

and it ends with error

FAIL e2e/starter.test.js (124.849 s)
App Test
✕ should have login screen (2 ms)

● App Test › should have login screen

thrown: "Exceeded timeout of 120000 ms for a hook.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

2 | describe('App Test', () => {
3 |

4 | beforeAll(async () => {
| ^
5 | await device.launchApp();
6 | });
7 |

at beforeAll (e2e/starter.test.js:4:5)
at Object.describe (e2e/starter.test.js:2:1)

Your environment

Detox version: 20.5.0
React Native version: 0.64.1
Node version: 19.7.0
Device model: Iphone-12
OS: macos 11.6.7
Test-runner: jest

@asafkorem
Copy link
Contributor

Hi @GittyAjay, it seems like there's a network request that doesn't end and your test reaches timeout. The test cannot continue until the app is idle, which is part of our synchronization mechanism.

You can exclude this network request from being synchronized using device.setURLBlacklist([urls]) API. See our documentation for that.

@stale
Copy link

stale bot commented Apr 25, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this repository, read this discussion.

@stale stale bot added the 🏚 stale label Apr 25, 2023
@stale
Copy link

stale bot commented May 3, 2023

The issue has been closed for inactivity.

@stale stale bot closed this as completed May 3, 2023
@abdymm
Copy link

abdymm commented Jul 10, 2023

hi @GittyAjay are you able to fix this issue?

@tiagoacastro
Copy link

Any updates on a fix for this? @asafkorem I tried to do as you said but since the execution is stuck on the launchApp I can't blacklist the urls.

@KaterinaUK
Copy link

@asafkorem Can I please ask to reopen this issue? Many people still have the same problem! Even after trying what you suggested.

@grenos
Copy link

grenos commented Oct 23, 2023

It's definitely an onging issue, we have it with the following specs:

"react-native": "0.72.6",
"detox": "^20.13.1",

EDIT Forgot to mentions that this only happens on iOS

@noomorph
Copy link
Collaborator

The issue that OP raised is usually fixed by ignoring certain regexps, e.g.:

https://github.com/mendix/native-widgets/blob/d62cdc803ce1087840f6a20f06db7315b1cb8241/detox/src/helpers.ts#L12

Your app may be busy with any tasks, not necessarily network requests. Specifically for the always-running network requests like socket connections, see the example above.

@KaterinaUK
Copy link

I actually found the fix @grenos try this solution (replace url link to your actual network call link):
describe('Check for Login Screen', () => {
beforeAll(async () => {
await device.launchApp({
newInstance: true,
launchArgs: { detoxURLBlacklistRegex: '\("https://typeYourNetworkCallHere.com/*")' },
permissions: { notifications: 'YES', userTracking: 'YES' },
})
})

@MetodievIvaylo
Copy link

Sometimes the problem comes from a front-end process like endless animation. I was able to bypass it by disabling the device synchronization temporarily.

await device.disableSynchronization()

// action you want to execute
// ex.
await button.tap()

await device.enableSynchronization()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants