✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
📊 Dash 2.0 is Arriving. Register here.

Dash Testing examples

I wrote a simple test that passes copying some of what I saw in the first example at: Dash Testing | Dash for Python Documentation | Plotly

my test:

from dash.testing.application_runners import import_app

def test_one(dash_duo):
    app = import_app("tests.app")
    dash_duo.wait_for_text_to_equal("h2", "Needleman-Wunsch, Smith-Waterman and Entrez", timeout=4)
    #assert dash_duo.find_element("h3").text == "Objective"
    assert dash_duo.find_element("h3").text == "PAM BLOSUM + NCBI"
    assert dash_duo.get_logs() == [], "Browser console should contain no errors"
    #everything above passes

    dash_duo.wait_for_element("#parameters-link", timeout=4)
    dash_duo.multiple_click("#parameters-link", clicks=1)
    dash_duo.wait_for_text_to_equal("1.  To access a sequence from NCBI using accession number, enter it here")
    assert dash_duo.find_element("#btn-email").text == "Store Email"

    return None

But on the line:

dash_duo.wait_for_element("#parameters-link", timeout=4)
dash_duo.multiple_click("#parameters-link", clicks=1)

I am trying to click on a dbc.Navlink element to navigate to another page and I get:

E       selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <a href="/entrez-parameters" class="nav-link" id="parameters-link">...</a> is not clickable at point (128, 396). Other element would receive the click: <div class="col-12">...</div>
E         (Session info: chrome=91.0.4472.77)

This is all on the index page that looks like this: bio_pam_blosum/app.py at main · nyck33/bio_pam_blosum · GitHub

The element I am trying to click is in the sidebar

sidebar = html.Div(
        html.H3("PAM BLOSUM + NCBI", className='display-4'),
            "Choose page to display", className="lead"
        dbc.Nav(# todo: show res below params using callback and plots on plots
                dbc.NavLink("Project Intro", href="/project-intro", id="intro-link"),
                dbc.NavLink("Entrez Search, Needleman-Wunsch, Smith-Waterman", href="/entrez-parameters", id="parameters-link"),
                dbc.NavLink("Blast", href="/blast", id="protein-blast"),
                dbc.NavLink("Alignment Chart", href="/plots", id="plots"),


I saw this: https://stackoverflow.com/a/58378714/9481613
But don’t know what it’s recommending.