forked from strictdoc-project/strictdoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request strictdoc-project#1483 from strictdoc-project/stan…
…islaw/html2pdf_user_templates export/html2pdf: project config option for custom document template
- Loading branch information
Showing
11 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from seleniumbase import BaseCase | ||
|
||
from tests.end2end.helpers.screens.screen import Screen | ||
|
||
|
||
class Screen_PDFDocument(Screen): | ||
def __init__(self, test_case: BaseCase) -> None: | ||
assert isinstance(test_case, BaseCase) | ||
super().__init__(test_case) | ||
|
||
def assert_on_pdf_document(self) -> None: | ||
super().assert_on_screen("html2pdf") |
Empty file.
2 changes: 2 additions & 0 deletions
2
tests/end2end/screens/pdf/view_pdf_document_custom_template/document.sdoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[DOCUMENT] | ||
TITLE: Empty Document |
1 change: 1 addition & 0 deletions
1
tests/end2end/screens/pdf/view_pdf_document_custom_template/html2pdf_template/index.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CUSTOM TEMPLATE HERE |
7 changes: 7 additions & 0 deletions
7
tests/end2end/screens/pdf/view_pdf_document_custom_template/strictdoc.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[project] | ||
|
||
features = [ | ||
"HTML2PDF", | ||
] | ||
|
||
html2pdf_template = "html2pdf_template/index.jinja" |
39 changes: 39 additions & 0 deletions
39
tests/end2end/screens/pdf/view_pdf_document_custom_template/test_case.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
|
||
from tests.end2end.e2e_case import E2ECase | ||
from tests.end2end.helpers.components.viewtype_selector import ViewType_Selector | ||
from tests.end2end.helpers.screens.pdf.screen_pdf import Screen_PDFDocument | ||
from tests.end2end.helpers.screens.project_index.screen_project_index import ( | ||
Screen_ProjectIndex, | ||
) | ||
from tests.end2end.server import SDocTestServer | ||
|
||
path_to_this_test_file_folder = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
||
class Test(E2ECase): | ||
def test(self): | ||
with SDocTestServer( | ||
input_path=path_to_this_test_file_folder | ||
) as test_server: | ||
self.open(test_server.get_host_and_port()) | ||
|
||
screen_project_index = Screen_ProjectIndex(self) | ||
|
||
screen_project_index.assert_on_screen() | ||
screen_project_index.assert_contains_document("Empty Document") | ||
|
||
screen_document = screen_project_index.do_click_on_first_document() | ||
|
||
screen_document.assert_on_screen_document() | ||
screen_document.assert_header_document_title("Empty Document") | ||
screen_document.assert_empty_document() | ||
|
||
viewtype_selector = ViewType_Selector(self) | ||
screen_pdf: Screen_PDFDocument = ( | ||
viewtype_selector.do_go_to_pdf_document() | ||
) | ||
screen_pdf.assert_on_pdf_document() | ||
screen_pdf.assert_not_empty_view() | ||
|
||
screen_pdf.assert_text("CUSTOM TEMPLATE HERE") |