StrictDoc Documentation
tests/end2end/screens/document/_export_to_pdf/export_to_pdf_with_picture/test_case.py
Source file coverage
Path:
tests/end2end/screens/document/_export_to_pdf/export_to_pdf_with_picture/test_case.py
Lines:
51
Non-empty lines:
38
Non-empty lines covered with requirements:
38 / 38 (100.0%)
Functions:
2
Functions covered by requirements:
2 / 2 (100.0%)
1
"""
2
@relation(SDOC-SRS-51, scope=file)
3
"""
4
 
5
import os
6
import shutil
7
 
8
from tests.end2end.conftest import DOWNLOADED_FILES_PATH, test_environment
9
from tests.end2end.e2e_case import E2ECase
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
path_to_this_test_file_folder = os.path.dirname(os.path.abspath(__file__))
16
path_to_expected_downloaded_file = os.path.join(
17
    DOWNLOADED_FILES_PATH, "Document with Picture.pdf"
18
)
19
 
20
 
21
class Test(E2ECase):
22
    def test(self):
23
        shutil.rmtree(DOWNLOADED_FILES_PATH, ignore_errors=True)
24
 
25
        with SDocTestServer(
26
            input_path=path_to_this_test_file_folder
27
        ) as test_server:
28
            self.open(test_server.get_host_and_port())
29
 
30
            screen_project_index = Screen_ProjectIndex(self)
31
 
32
            screen_project_index.assert_on_screen()
33
            screen_project_index.assert_contains_document(
34
                "Document with Picture"
35
            )
36
 
37
            screen_document = screen_project_index.do_click_on_first_document()
38
 
39
            screen_document.assert_on_screen_document()
40
            screen_document.assert_header_document_title(
41
                "Document with Picture"
42
            )
43
 
44
            # TODO
45
            shutil.rmtree(DOWNLOADED_FILES_PATH, ignore_errors=True)
46
            assert not os.path.exists(path_to_expected_downloaded_file)
47
 
48
            screen_document.do_export_pdf()
49
 
50
            self.sleep(test_environment.download_file_timeout_seconds)
51
            assert os.path.exists(path_to_expected_downloaded_file)