[Toaster] [review-request]Fixed old UI tests
Smith, Elliot
elliot.smith at intel.com
Mon Apr 11 04:39:25 PDT 2016
I have one major comment on these tests: the use of time.sleep(X) isn't a
great way of waiting for page loads. It would be much better if you used a
wait_until() style API, as provided by Selenium. That way you just wait for
an element to become visible on the page, or present in its source (or
whatever), before continuing with the next step in the test.
If you are interested in how to approach this, I've repurposed some code
for Toaster which was originally written by an Intel colleague (Damien
Lespiau) working on automated tests for patchwork, which you can see here:
https://github.com/dlespiau/patchwork/blob/master/patchwork/tests/browser.py
My variation on this code is in the Toaster code base at:
http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/tree/bitbake/lib/toaster/tests/browser/selenium_helpers.py
(The main differences are that I removed the screenshot method, only
initialise the Selenium driver once per test class rather than once per
test, and have added a couple more convenience methods like
get_page_source().)
You can see an example of how to use this in a Selenium test at:
http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/tree/bitbake/lib/toaster/tests/browser/test_all_builds_page.py
(see the test_show_tasks_with_suffix() test method, which uses
wait_until_present())
I would recommend using this approach as it is much less fragile than an
arbitrary sleep. If you need any assistance in figuring out how to convert
to that API, please let me know.
Thanks.
Elliot
On 8 April 2016 at 15:15, Mihail, StanciuX <stanciux.mihail at intel.com>
wrote:
> Hello,
>
>
>
> We’ve fixed the older UI tests to work with the latest changes to IDs.
>
> You can find the code here:
>
>
> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=vhangan/toaster_tests_fixed
>
>
>
> Please let us know if anything needs updating.
>
>
>
> Regards,
>
> Mihai
>
>
>
> --
> _______________________________________________
> toaster mailing list
> toaster at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/toaster
>
>
--
Elliot Smith
Software Engineer
Intel Open Source Technology Centre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/toaster/attachments/20160411/d504837e/attachment-0001.html>
More information about the toaster
mailing list