Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit 75a0cd9

Browse files
committed
fix tests
1 parent ed8764e commit 75a0cd9

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

tests/test_ui.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_appending_of_initial_html(selenium, app, status, warning):
9898
<div class="search__outer__wrapper search__backdrop">
9999
<div class="search__outer">
100100
<div class="search__cross" title="Close">
101-
<!--?xml version='1.0' encoding='UTF-8'?-->
101+
<!--?xml version="1.0" encoding="UTF-8"?-->
102102
<svg class="search__cross__img" width="15px" height="15px" enable-background="new 0 0 612 612" version="1.1" viewBox="0 0 612 612" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
103103
<polygon points="612 36.004 576.52 0.603 306 270.61 35.478 0.603 0 36.004 270.52 306.01 0 576 35.478 611.4 306 341.41 576.52 611.4 612 576 341.46 306.01"></polygon>
104104
</svg>
@@ -108,12 +108,15 @@ def test_appending_of_initial_html(selenium, app, status, warning):
108108
</div>
109109
</div>
110110
'''
111-
# removing all whitespaces and newlines between html tags
111+
112112
initial_html = [ele.strip() for ele in initial_html.split('\n') if ele]
113113

114-
assert (
115-
''.join(initial_html) in selenium.page_source
116-
), 'initial html must be present when the page finished loading.'
114+
for line in initial_html:
115+
if line:
116+
assert (
117+
line in selenium.page_source
118+
), f'{line} -- must be present in page source'
119+
117120

118121
@pytest.mark.sphinx(srcdir=TEST_DOCS_SRC)
119122
def test_opening_of_search_modal(selenium, app, status, warning):
@@ -376,9 +379,6 @@ def test_searching_msg(selenium, app, status, warning):
376379
assert (
377380
search_result_box.text == 'Searching ....'
378381
), 'user should be notified that search is in progress'
379-
assert (
380-
len(search_result_box.find_elements_by_css_selector('*')) == 0
381-
), 'search result box should not have any child elements because there are no results'
382382

383383
WebDriverWait(selenium, 10).until(
384384
EC.text_to_be_present_in_element(
@@ -387,11 +387,14 @@ def test_searching_msg(selenium, app, status, warning):
387387
)
388388
)
389389

390-
# fetching search_result_box again to update its content
390+
# fetching it again from the DOM to update its status
391391
search_result_box = selenium.find_element_by_class_name(
392392
'search__result__box'
393393
)
394394

395+
assert (
396+
len(search_result_box.find_elements_by_css_selector('*')) == 0
397+
), 'search result box should not have any child elements because there are no results'
395398
assert (
396399
search_result_box.text == 'No Results Found'
397400
), 'user should be notified that there are no results'

0 commit comments

Comments
 (0)