SeleniunTestability library that helps speed up tests withasyncronous evens
Project description
robotframework-seleniumtestability
Extension plugin for Robot Framework's SeleniumLibrary >= 4.0.0 that provides help with dealing asyncronous events by providing either automatic or manual waits for the duration of real actions happening within SUT, not arbituary length sleeps. There are also some helper functions which are out of scope of upstream SeleniumLibrary but useful for testing web applications with SeleniumLibrary.
SeleniumTestability relies on core Selenium's feature Event Firing Webdriver and provides it's own listener interface that takes care of waiting in right places and instrumenting the SUT whenever it is needed.
Project Dependencies
- https://github.com/alfonso-presa/testability.js
- https://github.com/alfonso-presa/testability-browser-bindings
Installation
pip install robotframework-seleniumtestability
Usage
Initialize library
Library SeleniumLibrary plugins=SeleniumTestability;True;30 Seconds;True
Parameters
plugins=
part is standard SeleniumLibrary parameter where first part is
the plugin to load and rest of the string with semicolon separators are
parameters passed to the said plugin.
SeleniumTestabiluty has following parameters and in following order:
automatic_wait
a truthy value, if SeleniumTestabily should automatically wait for sut to be in state that it can accept more actions.
Can be enabled/disable at runtime.
Defaults to True
timeout
Robot timestring, amount of time to wait for SUT to be in state that it can be safely interacted with.
Can be set at runtime.
Defaults to 30 seconds.
error_on_timeout
A truthy value, if timeout does occur either in manual or automatic mode, this determines if error should be thrown that marks marks the exection as failure.
Can be enabled/disabled at runtime.
Defaults to True
automatic_injection
A truthy value. User can choose if he wants to instrument the SUT manually with appropriate keywords (or even, if the SUT is instrumented at build time?) or should SeleniumTestability determinine if SUT has testability features and if not then inject & instrument it automatically.
Can be enabled/disabled at runtime.
Defaults to True
Example
Click Element id:button_that_triggers_ajax_request
Click Element id:some_other_element
Log To Console This will happen right after clicking
In here, if automatic_wait has been enabled, second Click Element
keyword wont
be executed before action triggered by the first button is finished.
If automatic_wait is not enabled, test case can request the wait itself and previous example would look something like this.
Click Element id:button_that_triggers_ajax_request
Wait For Testability Ready
Click Element id:some_other_element
Wait For Testability Ready
Log To Console This would show after events triggered by second click are done.
Currently Supported Asyncronous features
- Can detect setTimeout & setImmediate calls and wait for them.
- Can detect fetch() call and wait for it to finish
- Can detect XHR requests and wait for them to finish
- Can detect CSS Animations and wait form them to finish
- Can detect CSS Transitions and wait form them to finish
Do note that CSS animations and transitions might not work in all browsers. In the past, Chrome has been a bit lacking but at the moment, our acceptance tests do show they work.
Keyword Documentation
At the moment, no online keyword documentation is avaialble but you can create one after installation:
python -m robot.libdoc SeleniumLibrary::plugins=SeleniumTestability
This is mainly due to SeleniumLibrary being plugin of SeleniumLibrary and it is intended to be used with it
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file robotframework-seleniumtestability-0.0.11.tar.gz
.
File metadata
- Download URL: robotframework-seleniumtestability-0.0.11.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c4b6e4ea098fe0906e9fa63a7b2208e242253897680f076612a0fc59420ce3f |
|
MD5 | 76fbc7ec968ecbc1b6d969223ba3a128 |
|
BLAKE2b-256 | 844ee6de121f4c7f0db64086dad346d29568938c8e96a760e7770d9e73b84531 |