plotly / plotly/dash

[BUG] Flaky Selenium `send_keys` Tests

Open
#3,431 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

When trying to get clean PRs to dash, there are flaky tests due to Selenium send_keys with typing and counting the # of times a callback was triggered.

Is this necessary as the end result is what matters?
If so, we should introduce a util function to type as a real user instead of the quickness that the system types.

eg: test_async_cbsc008_wildcard_prop_callbacks

    for key in "hello world":
        with lock:
            input1.send_keys(key)
            time.sleep(0.05)  # allow some time for debounced callback to be sent

    dash_duo.wait_for_text_to_equal("#output-1", "hello world")
    assert dash_duo.find_element("#output-1").get_attribute("data-cb") == "hello world"

    # an initial call, one for clearing the input
    # and one for each hello world character
    assert input_call_count.value == 2 + len("hello world")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating test_async_cbsc008_wildcard_prop_callbacks and run the affected Selenium test repeatedly to reproduce the flakiness. Review the existing send_keys usage and callback-count assertion, then determine whether the count is required or whether a real-user typing utility is needed. Done means the relevant tests run reliably without weakening the intended behavior check.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.