Commit Graph

27 Commits

Author SHA1 Message Date
Richard Purdie
56a8e5283e bitbake: toaster/tests/browser/helper: Add wait for jquery to complete
Most of the tests that click on buttons need the DOM to stablise, including
any running JQuery code before the test can proceed. Add calls to do this
whenever we're about to click on an element.

(Bitbake rev: 0eb206b355248e2a874a62baec30025652f2a5a8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-24 11:24:03 +01:00
Richard Purdie
ed7105cb3f bitbake: toaster/tests/browser/helper: Add wait_until_element_clickable funciton
Add a variant of the clickable function that accepts an element parameter.

(Bitbake rev: a34b2451a0e3baaf3b2fd2eb351847ff6a5ee033)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-24 11:24:03 +01:00
Richard Purdie
dd14fac826 bitbake: toaster/tests/browser/helper: Improve wait_until_clickable exception handling
Our own Wait() class allows exception handling which this form of wrapper
does not. Switch the code to use our Wait() class to allow retrying upon
encountering those exceptions (such as an element not being present yet).

The displayed and visible test is what Selenium would be doing internally,
there is no JS reprensetation of clickable directly.

(Bitbake rev: 8266a01b750b3758badeee8fb3a1acfa72c17a93)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-24 11:24:03 +01:00
Richard Purdie
9c80b40ee5 bitbake: toaster/tests/browser/helpers: Drop remains of polling/sleep calls
Drop the remaining poll parameters from the helpers code along
with the remaining sleep call since the tests no longer depend
on this.

This has the nice benefit of significantly speeding up the toaster
test runs (45 minutes down to 12 minutes overall).

If a parameter is needed, it should be the timeout, not the polling
frequency.

(Bitbake rev: 6de912e4f278ffd694fb2258482081dc3bc61c7a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-24 11:24:03 +01:00
Richard Purdie
d0c0c00f6c bitbake: toaster/tests/browser/helpers: Add not visible wait function
In some cases we want to wait until some element is not visible.
Add such a function helper.

(Bitbake rev: cede6519d25112037264550126b109903220b58c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-24 11:24:03 +01:00
Richard Purdie
4d9ad3bb8e bitbake: toaster/tests/functional/helpers: Drop unneeded poll values and sleep
Drop the remaining poll values and the sleep within the main wait function
as the races this was working around now seem to be resolved with the
preceeding patches.

(Bitbake rev: 91e54cbacc57316a4f2ca766afac81e7f3a54718)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-24 11:24:03 +01:00
Richard Purdie
d67b698be2 bitbake: toaster/tests/browser: Increase the default wait timeout
Rather than hardcoded poll and sleep values, we want an overall long timeout
and to drop all the other 'sleeping' code.

To facilitate this, increase the overall timeout so we can then start to
remove the other values.

(Bitbake rev: 69a479383f9a8cae6600ce51b12b62be3a15ea38)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-24 11:24:03 +01:00
Richard Purdie
7637bd0b9c bitbake: tests/browser: Avoid python 3.9 syntax
Python 3.9 isn't our minimum version yet, avoid using removeprefix.

(Bitbake rev: 8cb9eb6a4f1be4620fcde347faa5c1fb6d77bf70)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-14 21:44:38 +01:00
Richard Purdie
b974b3dfc1 bitbake: toaster/tests/selenium_helper_base: Handle WebDriverException
The WebDriverException can occur if elements are not present in the DOM
yet. Catch and handle this. It is our most frequently occuring failure
in automated testing now.

(Bitbake rev: 006173cbd32116ff1cea59b2c99eead807be39bb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-14 21:44:38 +01:00
Alassane Yattara
49ccf2f5e0 bitbake: toaster/tests: Setup delay after driver action self.get(url)
Recurring test failures result from insufficient delays in driver actions.

(Bitbake rev: b0de2a61d14fbf30e338751b285b3bab80192275)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 13:55:33 +00:00
Alassane Yattara
6a67f24773 bitbake: toaster/tests: bug-fix An element matching "#projectstable" should be visible
(Bitbake rev: 1edb97f741a48481b1b9f26c5cb31acd9059f07f)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-01 23:13:50 +00:00
Alassane Yattara
adb7efe522 bitbake: toaster/tests: bug-fix element click intercepted in browser/test_layerdetails_page.py
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted

(Bitbake rev: d1936616cafc1aced69c7b5758e44638eb62b5ac)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alexander Lussier-Cullen
0fd93b86c4 bitbake: toaster/tests: fix chrome argument syntax and wait for driver exit
The chrome driver sometimes fails with a page crash for a full suite
of tests, pointing to a failure in the setup of the driver due to
resource limitations.
To mitigate these crashes, add a wait between driver driven tests to
ensure resources are freed.

(Bitbake rev: 8f998e27aae694c16f788aac12558621089d0839)

Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alexander Lussier-Cullen
e9c2003bd0 bitbake: toaster/tests: Exit tests on chromedriver creation failure
When failing to create the web driver session for selenium tests,
a cascade of erroring tests will follow. To avoid processing these
unnecessarily, exit the tests completely in this case.

(Bitbake rev: 9327196102dd2671fcdb3200d9490e683f81d3a1)

Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alexander Lussier-Cullen
effe2498eb bitbake: toaster: Add verbose printout for missing chrome(driver) dependencies
If the chrome driver binary is missing dependencies, it was near impossible
to work out which ones from just the logs. Add code to help debug things
if this happens by including the ldd output.

(Bitbake rev: 0ffe5fccbb7db5aca5c409fe00be2be69a6e37d9)

Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-12 15:58:57 +00:00
Alassane Yattara
715898cb9a bitbake: toaster/tests: Update methods wait_until_~ to skip using time.sleep
Update Class Wait from selenium_helpers_base, to override
wait_until_visible and wait_until_present with poll argument to better
handle delay between driver actions

(Bitbake rev: 486817ac6ad28580d81dcf6e3789678d9259bb54)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:22 +00:00
Richard Purdie
278d1941a3 bitbake: Revert "toaster: Bug-fix webdriver No parameter named options"
This reverts commit 99305c25fafa61064a1bb0849616e4627e3453d7.

After discussion we found various versions of selenium don't work
with this change.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-09 22:52:42 +00:00
Alassane Yattara
2378e4bdfa bitbake: toaster: Bug-fix webdriver No parameter named options
Change options to chrome_options

(Bitbake rev: 99305c25fafa61064a1bb0849616e4627e3453d7)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-09 17:06:59 +00:00
Marlon Rodriguez Garcia
6745d5eb7c bitbake: toaster: add tox.ini file to execute test suite
Updated tox file to fix enviroments variables.
to run tox use the following command:
tox -e env_name -c /path/to/file/tox.ini
See tox cli https://tox.wiki/en/latest/cli_interface.html
The variable env_name is linked to the python versions (py38, py39, py310).
If env_name option is not set,  the test suite will run for all indicated versions.

It was also modified the webdriver options for chrome to run selenium test in console because of the error detected in the previous test run
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

(Bitbake rev: 11dfd7c05642269b7a8bff2918667348d041ec79)

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>

Changes in v2
- Updated variable path BUILDDIR and EVENTREPLAY_DIR to use enviroment value
- Updated toaster-requirements.txt file path
- Removed flake8
- Added webdriver options to chrome

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-30 22:24:32 +00:00
Marlon Rodriguez Garcia
3ac4694fc3 bitbake: toaster: update selenium version and code syntax
Updated selenium version to latest 4.13.0, changed selenum specific version syntax elements to accomplish test success

(Bitbake rev: 868c88a249ef4b9fe5a891e76e25e054e4fcd994)

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-06 11:42:46 +01:00
Frazer Clews
0ac5174c7d bitbake: lib: remove unused imports
removed unused imports which made the code harder to read, and slightly
but less efficient

(Bitbake rev: 4367692a932ac135c5aa4f9f2a4e4f0150f76697)

Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-19 13:31:05 +00:00
Robert Yang
1337766521 bitbake: bitbake: toaster:tests: python -> python3
(Bitbake rev: 683c24788d96176699a585055eb62d8a71830a12)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-06-28 13:29:04 +01:00
Richard Purdie
9501864db8 bitbake: bitbake: Strip old editor directives from file headers
There are much better ways to handle this and most editors shouldn't need this
in modern times, drop the noise from the files. Its not consitently applied
anyway.

(Bitbake rev: 5e43070e3087d09aea2f459b033d035c5ef747d0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04 10:44:10 +01:00
Richard Purdie
cf9c0be3f6 bitbake: bitbake: Drop duplicate license boilerplace text
With the introduction of SPDX-License-Identifier headers, we don't need a ton
of header boilerplate in every file. Simplify the files and rely on the top
level for the full licence text.

(Bitbake rev: 695d84397b68cc003186e22f395caa378b06bc75)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04 10:44:10 +01:00
Richard Purdie
79834a7144 bitbake: bitbake: Add initial pass of SPDX license headers to source code
This adds the SPDX-License-Identifier license headers to the majority of
our source files to make it clearer exactly which license files are under.

The bulk of the files are under GPL v2.0 with one found to be under V2.0
or later, some under MIT and some have dual license. There are some files
which are potentially harder to classify where we've imported upstream code
and those can be handled specifically in later commits.

The COPYING file is replaced with LICENSE.X files which contain the full
license texts.

(Bitbake rev: ff237c33337f4da2ca06c3a2c49699bc26608a6b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04 10:44:04 +01:00
brian avery
da22be9904 bitbake: toaster: browser tests - add Selenium Docker container as driver
Adds the ability to specify a Selenium Docker container server as
a driver. This allows for repeatable tests independent of host.
Currently we assume you are using the Firefox container. Instructions
are located in the README in tests/browser.

(Bitbake rev: 7df842f8f8b2ae640109ed06729ab59c9469fc64)

Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:42:22 +00:00
Richard Purdie
aa2d945423 bitbake: lib/toaster: Fix missing new files from previous commits
(Bitbake rev: f77e6f21a2cc57a3fcb5970437e55cfae39849a3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-01 09:38:35 +01:00