|
| 1 | +from tests.end2end.e2e_case import E2ECase |
| 2 | +from tests.end2end.end2end_test_setup import End2EndTestSetup |
| 3 | +from tests.end2end.helpers.components.node.add_node_menu import AddNode_Menu |
| 4 | +from tests.end2end.helpers.components.node.section import Section |
| 5 | +from tests.end2end.helpers.screens.document.form_edit_section import ( |
| 6 | + Form_EditSection, |
| 7 | +) |
| 8 | +from tests.end2end.helpers.screens.project_index.screen_project_index import ( |
| 9 | + Screen_ProjectIndex, |
| 10 | +) |
| 11 | +from tests.end2end.server import SDocTestServer |
| 12 | + |
| 13 | + |
| 14 | +class Test(E2ECase): |
| 15 | + def test(self): |
| 16 | + test_setup = End2EndTestSetup(path_to_test_file=__file__) |
| 17 | + |
| 18 | + with SDocTestServer( |
| 19 | + input_path=test_setup.path_to_sandbox |
| 20 | + ) as test_server: |
| 21 | + self.open(test_server.get_host_and_port()) |
| 22 | + |
| 23 | + screen_project_index = Screen_ProjectIndex(self) |
| 24 | + |
| 25 | + screen_project_index.assert_on_screen() |
| 26 | + screen_project_index.assert_contains_document("Document 1") |
| 27 | + |
| 28 | + screen_document = screen_project_index.do_click_on_first_document() |
| 29 | + |
| 30 | + screen_document.assert_on_screen_document() |
| 31 | + screen_document.assert_header_document_title("Document 1") |
| 32 | + |
| 33 | + screen_document.assert_text("Hello world!") |
| 34 | + |
| 35 | + section: Section = screen_document.get_section(node_order=3) |
| 36 | + |
| 37 | + section_menu: AddNode_Menu = section.do_open_node_menu() |
| 38 | + form_edit_section: Form_EditSection = ( |
| 39 | + section_menu.do_node_add_section_child() |
| 40 | + ) |
| 41 | + |
| 42 | + form_edit_section.do_fill_in_title("Second section") |
| 43 | + form_edit_section.do_form_submit() |
| 44 | + |
| 45 | + section: Section = screen_document.get_section(4) |
| 46 | + |
| 47 | + section.assert_section_title("Second section") |
| 48 | + |
| 49 | + screen_document.assert_toc_contains("Second section") |
| 50 | + |
| 51 | + screen_document.get_root_node().assert_document_title_contains( |
| 52 | + "Document 1" |
| 53 | + ) |
| 54 | + |
| 55 | + assert test_setup.compare_sandbox_and_expected_output() |
0 commit comments