Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 471 Bytes

waiting-for-removal-of-an-element.md

File metadata and controls

13 lines (11 loc) · 471 Bytes

Waiting for removal of an element

To wait for the removal of one or more elements from the DOM, use waitForElementToBeRemoved. Here's an example from OrdersPage test:

test('renders correctly (using waitForElementToBeRemoved)', async () => {
  render(<OrdersPage />);
  await waitForElementToBeRemoved(() => screen.getByText('Loading...'));
  expect(screen.getAllByTestId('order-view')).toHaveLength(4);
});