Path:
tests/end2end/static_html_search/02_regex_special_character_search_on_both_server_and_in_static_html/test_case.py
Lines:
46
Non-empty lines:
37
Non-empty lines covered with requirements:
37 / 37 (100.0%)
Functions:
5
Functions covered by requirements:
5 / 5 (100.0%)
1
"""2
@relation(SDOC-SRS-155, scope=file)3
"""4
5
import os
6
7
from tests.end2end.e2e_case import E2ECase
8
from tests.end2end.exporter import SDocTestHTMLExporter
9
from tests.end2end.helpers.screens.project_index.screen_project_index import (
10
Screen_ProjectIndex,
11
)12
from tests.end2end.server import SDocTestServer
13
14
path_to_this_test_file_folder = os.path.dirname(os.path.abspath(__file__))
15
16
17
class Test(E2ECase):
18
def test_search_in_static_html(self):
19
with SDocTestHTMLExporter(
20
input_path=path_to_this_test_file_folder
21
) as exporter:
22
self.open(exporter.get_output_path_as_uri() + "index.html")
23
self._test_common_sequence()
24
25
def test_search_on_server(self):
26
with SDocTestServer(
27
input_path=path_to_this_test_file_folder
28
) as test_server:
29
self.open(test_server.get_host_and_port())
30
self._test_common_sequence()
31
32
def _test_common_sequence(self):
33
screen_project_index = Screen_ProjectIndex(self)
34
screen_project_index.assert_on_screen()
35
36
self._test_regex_special_character_query(screen_project_index)
37
38
def _test_regex_special_character_query(
39
self, screen_project_index: Screen_ProjectIndex
40
):41
# This covers a typical regex-breaking input where a special character42
# is typed together with a known token that still produces results.43
# Similar characters to keep in mind for future coverage: (, [, {, \\44
screen_project_index.do_enter_search_query("( COMMON")
45
screen_project_index.assert_search_results(1, 5, 15)
46
screen_project_index.assert_no_js_errors()