StrictDoc Documentation
tests/end2end/screens/document/create_requirement/_MultipleChoice/create_requirement_MultipleChoice_field_using_autocomplete/test_case.py
Source file coverage
Path:
tests/end2end/screens/document/create_requirement/_MultipleChoice/create_requirement_MultipleChoice_field_using_autocomplete/test_case.py
Lines:
84
Non-empty lines:
63
Non-empty lines covered with requirements:
63 / 63 (100.0%)
Functions:
2
Functions covered by requirements:
2 / 2 (100.0%)
1
"""
2
@relation(SDOC-SRS-106, SDOC-SRS-120, scope=file)
3
"""
4
 
5
from tests.end2end.e2e_case import E2ECase
6
from tests.end2end.end2end_test_setup import End2EndTestSetup
7
from tests.end2end.helpers.screens.document.form_edit_requirement import (
8
    Form_EditRequirement,
9
)
10
from tests.end2end.helpers.screens.project_index.screen_project_index import (
11
    Screen_ProjectIndex,
12
)
13
from tests.end2end.server import SDocTestServer
14
 
15
 
16
class Test(E2ECase):
17
    def test(self):
18
        test_setup = End2EndTestSetup(path_to_test_file=__file__)
19
 
20
        with SDocTestServer(
21
            input_path=test_setup.path_to_sandbox
22
        ) as test_server:
23
            self.open(test_server.get_host_and_port())
24
 
25
            screen_project_index = Screen_ProjectIndex(self)
26
 
27
            screen_project_index.assert_on_screen()
28
            screen_project_index.assert_contains_document("Document 1")
29
 
30
            screen_document = screen_project_index.do_click_on_first_document()
31
 
32
            screen_document.assert_on_screen_document()
33
            screen_document.assert_header_document_title("Document 1")
34
 
35
            #
36
            # Create a requirement after the existing test case.
37
            #
38
            test_case_node = screen_document.get_node(1)
39
 
40
            test_case_menu = test_case_node.do_open_node_menu()
41
 
42
            form_edit_requirement: Form_EditRequirement = (
43
                test_case_menu.do_node_add_element_below("REQUIREMENT")
44
            )
45
 
46
            form_edit_requirement.do_fill_in_field_uid("REQ-2")
47
            form_edit_requirement.do_fill_in_field_title("Requirement 2 XYZ")
48
            form_edit_requirement.do_fill_in_field_statement(
49
                "Shall test foo 2."
50
            )
51
 
52
            #
53
            # Text 'acc' in field STATUS should be autocompleted to 'accepted'.
54
            #
55
            form_edit_requirement.do_fill_in_field_and_autocomplete(
56
                "STATUS", "acc"
57
            )
58
 
59
            #
60
            # Text 'acc' in field OWNER should be autocompleted to 'Abigail ACCURACY', the first matching choice.
61
            #
62
            form_edit_requirement.do_fill_in_field_and_autocomplete(
63
                "OWNER", "acc"
64
            )
65
 
66
            #
67
            # Text 'acc' in field OWNER should be autocompleted to 'Ace ACCREDITATION', the next matching choice that is not yet selected
68
            #
69
            form_edit_requirement.do_fill_in_field_and_autocomplete_again(
70
                "OWNER", "acc"
71
            )
72
 
73
            form_edit_requirement.do_form_submit()
74
 
75
            node_2 = screen_document.get_node(node_order=2)
76
 
77
            node_2.assert_requirement_title("Requirement 2 XYZ", "2")
78
            screen_document.assert_toc_contains("Requirement 2 XYZ")
79
 
80
            screen_document.assert_text("accepted")
81
 
82
            screen_document.assert_text("Abigail ACCURACY, Ace ACCREDITATION")
83
 
84
        assert test_setup.compare_sandbox_and_expected_output()