Path:
tests/end2end/screens/document/create_requirement/_validation/create_requirement_validate_uid_already_exists/test_case.py
Lines:
61
Non-empty lines:
47
Non-empty lines covered with requirements:
47 / 47 (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
"""
18
This test exercises that StrictDoc validates the UID uniqueness when a19
requirement is being created. It is not a regression, we have simply not20
covered this validation case as we were implementing the Create Requirement21
forms and the corresponding Python flow.22
The issue has been reported here:23
https://github.com/strictdoc-project/strictdoc/issues/1587.24
"""25
26
def test(self):
27
test_setup = End2EndTestSetup(path_to_test_file=__file__)
28
29
with SDocTestServer(
30
input_path=test_setup.path_to_sandbox
31
) as test_server:
32
self.open(test_server.get_host_and_port())
33
34
screen_project_index = Screen_ProjectIndex(self)
35
36
screen_project_index.assert_on_screen()
37
screen_project_index.assert_contains_document("Document 1")
38
39
screen_document = screen_project_index.do_click_on_first_document()
40
41
screen_document.assert_on_screen_document()
42
screen_document.assert_header_document_title("Document 1")
43
44
screen_document.assert_text("Hello world!")
45
46
requirement_node = screen_document.get_node(1)
47
root_node_menu = requirement_node.do_open_node_menu()
48
form_edit_requirement: Form_EditRequirement = (
49
root_node_menu.do_node_add_requirement_below()
50
)51
52
# Deliberately entering the UID that already exists.53
form_edit_requirement.do_fill_in_field_uid("REQ-001")
54
form_edit_requirement.do_fill_in_field_statement("Shall do")
55
56
form_edit_requirement.do_form_submit_and_catch_error(
57
"The chosen UID must be unique. "58
"Another node with this UID already exists: 'REQ-001'."59
)60
61
assert test_setup.compare_sandbox_and_expected_output()