示例#1
0
    def test_navigation(self, setup):
        dialog = Edit.open_dialog_and_show_note_with_id(setup.note1_id)
        Edit.open_dialog_and_show_note_with_id(setup.note2_id)

        dialog.show_previous()
        assert dialog.note.id == setup.note1_id

        dialog.show_previous()
        assert dialog.note.id == setup.note1_id

        dialog.show_next()
        assert dialog.note.id == setup.note2_id

        dialog.show_next()
        assert dialog.note.id == setup.note2_id
示例#2
0
    def test_selects_cards_of_note_before_last_after_previous_button_pressed(
            self, setup):
        Edit.open_dialog_and_show_note_with_id(setup.note1_id)
        dialog = Edit.open_dialog_and_show_note_with_id(setup.note2_id)

        def verify_that_the_table_shows_note2_cards_then_note1_cards():
            get_dialog_instance("Browser").table.select_all()
            assert {*self.get_selected_card_ids()[:2]
                    } == {*setup.note2_card_ids}
            assert {*self.get_selected_card_ids()[2:]
                    } == {*setup.note1_card_ids}

        dialog.show_previous()
        dialog.show_browser()
        assert {*self.get_selected_card_ids()} == {*setup.note1_card_ids}
        verify_that_the_table_shows_note2_cards_then_note1_cards()

        dialog.show_next()
        dialog.show_browser()
        assert {*self.get_selected_card_ids()} == {*setup.note2_card_ids}
        verify_that_the_table_shows_note2_cards_then_note1_cards()
示例#3
0
    def dialog(self, setup):
        edit_dialog = Edit.open_dialog_and_show_note_with_id(setup.note1_id)
        preview_dialog: DecentPreviewer = edit_dialog.show_preview()

        def press_next_button(times=0):
            for _ in range(times):
                preview_dialog._last_render = 0  # render without delay
                preview_dialog._on_next()

        preview_dialog.press_next_button = press_next_button

        yield preview_dialog
示例#4
0
    def test_selects_cards_of_last_note(self, setup):
        Edit.open_dialog_and_show_note_with_id(setup.note1_id)
        Edit.open_dialog_and_show_note_with_id(setup.note2_id).show_browser()

        assert {*self.get_selected_card_ids()} == {*setup.note2_card_ids}
示例#5
0
 def test_dialog_opens(self, setup):
     dialog = Edit.open_dialog_and_show_note_with_id(setup.note1_id)
     dialog.show_browser()
示例#6
0
def test_edit_dialog_fails_to_open_with_invalid_note(setup):
    with pytest.raises(Exception):
        Edit.open_dialog_and_show_note_with_id(123)
示例#7
0
def test_edit_dialog_opens_only_once(setup):
    dialog1 = Edit.open_dialog_and_show_note_with_id(setup.note1_id)
    dialog2 = Edit.open_dialog_and_show_note_with_id(setup.note1_id)
    assert dialog1 is dialog2
示例#8
0
def test_edit_dialog_opens(setup):
    Edit.open_dialog_and_show_note_with_id(setup.note1_id)
示例#9
0
 def dialog(self, setup):
     Edit.open_dialog_and_show_note_with_id(setup.note1_id)
     yield Edit.open_dialog_and_show_note_with_id(setup.note2_id)
示例#10
0
 def test_old_note_reopened(self, setup):
     Edit.open_dialog_and_show_note_with_id(setup.note1_id)
     Edit.open_dialog_and_show_note_with_id(setup.note2_id)
     Edit.open_dialog_and_show_note_with_id(setup.note1_id)
     assert history.note_ids == [setup.note2_id, setup.note1_id]
示例#11
0
 def test_single_note(self, setup):
     assert history.note_ids == []
     Edit.open_dialog_and_show_note_with_id(setup.note1_id)
     assert history.note_ids == [setup.note1_id]
示例#12
0
 def test_addon_buttons_get_disabled_enabled(self, setup, manipulator):
     Edit.open_dialog_and_show_note_with_id(setup.note2_id)
     manipulator.wait_until_toolbar_buttons_are_ready()
     assert manipulator.is_button_disabled("previous") is False
     assert manipulator.is_button_disabled("next") is True
示例#13
0
 def manipulator(self, setup):
     dialog = Edit.open_dialog_and_show_note_with_id(setup.note1_id)
     return JavascriptDialogButtonManipulator(dialog)
示例#14
0
 def test_opens(self, setup):
     edit_dialog = Edit.open_dialog_and_show_note_with_id(setup.note1_id)
     edit_dialog.show_preview()