(dash_duo, specs)
| 21 | |
| 22 | |
| 23 | def check_errors(dash_duo, specs): |
| 24 | # Order-agnostic check of all the errors shown. |
| 25 | # This is not fully general - despite the selectors below, it only applies |
| 26 | # to front-end errors with no back-end errors in the list. |
| 27 | cnt = len(specs) |
| 28 | dash_duo.wait_for_text_to_equal(dash_duo.devtools_error_count_locator, str(cnt)) |
| 29 | |
| 30 | found = [] |
| 31 | for i in range(cnt): |
| 32 | msg = dash_duo.find_elements(".dash-fe-error__title")[i].text |
| 33 | dash_duo.find_elements(".test-devtools-error-toggle")[i].click() |
| 34 | dash_duo.wait_for_element(".dash-backend-error,.dash-fe-error__info") |
| 35 | has_BE = dash_duo.driver.execute_script( |
| 36 | "return document.querySelectorAll('.dash-backend-error').length" |
| 37 | ) |
| 38 | txt_selector = ".dash-backend-error" if has_BE else ".dash-fe-error__info" |
| 39 | txt = dash_duo.wait_for_element(txt_selector).text |
| 40 | dash_duo.find_elements(".test-devtools-error-toggle")[i].click() |
| 41 | dash_duo.wait_for_no_elements(".dash-backend-error") |
| 42 | found.append((msg, txt)) |
| 43 | |
| 44 | orig_found = found[:] |
| 45 | |
| 46 | for i, (message, snippets) in enumerate(specs): |
| 47 | for j, (msg, txt) in enumerate(found): |
| 48 | if msg == message and all(snip in txt for snip in snippets): |
| 49 | print(j) |
| 50 | found.pop(j) |
| 51 | break |
| 52 | else: |
| 53 | raise AssertionError( |
| 54 | ( |
| 55 | "error {} ({}) not found with text:\n" |
| 56 | " {}\nThe found messages were:\n---\n{}" |
| 57 | ).format( |
| 58 | i, |
| 59 | message, |
| 60 | "\n ".join(snippets), |
| 61 | "\n---\n".join( |
| 62 | "{}\n{}".format(msg, txt) for msg, txt in orig_found |
| 63 | ), |
| 64 | ) |
| 65 | ) |
| 66 | |
| 67 | # ensure the errors didn't leave items in the pendingCallbacks queue |
| 68 | assert dash_duo.driver.execute_script("return document.title") == "Dash" |
| 69 | |
| 70 | |
| 71 | def test_dvcv001_blank(dash_duo): |
no test coverage detected
searching dependent graphs…