react-native-owl icon indicating copy to clipboard operation
react-native-owl copied to clipboard

Timeout - Async callback was not invoked within the 30000 ms timeout

Open burhanyilmaz opened this issue 3 years ago • 5 comments

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.

burhanyilmaz avatar Sep 08 '22 05:09 burhanyilmaz

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 avatar Sep 15 '22 13:09 chrfalch

@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

burhanyilmaz avatar Sep 17 '22 08:09 burhanyilmaz

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...

robwalkerco avatar Sep 17 '22 08:09 robwalkerco

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!! :)

chrfalch avatar Sep 19 '22 08:09 chrfalch

@robwalkerco thank you for that 🙂

burhanyilmaz avatar Sep 20 '22 20:09 burhanyilmaz

@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.

robwalkerco avatar Sep 28 '22 15:09 robwalkerco