StrictDoc Documentation
tests/end2end/screens/document/create_requirement/_SECTION/create_section_three_nested_sections/test_case.py
Source file coverage
Path:
tests/end2end/screens/document/create_requirement/_SECTION/create_section_three_nested_sections/test_case.py
Lines:
77
Non-empty lines:
57
Non-empty lines covered with requirements:
57 / 57 (100.0%)
Functions:
2
Functions covered by requirements:
2 / 2 (100.0%)
1
"""
2
@relation(SDOC-SRS-106, 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
            # Section 1
36
 
37
            root_node = screen_document.get_root_node()
38
            root_node_menu = root_node.do_open_node_menu()
39
            form_edit_section_1: Form_EditRequirement = (
40
                root_node_menu.do_node_add_element_first("SECTION")
41
            )
42
 
43
            form_edit_section_1.do_fill_in("TITLE", "Section_1")
44
            form_edit_section_1.do_form_submit()
45
 
46
            section_1 = screen_document.get_node()
47
            section_1.assert_requirement_title("Section_1", "1")
48
            screen_document.assert_toc_contains("Section_1")
49
 
50
            # Section 1_1 as child
51
 
52
            section_1_node_menu = section_1.do_open_node_menu()
53
            form_edit_section_2: Form_EditRequirement = (
54
                section_1_node_menu.do_node_add_element_child("SECTION")
55
            )
56
 
57
            form_edit_section_2.do_fill_in("TITLE", "Section_1_1")
58
            form_edit_section_2.do_form_submit()
59
 
60
            section_2 = screen_document.get_node(2)
61
            section_2.assert_requirement_title("Section_1_1", "1.1")
62
            screen_document.assert_toc_contains("Section_1_1")
63
 
64
            # # Section 1_1_1 as child
65
 
66
            section_2_node_menu = section_2.do_open_node_menu()
67
            form_edit_section_3: Form_EditRequirement = (
68
                section_2_node_menu.do_node_add_element_child("SECTION")
69
            )
70
            form_edit_section_3.do_fill_in("TITLE", "Section_1_1_1")
71
            form_edit_section_3.do_form_submit()
72
 
73
            section_3 = screen_document.get_node(3)
74
            section_3.assert_requirement_title("Section_1_1_1", "1.1.1")
75
            screen_document.assert_toc_contains("Section_1_1_1")
76
 
77
        assert test_setup.compare_sandbox_and_expected_output()