@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', [('36004586-651c-4ded-af87-203aca22d946', 'mitosis genetics gorilla', False, None, None, None), ('bb62933e-f20a-4ffc-90aa-97b36c296c3e', 'Fizyka', True, 1, True, False), ('bb62933e-f20a-4ffc-90aa-97b36c296c3e', 'Tabela', True, 3, True, True)])
def test_in_book_search(webview_base_url, selenium, uuid, query, has_results, result_index, has_os_figures, has_os_tables):
    content = Content(selenium, webview_base_url, id=uuid).open()
    search_results = content.header_nav.search(query)
    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
@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', [('36004586-651c-4ded-af87-203aca22d946', 'mitosis genetics gorilla', False, None, None, None), ('bb62933e-f20a-4ffc-90aa-97b36c296c3e', 'Fizyka', True, 1, True, False), ('bb62933e-f20a-4ffc-90aa-97b36c296c3e', 'Tabela', True, 3, True, True)])
def test_in_book_search(webview_base_url, selenium, uuid, query, has_results, result_index, has_os_figures, has_os_tables):
    content = Content(selenium, webview_base_url, id=uuid).open()
    search_results = content.header_nav.search(query)
    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