Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
sudo: required
services:
- docker
addons:
firefox: "latest"
language: node_js
node_js:
- '4'
Expand All @@ -6,15 +11,22 @@ env:
- TASK=lint
- TASK=unittest GUI=1
- TASK=servertest
- TASK=tox TOXENV=discopane-ui-tests GUI=1
cache:
directories:
- node_modules
before_install:
- npm install -g npm@3
- npm --version
- sudo pip install tox
- wget "https://github.com/mozilla/geckodriver/releases/download/v0.10.0/geckodriver-v0.10.0-linux64.tar.gz"
- gunzip -c geckodriver-v0.10.0-linux64.tar.gz | tar xopf -
- chmod +x geckodriver
- sudo mv geckodriver /usr/local/bin
before_script:
- if [ $GUI ]; then export DISPLAY=:99.0 && sh -e /etc/init.d/xvfb start && sleep 3; fi
script:
- npm run $TASK
- if [[ $TASK == 'tox' ]]; then docker run -d -p 4000:4000 -e NODE_APP_INSTANCE=disco -e NODE_ENV=uitests $(docker build -q .) /bin/sh -c "npm run build && npm run start" && sleep 60 && tox -- --base-url=http://localhost:4000; fi
- if [[ $TASK != 'tox' ]]; then npm run $TASK; fi
addons:
firefox: latest
22 changes: 3 additions & 19 deletions tests/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,21 @@ If you think you would like to contribute to the tests by writing or maintaining
it would be a good idea to create a fork of this repository first, and then clone that.
GitHub also has great instructions for [forking a repository][git-fork].

### Create or activate a Python virtual environment
You should install this project's dependencies (which is described in the next step) into a virtual environment
in order to avoid impacting the rest of your system, and to make problem solving easier.
If you already have a virtual environment for these tests, then you should activate it,
otherwise you should create a new one.
For more information on working with virtual environments see our
[summary][virtualenv].

### Install dependencies
Install the Python packages that are needed to run our tests using pip. In a terminal,
from the the project root, issue the following command:

```bash
$ pip install -Ur requirements.txt
```

### Run the tests
Tests are run using the command line. Below are a couple of examples of running the tests:
Tests are run using tox on the command line. Below are a couple of examples of running the tests:

Before running, ensure the [GeckoDriver executable][geckodriver] (rename to wires) is in your path.

Note: The tests must be run in Firefox 48 or later, and geckodriver (wires) must be 0.9.0.

```bash
$ py.test --firefox-path=<path-to-firefox> test_discopane.py
$ tox -e ui-tests
```

To run against a different environment, pass in a value for `--base-url`, like so:

```bash
$ py.test --base-url https://discovery.addons.mozilla.org --firefox-path=<path-to-firefox> test_discopane.py
$ tox -e ui-tests -- --base-url https://discovery.addons.mozilla.org
```

The pytest plugin that we use for running tests has a number of advanced
Expand Down
3 changes: 0 additions & 3 deletions tests/ui/requirements.txt

This file was deleted.

3 changes: 2 additions & 1 deletion tests/ui/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[pytest]
base_url=https://discovery.addons.mozilla.org
addopts=--driver=Firefox
base_url=https://discovery.addons.mozilla.org
xfail_strict=true
3 changes: 3 additions & 0 deletions tests/ui/test_discopane.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def discovery_pane(selenium, base_url):
return DiscoveryPane(selenium, base_url).open()


@pytest.mark.xfail(
'localhost' in pytest.config.getoption('base_url'),
reason='Add-ons cannot be installed without SSL on local')
@pytest.mark.nondestructive
def test_that_discovery_pane_loads(discovery_pane):
assert discovery_pane.is_discopane_visible
Expand Down
12 changes: 12 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[tox]
skipsdist = true
envlist = discopane-ui-tests

[testenv:discopane-ui-tests]
passenv = DISPLAY
deps =
PyPOM==1.0
pytest==2.9.2
pytest-selenium==1.3.1
selenium==3.0.0b2
commands = py.test tests/ui/test_discopane.py {posargs}