### Description

Close #2226

Refactors matplotlib tests:

- Prevent dangling selenium webdriver after test
- For asynchronous tests, use promise-await instead of selenium WebDriverWait
- Enable xfailed tests

<!--
- [ ] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry
- [ ] Add / update tests
- [ ] Add new / update outdated documentation
!-->

Refactor matplotlib tests. ### Description

Close #2226

Refactors matplotlib tests:

- Prevent dangling selenium webdriver after test
- For asynchronous tests, use promise-await instead of selenium WebDriverWait
- Enable xfailed tests

<!--
- [ ] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry
- [ ] Add / update tests
- [ ] Add new / update outdated documentation
!-->

from pyodide_build.testing import run_in_pyodide


@run_in_pyodide(standalone=True, packages=["networkx"])
def test_networkx_basicgraph():
    import networkx as nx

    G = nx.Graph()
    G.add_nodes_from([1, 2, 3])
    G.add_edges_from([(1, 2), (1, 3)])

    assert G.number_of_nodes() == 3
    assert G.number_of_edges() == 2

from pyodide_build.testing import run_in_pyodide


@run_in_pyodide(standalone=True, packages=["networkx"])
def test_networkx_basicgraph():
    import networkx as nx

    G = nx.Graph()
    G.add_nodes_from([1, 2, 3])
    G.add_edges_from([(1, 2), (1, 3)])

    assert G.number_of_nodes() == 3
    assert G.number_of_edges() == 2
