Skip to content

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

@burhanyilmaz

Description

@burhanyilmaz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions