Path:
tests/end2end/screens/document/export_to_reqif/export_reqif_nominal_case/test_case.py
Lines:
74
Non-empty lines:
60
Non-empty lines covered with requirements:
60 / 60 (100.0%)
Functions:
2
Functions covered by requirements:
2 / 2 (100.0%)
1
"""2
@relation(SDOC-SRS-72, scope=file)3
"""4
5
import filecmp
6
import os
7
import shutil
8
import sys
9
10
from tests.end2end.conftest import DOWNLOADED_FILES_PATH, test_environment
11
from tests.end2end.e2e_case import E2ECase
12
from tests.end2end.end2end_test_setup import End2EndTestSetup
13
from tests.end2end.helpers.screens.project_index.screen_project_index import (
14
Screen_ProjectIndex,
15
)16
from tests.end2end.server import SDocTestServer
17
18
path_to_this_test_file_folder = os.path.dirname(os.path.abspath(__file__))
19
path_to_exported_downloaded_file = os.path.join(
20
DOWNLOADED_FILES_PATH, "export.reqif"
21
)22
path_to_expected_downloaded_file = os.path.join(
23
path_to_this_test_file_folder, "export.expected.reqif"
24
)25
26
27
class Test(E2ECase):
28
def test(self):
29
shutil.rmtree(DOWNLOADED_FILES_PATH, ignore_errors=True)
30
31
with SDocTestServer(
32
input_path=path_to_this_test_file_folder
33
) as test_server:
34
self.open(test_server.get_host_and_port())
35
36
screen_project_index = Screen_ProjectIndex(self)
37
38
screen_project_index.assert_on_screen()
39
screen_project_index.assert_contains_document("Document 1")
40
41
screen_document = screen_project_index.do_click_on_first_document()
42
43
screen_document.assert_on_screen_document()
44
screen_document.assert_header_document_title("Document 1")
45
screen_document.assert_text("Hello world!")
46
47
shutil.rmtree(DOWNLOADED_FILES_PATH, ignore_errors=True)
48
assert not os.path.exists(path_to_exported_downloaded_file)
49
50
screen_document.do_export_reqif()
51
52
# FIXME: does not work on Linux CI53
if sys.platform.startswith("linux"):
54
return55
self.sleep(test_environment.download_file_timeout_seconds)
56
assert os.path.exists(path_to_exported_downloaded_file)
57
58
# FIXME: Activate this check when the exported ReqIF identifiers59
# are stable.60
if False and not filecmp.cmp(
61
path_to_exported_downloaded_file,
62
path_to_expected_downloaded_file,
63
):64
diff = End2EndTestSetup.get_diff(
65
path_to_exported_downloaded_file,
66
path_to_expected_downloaded_file,
67
)68
raise AssertionError(
69
f"Test-produced and expected files are not identical:\n"
70
f"{path_to_exported_downloaded_file}\n"
71
f"{path_to_expected_downloaded_file}\n"
72
"Diff:\n"
73
f"{diff}"
74
)