summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>2023-10-24 14:28:28 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-30 22:24:32 +0000
commit6745d5eb7ccf73ffaf215b3cdc9181292a05e15f (patch)
tree0ccff33e9a82ee7596f9cb512badb3039ecba137
parent60a434179c6e6e90ab6a30fc9ffdc14110db15fd (diff)
downloadpoky-6745d5eb7ccf73ffaf215b3cdc9181292a05e15f.tar.gz
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>
-rw-r--r--bitbake/lib/toaster/tests/browser/selenium_helpers_base.py8
-rw-r--r--bitbake/lib/toaster/tox.ini20
2 files changed, 27 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
index 9a4e27a3bc..e0ac43768e 100644
--- a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
+++ b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
@@ -33,7 +33,13 @@ def create_selenium_driver(cls,browser='chrome'):
33 browser = env_browser 33 browser = env_browser
34 34
35 if browser == 'chrome': 35 if browser == 'chrome':
36 return webdriver.Chrome() 36 options = webdriver.ChromeOptions()
37 options.add_argument('headless')
38 options.add_argument('--disable-infobars')
39 options.add_argument('--disable-dev-shm-usage')
40 options.add_argument('--no-sandbox')
41 options.add_argument('--remote-debugging-port=9222')
42 return webdriver.Chrome(options=options)
37 elif browser == 'firefox': 43 elif browser == 'firefox':
38 return webdriver.Firefox() 44 return webdriver.Firefox()
39 elif browser == 'marionette': 45 elif browser == 'marionette':
diff --git a/bitbake/lib/toaster/tox.ini b/bitbake/lib/toaster/tox.ini
new file mode 100644
index 0000000000..8c0fe17181
--- /dev/null
+++ b/bitbake/lib/toaster/tox.ini
@@ -0,0 +1,20 @@
1[tox]
2envlist = py38, py39, py310
3skipsdist = True
4toxworkdir = {env:TOX_WORKDIR:.tox}
5passenv = *
6
7[testenv]
8setenv =
9 DJANGO_SETTINGS_MODULE=toastermain.settings_test
10 TOASTER_BUILDSERVER=1
11 BUILDDIR = {env:BUILDDIR}
12 EVENTREPLAY_DIR = {env:EVENTREPLAY_DIR:BUILDDIR}
13commands =
14 python3 {toxinidir}/manage.py test tests.db tests.commands tests.builds tests.browser tests.functional tests.views
15deps =
16 -r {toxinidir}/../../toaster-requirements.txt
17 -r {toxinidir}/tests/toaster-tests-requirements.txt
18
19[testenv:chrome]
20commands={[testenv]commands} --splinter-webdriver=chrome \ No newline at end of file