-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Add test to check basic interactions with layer controls widgets #5757
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff @dalthviz - thank you
Would love to see this in but the test failures on pyside look real
https://github.com/napari/napari/actions/runs/4768301656/jobs/8477468793?pr=5757
Any ideas how we could get around those?
Hi @alisterburt, thank you for giving this a check! I think the problem comes from PySide2/6 not having the |
122f47a
to
2a25e97
Compare
Codecov Report
@@ Coverage Diff @@
## main #5757 +/- ##
==========================================
+ Coverage 89.79% 89.93% +0.14%
==========================================
Files 614 614
Lines 52196 52327 +131
==========================================
+ Hits 46870 47062 +192
+ Misses 5326 5265 -61
|
Looks great! @kne42 any thoughts on this one? In particular, are there some other parts of the GUI you were thinking needed more automated testing? |
… are related to known unresolved issues and undo range changes for spinbox based widgets for the labels controls
expected_errors = [ | ||
"MemoryError: Unable to allocate", # See https://github.com/napari/napari/issues/5798 | ||
"ValueError: array is too big; `arr.size * arr.dtype.itemsize` is larger than the maximum possible size.", # See https://github.com/napari/napari/issues/5798 | ||
"ValueError: Maximum allowed dimension exceeded", # See https://github.com/napari/napari/issues/5798 | ||
"IndexError: index ", # See https://github.com/napari/napari/issues/4864 | ||
"RuntimeWarning: overflow encountered", # See https://github.com/napari/napari/issues/4864 | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make a note in each of these issues that any PR to close them should also remove these lines from this test? (You might have to do it after this PR is merged, in order to link to the line(s) directly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! Will do 👍
Nice work! Thank you @dalthviz 🎉 If you can follow up on this suggestion that would be fantastic. |
Initial effort towards improving GUI testing automation: https://napari.zulipchat.com/#narrow/stream/212875-general/topic/GUI.20testing This is an initial attempt to add more tests for code related with GUI elements. The new parametrized test proposed creates an instance of a layer (`Image`, `Labels`, `Points`, `Shapes`, `Surface`, `Tracks` or `Vectors`) and then operates over the layer control widgets simulating user usage (`QCombox`, `QSpinBox` and `QSlider` based widgets value changes, clicking `QCheckbox` and buttons widgets, `QColorSwatch` widgets color changes typing colors, etc) This also fixes a little issue that I noticed while working on the test. The error is related with the value of the color mode combobox for a Vectors layer controls. The combobox was not showing the correct value after a fallback to a valid value is done (when a `ValueError` exception is raised, the color mode value of the layer is changed to the previous one, but the combobox value was missing being updated too): * Before: ![vectors_before](https://user-images.githubusercontent.com/16781833/234071199-5d22d1b4-0653-489a-be92-68ca138033a0.gif) * After: ![vectors_after](https://user-images.githubusercontent.com/16781833/234070708-52a41085-eea8-4cd9-bcde-03c5b71395b5.gif) Besides that, the test structure also has some logic to skip some tracebacks from issues which are still open/were discovered while writing the test like #5798 and #4864 <!-- Please delete options that are not relevant. --> - [x] Add more tests <!-- Please describe the tests that you ran to verify your changes. --> - [x] all tests pass with my change - [x] I check if my changes works with both PySide and PyQt backends as there are small differences between the two Qt bindings. - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas
Initial effort towards improving GUI testing automation: https://napari.zulipchat.com/#narrow/stream/212875-general/topic/GUI.20testing This is an initial attempt to add more tests for code related with GUI elements. The new parametrized test proposed creates an instance of a layer (`Image`, `Labels`, `Points`, `Shapes`, `Surface`, `Tracks` or `Vectors`) and then operates over the layer control widgets simulating user usage (`QCombox`, `QSpinBox` and `QSlider` based widgets value changes, clicking `QCheckbox` and buttons widgets, `QColorSwatch` widgets color changes typing colors, etc) This also fixes a little issue that I noticed while working on the test. The error is related with the value of the color mode combobox for a Vectors layer controls. The combobox was not showing the correct value after a fallback to a valid value is done (when a `ValueError` exception is raised, the color mode value of the layer is changed to the previous one, but the combobox value was missing being updated too): * Before: ![vectors_before](https://user-images.githubusercontent.com/16781833/234071199-5d22d1b4-0653-489a-be92-68ca138033a0.gif) * After: ![vectors_after](https://user-images.githubusercontent.com/16781833/234070708-52a41085-eea8-4cd9-bcde-03c5b71395b5.gif) Besides that, the test structure also has some logic to skip some tracebacks from issues which are still open/were discovered while writing the test like #5798 and #4864 <!-- Please delete options that are not relevant. --> - [x] Add more tests <!-- Please describe the tests that you ran to verify your changes. --> - [x] all tests pass with my change - [x] I check if my changes works with both PySide and PyQt backends as there are small differences between the two Qt bindings. - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas
Initial effort towards improving GUI testing automation: https://napari.zulipchat.com/#narrow/stream/212875-general/topic/GUI.20testing This is an initial attempt to add more tests for code related with GUI elements. The new parametrized test proposed creates an instance of a layer (`Image`, `Labels`, `Points`, `Shapes`, `Surface`, `Tracks` or `Vectors`) and then operates over the layer control widgets simulating user usage (`QCombox`, `QSpinBox` and `QSlider` based widgets value changes, clicking `QCheckbox` and buttons widgets, `QColorSwatch` widgets color changes typing colors, etc) This also fixes a little issue that I noticed while working on the test. The error is related with the value of the color mode combobox for a Vectors layer controls. The combobox was not showing the correct value after a fallback to a valid value is done (when a `ValueError` exception is raised, the color mode value of the layer is changed to the previous one, but the combobox value was missing being updated too): * Before: ![vectors_before](https://user-images.githubusercontent.com/16781833/234071199-5d22d1b4-0653-489a-be92-68ca138033a0.gif) * After: ![vectors_after](https://user-images.githubusercontent.com/16781833/234070708-52a41085-eea8-4cd9-bcde-03c5b71395b5.gif) Besides that, the test structure also has some logic to skip some tracebacks from issues which are still open/were discovered while writing the test like #5798 and #4864 <!-- Please delete options that are not relevant. --> - [x] Add more tests <!-- Please describe the tests that you ran to verify your changes. --> - [x] all tests pass with my change - [x] I check if my changes works with both PySide and PyQt backends as there are small differences between the two Qt bindings. - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas
# Fixes/Closes Initial effort towards improving GUI testing automation: https://napari.zulipchat.com/#narrow/stream/212875-general/topic/GUI.20testing # Description This is an initial attempt to add more tests for code related with GUI elements. The new parametrized test proposed creates an instance of a layer (`Image`, `Labels`, `Points`, `Shapes`, `Surface`, `Tracks` or `Vectors`) and then operates over the layer control widgets simulating user usage (`QCombox`, `QSpinBox` and `QSlider` based widgets value changes, clicking `QCheckbox` and buttons widgets, `QColorSwatch` widgets color changes typing colors, etc) This also fixes a little issue that I noticed while working on the test. The error is related with the value of the color mode combobox for a Vectors layer controls. The combobox was not showing the correct value after a fallback to a valid value is done (when a `ValueError` exception is raised, the color mode value of the layer is changed to the previous one, but the combobox value was missing being updated too): * Before: ![vectors_before](https://user-images.githubusercontent.com/16781833/234071199-5d22d1b4-0653-489a-be92-68ca138033a0.gif) * After: ![vectors_after](https://user-images.githubusercontent.com/16781833/234070708-52a41085-eea8-4cd9-bcde-03c5b71395b5.gif) Besides that, the test structure also has some logic to skip some tracebacks from issues which are still open/were discovered while writing the test like #5798 and #4864 ## Type of change <!-- Please delete options that are not relevant. --> - [x] Add more tests # How has this been tested? <!-- Please describe the tests that you ran to verify your changes. --> - [x] all tests pass with my change - [x] I check if my changes works with both PySide and PyQt backends as there are small differences between the two Qt bindings. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas
Fixes/Closes
Initial effort towards improving GUI testing automation: https://napari.zulipchat.com/#narrow/stream/212875-general/topic/GUI.20testing
Description
This is an initial attempt to add more tests for code related with GUI elements. The new parametrized test proposed creates an instance of a layer (
Image
,Labels
,Points
,Shapes
,Surface
,Tracks
orVectors
) and then operates over the layer control widgets simulating user usage (QCombox
,QSpinBox
andQSlider
based widgets value changes, clickingQCheckbox
and buttons widgets,QColorSwatch
widgets color changes typing colors, etc)This also fixes a little issue that I noticed while working on the test. The error is related with the value of the color mode combobox for a Vectors layer controls. The combobox was not showing the correct value after a fallback to a valid value is done (when a
ValueError
exception is raised, the color mode value of the layer is changed to the previous one, but the combobox value was missing being updated too):Besides that, the test structure also has some logic to skip some tracebacks from issues which are still open/were discovered while writing the test like #5798 and #4864
References
Type of change
How has this been tested?
as there are small differences between the two Qt bindings.
Final checklist: