Skip to content

Instantly share code, notes, and snippets.

@marta-pinkowska
Last active February 20, 2023 17:15
Show Gist options
  • Save marta-pinkowska/2d301a9b2ba72fb3358c57e14fadc4f2 to your computer and use it in GitHub Desktop.
Save marta-pinkowska/2d301a9b2ba72fb3358c57e14fadc4f2 to your computer and use it in GitHub Desktop.
// counter.perf-test.tsx
test('Count increments on press', async () => {
const scenario = async (screen: RenderAPI) => {
const button = screen.getByText('Action');
await screen.findByText('Count: 0’);
fireEvent.press(button);
fireEvent.press(button);
await screen.findByText('Count: 2');
};
const stats = await measurePerformance(
<Counter />,
{ scenario, runs: 20 }
);
await writeTestStats(stats);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment