1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2025-01-03 13:45:49 +00:00
vorta/tests/test_source.py
Manu 52233a9844
Fix flaky tests (#788)
* New DB for each test, hopefully takes care of race condition when using new DB.
* Centralize timeout setting
2021-02-17 10:14:58 +08:00

23 lines
734 B
Python

import os
import pytest
import vorta.models
import vorta.views
from PyQt5.QtWidgets import QApplication
from PyQt5 import QtCore
def test_add_folder(qapp, qtbot, tmpdir, monkeypatch, choose_file_dialog):
monkeypatch.setattr(
vorta.views.source_tab, "choose_file_dialog", choose_file_dialog
)
main = qapp.main_window
main.tabWidget.setCurrentIndex(1)
tab = main.sourceTab
tab.sourceAddFolder.click()
qtbot.waitUntil(lambda: tab.sourceFilesWidget.rowCount() == 2, **pytest._wait_defaults)
# Test paste button
QApplication.clipboard().setText(os.path.expanduser('~')) # Load clipboard
qtbot.mouseClick(tab.paste, QtCore.Qt.LeftButton)
assert tab.sourceFilesWidget.rowCount() == 3