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
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()
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
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}
def test_dialog_opens(self, setup): dialog = Edit.open_dialog_and_show_note_with_id(setup.note1_id) dialog.show_browser()
def test_edit_dialog_fails_to_open_with_invalid_note(setup): with pytest.raises(Exception): Edit.open_dialog_and_show_note_with_id(123)
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
def test_edit_dialog_opens(setup): Edit.open_dialog_and_show_note_with_id(setup.note1_id)
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)
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]
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]
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
def manipulator(self, setup): dialog = Edit.open_dialog_and_show_note_with_id(setup.note1_id) return JavascriptDialogButtonManipulator(dialog)
def test_opens(self, setup): edit_dialog = Edit.open_dialog_and_show_note_with_id(setup.note1_id) edit_dialog.show_preview()