generic-poky/bitbake/lib/toaster/tests/browser
Richard Purdie 931ce04b08 bitbake: toaster: Reference pip3 not pip
Now that we use python3, we should refer to pip3, not pip.

[YOCTO #10774]

(Bitbake rev: 99136f5f591deef0c96d9aea2dbea1c216f38121)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 15:52:08 +00:00
..
README bitbake: toaster: Reference pip3 not pip 2016-12-08 15:52:08 +00:00
__init__.py bitbake: toaster: tests Migrate to Selenium for UI tests 2016-04-01 07:14:58 +01:00
selenium_helpers.py bitbake: toaster-tests: add class SeleniumTestCaseBase for browser tests 2016-07-20 10:38:52 +01:00
selenium_helpers_base.py bitbake: toaster: browser tests - add Selenium Docker container as driver 2016-12-07 10:42:22 +00:00
test_all_builds_page.py bitbake: toaster-tests: add tests for build time links in the all builds page 2016-08-11 00:09:26 +01:00
test_all_projects_page.py bitbake: toaster: selenium tests Fix all_projects page and sample tests 2016-06-15 08:35:06 +01:00
test_builddashboard_page.py bitbake: toaster-tests: add tests for build dashboard menu and summary visibility 2016-08-11 00:09:27 +01:00
test_builddashboard_page_artifacts.py bitbake: toaster-tests: add tests for build dashboard menu and summary visibility 2016-08-11 00:09:27 +01:00
test_builddashboard_page_recipes.py bitbake: toaster-tests: add tasks and recipes sub-page tests 2016-07-26 08:10:37 +01:00
test_builddashboard_page_tasks.py bitbake: toaster-tests: add tasks and recipes sub-page tests 2016-07-26 08:10:37 +01:00
test_js_unit_tests.py bitbake: toaster-tests: fix tests for latest Selenium version 2016-06-15 08:35:06 +01:00
test_landing_page.py bitbake: toaster: tests Migrate landing page tests to Selenium 2016-04-01 07:14:59 +01:00
test_layerdetails_page.py bitbake: toaster: test browser test_layerdetails_page add wait_until_visible 2016-11-04 12:50:55 +00:00
test_most_recent_builds_states.py bitbake: toaster-tests: add tests for most recent builds state changes 2016-08-11 00:09:27 +01:00
test_new_custom_image_page.py bitbake: toaster: selenium tests Update unique custom image string and fix import 2016-06-15 08:35:06 +01:00
test_new_project_page.py bitbake: toaster: tests test_new_project_page Catch button not enabled exception 2016-08-11 00:07:09 +01:00
test_project_builds_page.py bitbake: toaster: tests Migrate project builds page tests to Selenium 2016-04-01 07:14:59 +01:00
test_project_config_page.py bitbake: bitbake: toaster-tests: tests for project config 2016-07-08 09:57:27 +01:00
test_project_page.py bitbake: toaster: Update tests to reflect front end changes 2016-10-06 11:41:48 +01:00
test_sample.py bitbake: toaster: selenium tests Fix all_projects page and sample tests 2016-06-15 08:35:06 +01:00
test_task_page.py bitbake: toaster-tests: add test for showing self-dependent task 2016-08-11 00:09:27 +01:00
test_toastertable_ui.py bitbake: toaster-tests: add tests for reverting to default sort 2016-08-11 00:09:27 +01:00

README

# Running Toaster's browser-based test suite

These tests require Selenium to be installed in your Python environment.

The simplest way to install this is via pip3:

  pip3 install selenium==2.53.2

Note that if you use other versions of Selenium, some of the tests (such as
tests.browser.test_js_unit_tests.TestJsUnitTests) may fail, as these rely on
a Selenium test report with a version-specific format.

To run tests against Chrome:

* Download chromedriver for your host OS from
  https://sites.google.com/a/chromium.org/chromedriver/downloads
* On *nix systems, put chromedriver on PATH
* On Windows, put chromedriver.exe in the same directory as chrome.exe

To run tests against PhantomJS (headless):
--NOTE - Selenium seems to be deprecating support for this mode ---
* Download and install PhantomJS:
  http://phantomjs.org/download.html
* On *nix systems, put phantomjs on PATH
* Not tested on Windows

To run tests against Firefox, you may need to install the Marionette driver,
depending on how new your version of Firefox is. One clue that you need to do
this is if you see an exception like:

  selenium.common.exceptions.WebDriverException: Message: The browser
  appears to have exited before we could connect. If you specified
  a log_file in the FirefoxBinary constructor, check it for details.

See https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
for installation instructions. Ensure that the Marionette executable (renamed
as wires on Linux or wires.exe on Windows) is on your PATH; and use "marionette"
as the browser string passed via TOASTER_TESTS_BROWSER (see below).

(Note: The Toaster tests have been checked against Firefox 47 with the
Marionette driver.)

The test cases will instantiate a Selenium driver set by the
TOASTER_TESTS_BROWSER environment variable, or Chrome if this is not specified.

To run tests against the Selenium Firefox Docker container:
More explanation is located at https://wiki.yoctoproject.org/wiki/TipsAndTricks/TestingToasterWithContainers
* Run the Selenium container:
  ** docker run -it --rm=true -p 5900:5900 -p 4444:4444 --name=selenium selenium/standalone-firefox-debug:2.53.0
  *** 5900 is the default vnc port. If you are runing a vnc server on your machine map a different port e.g. -p 6900:5900 and connect vnc client to 127.0.0.1:6900
  *** 4444 is the default selenium sever port.
* Run the tests
  ** TOASTER_TESTS_BROWSER=http://127.0.0.1:4444/wd/hub TOASTER_TESTS_URL=http://172.17.0.1:8000 ./bitbake/lib/toaster/manage.py test --liveserver=172.17.0.1:8000 tests.browser
  ** TOASTER_TESTS_BROWSER=remote TOASTER_REMOTE_HUB=http://127.0.0.1:4444/wd/hub ./bitbake/lib/toaster/manage.py test --liveserver=172.17.0.1:8000 tests.browser
  *** TOASTER_REMOTE_HUB - This is the address for the Selenium Remote Web Driver hub. Assuming you ran the contianer with -p 4444:4444 it will be http://127.0.0.1:4444/wd/hub.
  ***  --liveserver=xxx tells Django to run the test server on an interface and port reachable by both host and container.
  **** 172.17.0.1 is the default docker bridge on linux, viewable from inside and outside the contianers. Find it with "ip -4 addr show dev docker0"
* connect to the vnc server to see the tests if you would like
   ** xtightvncviewer 127.0.0.1:5900
   ** note, you need to wait for the test container to come up before this can connect.

Available drivers:

* chrome (default)
* firefox
* marionette (for newer Firefoxes)
* ie
* phantomjs (deprecated)
* remote

e.g. to run the test suite with phantomjs where you have phantomjs installed
in /home/me/apps/phantomjs:

PATH=/home/me/apps/phantomjs/bin:$PATH TOASTER_TESTS_BROWSER=phantomjs manage.py test tests.browser