aboutsummaryrefslogtreecommitdiffstats
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:29 +0000
commit11dfd7c05642269b7a8bff2918667348d041ec79 (patch)
treecfa2318cf425d059e9f07353d971ed3f01d4647f
parentefbd9d54f57be7a7a10f0b56e7e62c25974e99e6 (diff)
downloadbitbake-contrib-11dfd7c05642269b7a8bff2918667348d041ec79.tar.gz
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.) 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--lib/toaster/tests/browser/selenium_helpers_base.py8
-rw-r--r--lib/toaster/tox.ini20
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py
index 9a4e27a3b..e0ac43768 100644
--- a/lib/toaster/tests/browser/selenium_helpers_base.py
+++ b/lib/toaster/tests/browser/selenium_helpers_base.py
@@ -33,7 +33,13 @@ def create_selenium_driver(cls,browser='chrome'):
browser = env_browser
if browser == 'chrome':
- return webdriver.Chrome()
+ options = webdriver.ChromeOptions()
+ options.add_argument('headless')
+ options.add_argument('--disable-infobars')
+ options.add_argument('--disable-dev-shm-usage')
+ options.add_argument('--no-sandbox')
+ options.add_argument('--remote-debugging-port=9222')
+ return webdriver.Chrome(options=options)
elif browser == 'firefox':
return webdriver.Firefox()
elif browser == 'marionette':
diff --git a/lib/toaster/tox.ini b/lib/toaster/tox.ini
new file mode 100644
index 000000000..8c0fe1718
--- /dev/null
+++ b/lib/toaster/tox.ini
@@ -0,0 +1,20 @@
+[tox]
+envlist = py38, py39, py310
+skipsdist = True
+toxworkdir = {env:TOX_WORKDIR:.tox}
+passenv = *
+
+[testenv]
+setenv =
+ DJANGO_SETTINGS_MODULE=toastermain.settings_test
+ TOASTER_BUILDSERVER=1
+ BUILDDIR = {env:BUILDDIR}
+ EVENTREPLAY_DIR = {env:EVENTREPLAY_DIR:BUILDDIR}
+commands =
+ python3 {toxinidir}/manage.py test tests.db tests.commands tests.builds tests.browser tests.functional tests.views
+deps =
+ -r {toxinidir}/../../toaster-requirements.txt
+ -r {toxinidir}/tests/toaster-tests-requirements.txt
+
+[testenv:chrome]
+commands={[testenv]commands} --splinter-webdriver=chrome \ No newline at end of file