@@ -98,7 +98,7 @@ def test_appending_of_initial_html(selenium, app, status, warning):
98
98
<div class="search__outer__wrapper search__backdrop">
99
99
<div class="search__outer">
100
100
<div class="search__cross" title="Close">
101
- <!--?xml version=' 1.0' encoding=' UTF-8' ?-->
101
+ <!--?xml version=" 1.0" encoding=" UTF-8" ?-->
102
102
<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">
103
103
<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>
104
104
</svg>
@@ -108,12 +108,15 @@ def test_appending_of_initial_html(selenium, app, status, warning):
108
108
</div>
109
109
</div>
110
110
'''
111
- # removing all whitespaces and newlines between html tags
111
+
112
112
initial_html = [ele .strip () for ele in initial_html .split ('\n ' ) if ele ]
113
113
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
+
117
120
118
121
@pytest .mark .sphinx (srcdir = TEST_DOCS_SRC )
119
122
def test_opening_of_search_modal (selenium , app , status , warning ):
@@ -376,9 +379,6 @@ def test_searching_msg(selenium, app, status, warning):
376
379
assert (
377
380
search_result_box .text == 'Searching ....'
378
381
), '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'
382
382
383
383
WebDriverWait (selenium , 10 ).until (
384
384
EC .text_to_be_present_in_element (
@@ -387,11 +387,14 @@ def test_searching_msg(selenium, app, status, warning):
387
387
)
388
388
)
389
389
390
- # fetching search_result_box again to update its content
390
+ # fetching it again from the DOM to update its status
391
391
search_result_box = selenium .find_element_by_class_name (
392
392
'search__result__box'
393
393
)
394
394
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'
395
398
assert (
396
399
search_result_box .text == 'No Results Found'
397
400
), 'user should be notified that there are no results'
0 commit comments