Update smoke tests to use requests instead of seleium. (#8416)

* Removed selenium, now using requests.
This commit is contained in:
Benjamin Forehand Jr 2019-08-01 13:27:00 -05:00 коммит произвёл GitHub
Родитель 26005ae51e
Коммит 1aea165122
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 13 добавлений и 25 удалений

Просмотреть файл

@ -62,8 +62,6 @@ jobs:
cat /etc/hosts
- run:
name: Test Image
environment:
MOZ_HEADLESS: 1
command: |
sudo sysctl -w vm.max_map_count=262144
./tests/smoke/setup_docker.sh
@ -122,8 +120,6 @@ jobs:
cat /etc/hosts
- run:
name: Test Image
environment:
MOZ_HEADLESS: 1
command: |
sudo sysctl -w vm.max_map_count=262144
./tests/smoke/setup_docker.sh

Просмотреть файл

@ -4,7 +4,7 @@ A simple smoke test suite for the addons-frontend docker image.
### Prerequisites
Python 3 is recommended but the tests can run on Python 2. You must have `tox` installed either way.
Python 3 is recommended but the tests can run on Python 2. You must have `tox`, `docker` and `docker-compose` installed as well.
You should also stop any services that may be using the port `3000`. You will also need to add `olympia.test` to your `/etc/hosts` in line with `127.0.0.1`.

Просмотреть файл

@ -1,18 +1,9 @@
"""Smoke tests for addons-frontend docker image."""
import pytest
import requests
@pytest.fixture
def firefox_options(firefox_options):
"""Set up Firefox options."""
firefox_options.add_argument("-headless")
firefox_options.add_argument('-foreground')
return firefox_options
@pytest.mark.nondestructive
def test_hidden_comment_is_found(base_url, selenium):
def test_hidden_comment_is_found(base_url):
"""Test hidden element is found."""
selenium.get(base_url)
assert "<!-- Godzilla of browsers -->" in selenium.page_source
r = requests.get(base_url)
assert "<!-- Godzilla of browsers -->" in r.text

Просмотреть файл

@ -5,5 +5,6 @@ version: "2.3"
services:
addons-frontend:
image: addons-frontend:latest
image: addons-frontend
build: ../.
# This should build a local image if it isn't built already.

12
tox.ini
Просмотреть файл

@ -10,13 +10,13 @@ commands = pytest --driver Firefox tests/ui/tests/test_discopane.py {posargs}
[testenv:smoke-tests]
basepython = python3.7
recreate = true
passenv = DISPLAY MOZ_HEADLESS PYTEST_ADDOPTS
passenv = PYTEST_ADDOPTS
deps =
pytest-base-url
pytest-selenium
pytest-rerunfailures
commands = pytest --driver Firefox --base-url http://olympia.test --verify-base-url --reruns 1 tests/smoke/test_homepage.py {posargs}
pytest>=5.0.1
pytest-base-url>=1.4.1
requests>=2.22.0
pytest-rerunfailures>=7.0
commands = pytest --base-url http://olympia.test --verify-base-url --reruns 1 tests/smoke/test_homepage.py {posargs}
[testenv:flake8]
deps =