title: Testing for disappearance of element using react testing library fails
body: <p>I am trying to test disappearance of dialog box when user clicks &quot;cancel&quot; button on my dialog box using the following test:</p>
  <pre><code>it(&quot;clicking on cancel hides the confirmation dialog&quot;, async() =&gt; {
      render(&lt;ConfirmationDialog /&gt;);
      const cancelButton = screen.getByText(&quot;Cancel&quot;);
      fireEvent.click(cancelButton);
      await waitForElementToBeRemoved(() =&gt; screen.queryByText(/Cancel/i));
      expect(screen.queryByText(/Cancel/i)).toBeNull();
    });
  </code></pre>
  <p>But the above code throws an error :
  <strong>TypeError: MutationObserver is not a constructor</strong></p>
  <pre><code>  24 |     const cancelButton = screen.getByText(&quot;Cancel&quot;);
    25 |     fireEvent.click(cancelButton);
  &gt; 26 |     await waitForElementToBeRemoved(() =&gt; screen.queryByText(/Cancel/i));
       |           ^
    27 |     expect(screen.queryByText(/Cancel/i)).toBeNull();
    28 |   });
    29 | });
  </code></pre>
  <p>Can someone help me understanding this issue as I am new to testing library. Thanks in advance.</p>