-
-
Notifications
You must be signed in to change notification settings - Fork 605
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
Make combining multiple content filters more robust #3383
Merged
falkoschindler
merged 4 commits into
integration-test-framework
from
filter-combinations
Jul 22, 2024
Merged
Make combining multiple content filters more robust #3383
falkoschindler
merged 4 commits into
integration-test-framework
from
filter-combinations
Jul 22, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
falkoschindler
approved these changes
Jul 22, 2024
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.
I'm approving this PR mostly for the additional test and because it will work in 99.999% rather than only 99.99% of all cases. But maybe we'll find an even better way to find elements in the DOM before merging into main.
falkoschindler
merged commit Jul 22, 2024
9641eec
into
integration-test-framework
1 of 6 checks passed
rodja
added a commit
that referenced
this pull request
Aug 3, 2024
* begin implementing ui.get to query elements * type hinting, getting all elements and __repr__ * set style, classes, props with ui.get() * introduce .within filter * more stable test * element.keys(..) + ui.get(key=...) * allow setting multiple keys for ui.get * allow filtering ui.get(..).within(key=..) * allow multiple keys in ui.get * testing ui.get with TextElement * allow filtering with `ui.get(text=...)` * ui.get(..).exclude(type=..., key=..., text=...) * introduce ui.get().not_within(...) * add documentation page and use_local_scope param * fixed default * ui.get within elements * Enhance test example to show how to test with routing. Also rename pytest example to integration_tests to not have name-collisions * first proof of concept for simulated screen * demo async test * fix click in simulated screen * simulated screen can now handle async pages * do module reloading through pytest marker * determine whether to use simulation screen or selenium screen * rename Screen to SeleniumScreen to better pair it with SimulatedScreen * docstrings * custom marker * first concept of detecting failures on event loop * checking exceptions in other thread * use same event loop for tests and app which simplifies things a lot * show content of simulated screen on failure * simulating sio handshake to test for connection * notes * provide pytest plugin and ensure SimulatedScreen does not load Selenium fixtures * remove pytest.ini * better description for pytest marker * ensure fixtures are run when using screen * ensure loop is closed * cleanup * fixed async warning by making selenium_screen fixture non-async * start testing the chat app example * test typing into chat app * fix test * cleanup * ignore test_ files when building link examples * python 3.8 compatibility * re-adding tests/conftest.py because nicegui itself does not benefit from the newly provided pytest plugin * for testing we need to manage multiple clients in the same asyncio task * use __init__.py and relative import to get right main module * element tests without screen need to explicitly reset globals * keep original stack behaviour if we do not simulate * rename ui.get to ui.find * rename element.tags to element.markers * refactored ui.find into ElementFilter which serves as foundation for new user.should_see(...) * better naming and fixed documentation * cleanup * increased is-displayed delay * do multiple checks for visibility * adapt tests to use SeleniumScreen * use configurable url * allow subclasses of screen fixtures * clear urls and reset on_air for each test * cleanup * registering signals does not work in pytests * user.should_see is now async * warn if its not a nicegui page * print markers * provide check if code is executed in pytest * support storage in simulated screen * dropped simulated screen concept to make one user visit multiple pages (for example via ui.navigate.to) * re-add typing capabilities * check for notifications * fix ui.navigate.to for simulation * renaming * fix excluding_text test * make conftest generally available (like the examples) * cleanup * fix usage of context * support for auto-index-pages * click checkbox toggles value in simulation * fix "Self" import * make fixtures available via pytest plugin * adapted new tests to new structure * ensure utf-8 * try latest pytest * use newly named screen class * update dependencies * restore original ui.navigate.to after we exit simulated user * fix logging and types * fix type hint for python 3.8 * fix users fixture in combination with ui.navigate.to * try with longer timeout * only prepare auto index client for simulation if the user fixture is chosen * analyze core.loop issue with failing tests * Revert "analyze core.loop issue with failing tests" This reverts commit 725965c. * only assert loop is closed if it has been created because some tests may exit without calling screen.open() * better naming * renaming function and files * renaming * cleanup * add user.should_not_see and user.trigger methods * add integration tests for todo list example * icon prop is content * fix typing * return self * add integration tests for authentication example this uncovered the need to get new context in every retry to handle page changes * allow clicking on links in user simulation * always stop server * add link to example * remove accidentally commited env file * renaming * improve check if we are running as pytest * add typehint * remove obsolete try/except * remove obsolete code (may have been here due to bad merge conflict resolving) * cleanup * reload run module between tests to fix it on GitHub Action * introduction of UserFocus to trigger events * using non-async user.focus to simplify API * add user.focus(...).click() * updated tests to use new user.focus for interaction * formatting * reset to main version * adapted auth tests * make Self available for lower python versions * provide overloaded methods to simplify API * renaming and more simplifications * better imports * fix import Self * renaming * code review * add back requirements.txt * code review * rework str output shown on a failing test * fix some typing issues * remove obsolete test * simplify test_multiple_pages * update element filter tests to use User instead of Screen * fix tests by resetting default attributes for elements * Use ui.notification for ui.notify to simplify user simulation tests (#3369) * use ui.notification for ui.notify to simplify user simulation tests * code review --------- Co-authored-by: Falko Schindler <falko@zauberzeug.com> * Use `Set` in user._gather_elements and improve typing (#3370) * use set in user._gather_elements and improve typing * code review --------- Co-authored-by: Falko Schindler <falko@zauberzeug.com> * code review for Element.__str__ * simplify mark() * Fix typing for ElementFilter and User (#3381) * improve typing and naming * fix typing * reverted "kind" and type T of ElementFilter * fix element filter type inference * fix typing in __next__ * ignore typing where it can not be matched * open page * code review --------- Co-authored-by: Falko Schindler <falko@zauberzeug.com> * Implement full `ui.navigate` functionality for user simulation (#3382) * make ui.navigate an object of a replaceable class to simplify and improve user simulation * provide ui.navigate.reload for user simulation * code review --------- Co-authored-by: Falko Schindler <falko@zauberzeug.com> * Make combining multiple content filters more robust (#3383) * make ui.navigate an object of a replaceable class to simplify and improve user simulation * provide ui.navigate.reload for user simulation * make combining multiple content filters more robust --------- Co-authored-by: Falko Schindler <falko@zauberzeug.com> * fix problem with `ui.navigate` on documentation page * move element filter documentation to styling and appearance * fix ui.open * pylint * try removing explicit response.encoding * add user interaction with ui.switch, ui.editor and ui.codemirror * Improve iteration of elements (#3385) * make ui.navigate an object of a replaceable class to simplify and improve user simulation * provide ui.navigate.reload for user simulation * make combining multiple content filters more robust * introduce element.ancestors and element.descendants * rewrite __iter__ (tests still failing) * fix typo * improve filter * fix another condition * fix deletion of elements * replace tee with list for efficiency * add some more tests and fix conditions * remove len and getitem --------- Co-authored-by: Rodja Trappe <rodja@zauberzeug.com> * improve type annotation * extend docstring * fix rule for ancestor kinds * refactor element filter tests * fix link to example folder * more consistent rules Co-authored-by: Falko Schindler <falko@zauberzeug.com> * update filter rules and re-organize element filter tests * add test which combines multiple "within" statements * demonstrate validity of having multiple elements for a singe within clause * pytest configuration & fixtures (#3411) * remove pytest-prefix from plugin specification * fix requirements and settings for pytests example * rename screen and user with prefix nicegui_ * add conftest with renaming to pytests example * add internal renaming of nicegui_screen to screen and nicegui_user to user * remove unused pylint ignore * fix rename in examples * remove entry point * remove renaming * remove renaming in examples * remove renaming fixtures and add example code * double quotes * reworked as described in docs (#3413) * add pytest plugin loading to examples * run the pytest examples as part of the test_startup.sh to avoid conflicts in setup * renamed the pytest plugin from fixtures.py to plugin.py * fix todo tests * rename folder --------- Co-authored-by: Rodja Trappe <rodja@zauberzeug.com> Co-authored-by: Falko Schindler <falko@zauberzeug.com> * remove redundant test * add multi-user navigation test * Add documentation of pytest fixtures and pytest configuration (#3413) * begin with documentation of fixtures and pytest setup * code review * also prepare simulation for screen fixture * replace hacky docs.pytest and Demo.raw with generic docs.part * better split of testing topics in the docs * improve user docs * add UserInteraction reference * review * simplify doc.part * fix storage test * web driver info * review --------- Co-authored-by: Falko Schindler <falko@zauberzeug.com> * add conftest.py for backward compatibility * remove activate() and deactivate() --------- Co-authored-by: Falko Schindler <falko@zauberzeug.com> Co-authored-by: Paula Kammler <paula@zauberzeug.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.