StrictDoc Documentation
tests/end2end/screens/document/_cross_cutting/RELATIONS/update_node/update_requirement_two_documents_removing_link/test_case.py
Source file coverage
Path:
tests/end2end/screens/document/_cross_cutting/RELATIONS/update_node/update_requirement_two_documents_removing_link/test_case.py
Lines:
66
Non-empty lines:
54
Non-empty lines covered with requirements:
54 / 54 (100.0%)
Functions:
2
Functions covered by requirements:
2 / 2 (100.0%)
1
"""
2
@relation(SDOC-SRS-158, 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
            screen_project_index.assert_on_screen()
27
            screen_project_index.assert_contains_document("Document 1")
28
 
29
            # First, go to first document and check that the first document's
30
            # requirement REQ-001 does contain a child relation to REQ-002.
31
            screen_document1 = screen_project_index.do_click_on_the_document(1)
32
            requirement1 = screen_document1.get_node()
33
            requirement1.assert_requirement_has_child_relation("REQ-002")
34
 
35
            # Go back to tree
36
            self.open(test_server.get_host_and_port())
37
 
38
            # Go to second document and check that the first document's
39
            # requirement REQ-001 does contain a parent relation to REQ-001,
40
            screen_document2 = screen_project_index.do_click_on_the_document(2)
41
            requirement2 = screen_document2.get_node()
42
            requirement2.assert_requirement_has_parent_relation("REQ-001")
43
 
44
            # and remove the parent relation to REQ-001.
45
            form_edit_requirement: Form_EditRequirement = (
46
                requirement2.do_open_form_edit_requirement()
47
            )
48
            form_edit_requirement.do_open_tab("Relations")
49
            form_edit_requirement.assert_form_has_relations()
50
            form_edit_requirement.do_delete_relation()
51
            # Make sure that the field is removed from the form:
52
            form_edit_requirement.assert_form_has_no_relations()
53
            form_edit_requirement.do_form_submit()
54
 
55
            # Now check that the documents do not have the link anymore.
56
            self.open(test_server.get_host_and_port())
57
            screen_document1 = screen_project_index.do_click_on_the_document(1)
58
            requirement1 = screen_document1.get_node()
59
            requirement1.assert_requirement_has_not_child_relation("REQ-002")
60
 
61
            self.open(test_server.get_host_and_port())
62
            screen_document2 = screen_project_index.do_click_on_the_document(2)
63
            requirement2 = screen_document2.get_node()
64
            requirement2.assert_requirement_has_not_parent_relation("REQ-001")
65
 
66
        assert test_setup.compare_sandbox_and_expected_output()