Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated testing #25

Open
pllim opened this issue Nov 2, 2015 · 2 comments
Open

Automated testing #25

pllim opened this issue Nov 2, 2015 · 2 comments

Comments

@pllim
Copy link
Contributor

pllim commented Nov 2, 2015

Ideas: http://stackoverflow.com/questions/1616228/pyqt-gui-testing

@pllim
Copy link
Contributor Author

pllim commented Jun 8, 2018

I briefly played with pytest-qt that Cubeviz uses but quickly got stuck:

from PyQt5 import QtCore

from ginga.misc.log import get_logger
from ginga.misc.ModuleManager import ModuleManager
from ginga.misc.Settings import Preferences
from ginga.rv.Control import GingaShell


def test1(qtbot, tmpdir):
    logger = get_logger("my viewer", null=True)
    gs = GingaShell(logger, None, ModuleManager(logger),
                    Preferences(basefolder=tmpdir.strpath, logger=logger))
    w = gs.w.menubar
    qtbot.addWidget(w.widget)
    qtbot.mouseClick(w.get_menu("Channel".get_menu("Add Channel")),
                     QtCore.Qt.LeftButton)

    # But pop-up dialog that is Button inside HBox inside VBox!
    # How to click OK here?

There is option to mock the whole dialog pop-up (https://pytest-qt.readthedocs.io/en/latest/note_dialogs.html) but wouldn't that defeat the purpose of GUI testing?

Regardless, I am not sure if this is the correct solution as this purely tests Qt interactions, while Ginga supports a few other backends (e.g., GTK, GTK3, and Jupyter notebook) and has its own toolkit-agnostic widgets. Ideally, it would be nice to write the test only one time but can work for different backends being used (too ambitious?).

http://www.sikuli.org/ was also suggested but it appears to be Java/JavaScript/Jython intensive and its stance on Python 3 is unclear ("Python (language level 2.7) supported by the Jython interpreter"). xref sikuli/sikuli#48

@pllim pllim removed the low-priority label Jun 8, 2018
@pllim
Copy link
Contributor Author

pllim commented Jun 11, 2018

Looks like Jython is not yet PY3 compatible -- https://stackoverflow.com/questions/2351008/when-will-jython-support-python-3 (latest update in late 2017 with no solid timeline given).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant