Timeout - Async callback was not invoked within the 30000 ms timeout
When running the test, I receive this error specified by jest.setTimeout.Timeout - Async callback was not invoked within the 30000 ms timeout specified by jest.setTimeout.Error:
The first one works.
it('takes a screenshot of the initial screen', async () => {
const screen = await takeScreenshot('initial');
expect(screen).toMatchBaseline();
});
The second one doesn't work.
it('show loading, then takes a screenshot', async () => {
await press('showLoading'); // if I remove this line, it is working.
const screen = await takeScreenshot('show-loading');
expect(screen).toMatchBaseline();
});
My opinion is that when calling the press function, it doesn't find the testID. My code:
return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
backgroundColor={backgroundStyle.backgroundColor}
/>
{loading && <ActivityIndicator />}
<Pressable testID="showLoading" onPress={() => setLoading(true)}>
<Text>Show Loading</Text>
</Pressable>
</SafeAreaView>
);
My repo link is here: https://github.com/burhanyilmaz/reactNativeOwl my logs exist on there.
I'm having the same issue - everything works as expected on iOS, but when running on Android I get a similar error message:
Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Error
I've reduced my tests down to this:
describe("Tests", () => {
beforeAll(async () => {
await press("Tests");
});
it("should work", () => {});
});
There is a View with the TestID Tests, and I can verify that this is working as expected on iOS - but it doesn't seem like it is accessible on Android.
I'm running the tests in the Android simulator.
@chrfalch testID is not accessible in the android simulator. I agree with you.
This demo example is working well in the android simulator. "react-native": "0.66.0"
https://github.com/FormidableLabs/react-native-owl/tree/main/example
This demo is not working well in the android simulator "react-native": "0.68.2"
https://github.com/FormidableLabs/react-native-owl-demo
it can be related to rn version. @manosim @robwalkerco
Thanks for looking into this @burhanyilmaz We spent some time debugging this yesterday, but haven't found the exact cause yet, but it appears to be caused by an issue with the websocket messaging that is used to communicate between the test running in Jest, and the Owl client running on the test app. We will keep investigating...
Thanks, @robwalkerco, for helping out! The library is super awesome and we're really like to be able to take advantage of it on Android as well as iOS!! :)
@robwalkerco thank you for that 🙂
@burhanyilmaz @chrfalch We have published version 1.1.1 which fixes the issue with running the Owl tests on Android. The example project has been updated to 0.69.5 as well for reference.
Please let us know if you continue to have any Android issues after updating the library.