Need to replace book uuid and search term (e42bd376-624b-4c0f-972f-e0c57998e765", "mitosis genetics) in:
@markers.webview
@markers.smoke
@markers.test_case("C132549", "C175148")
@markers.nondestructive
@markers.parametrize(
"uuid,query,has_results,result_index,has_os_figures,has_os_tables",
[
(
"caa57dab-41c7-455e-bd6f-f443cda5519c",
"mitosis genetics gorilla",
False,
None,
None,
None,
),
("e42bd376-624b-4c0f-972f-e0c57998e765", "mitosis genetics", True, 0, True, False),
("d50f6e32-0fda-46ef-a362-9bd36ca7c97d", "table", True, 1, True, True),
],
)
def test_in_book_search(
webview_base_url,
selenium,
uuid,
query,
has_results,
result_index,
has_os_figures,
has_os_tables,
):
# GIVEN a book's content page and a query
content = Content(selenium, webview_base_url, id=uuid).open()
# WHEN we search the book for the given query
search_results = content.header_nav.search(query)
# THEN search results are present (or not) and bolded and link to the matching content
results = search_results.results
result_count = search_results.result_count
assert len(results) == result_count
if not has_results:
assert result_count == 0
return
assert result_count > 0
words = query.split()
for result in results:
for word in words:
assert result.count_occurrences(word) == result.count_bold_occurrences(word)
result = results[result_index]
title = result.title
content = result.click_link()
assert content.section_title == title
content_region = content.content_region
assert content_region.has_os_figures == has_os_figures
for figure in content_region.os_figures:
assert figure.caption.is_labeled
assert figure.caption.is_numbered
assert content_region.has_os_tables == has_os_tables
for table in content_region.os_tables:
assert table.caption.is_labeled
assert table.caption.is_numbered
Need to replace book uuid and search term (e42bd376-624b-4c0f-972f-e0c57998e765", "mitosis genetics) in: