Update smoke tests to use requests instead of seleium. (#8416)
* Removed selenium, now using requests.
This commit is contained in:
Родитель
26005ae51e
Коммит
1aea165122
|
@ -62,8 +62,6 @@ jobs:
|
||||||
cat /etc/hosts
|
cat /etc/hosts
|
||||||
- run:
|
- run:
|
||||||
name: Test Image
|
name: Test Image
|
||||||
environment:
|
|
||||||
MOZ_HEADLESS: 1
|
|
||||||
command: |
|
command: |
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
sudo sysctl -w vm.max_map_count=262144
|
||||||
./tests/smoke/setup_docker.sh
|
./tests/smoke/setup_docker.sh
|
||||||
|
@ -122,8 +120,6 @@ jobs:
|
||||||
cat /etc/hosts
|
cat /etc/hosts
|
||||||
- run:
|
- run:
|
||||||
name: Test Image
|
name: Test Image
|
||||||
environment:
|
|
||||||
MOZ_HEADLESS: 1
|
|
||||||
command: |
|
command: |
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
sudo sysctl -w vm.max_map_count=262144
|
||||||
./tests/smoke/setup_docker.sh
|
./tests/smoke/setup_docker.sh
|
||||||
|
|
|
@ -4,7 +4,7 @@ A simple smoke test suite for the addons-frontend docker image.
|
||||||
|
|
||||||
### Prerequisites
|
### 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`.
|
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."""
|
"""Smoke tests for addons-frontend docker image."""
|
||||||
|
|
||||||
import pytest
|
import requests
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
def test_hidden_comment_is_found(base_url):
|
||||||
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):
|
|
||||||
"""Test hidden element is found."""
|
"""Test hidden element is found."""
|
||||||
selenium.get(base_url)
|
r = requests.get(base_url)
|
||||||
assert "<!-- Godzilla of browsers -->" in selenium.page_source
|
assert "<!-- Godzilla of browsers -->" in r.text
|
||||||
|
|
|
@ -5,5 +5,6 @@ version: "2.3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
addons-frontend:
|
addons-frontend:
|
||||||
image: addons-frontend:latest
|
image: addons-frontend
|
||||||
|
build: ../.
|
||||||
# This should build a local image if it isn't built already.
|
# This should build a local image if it isn't built already.
|
||||||
|
|
12
tox.ini
12
tox.ini
|
@ -10,13 +10,13 @@ commands = pytest --driver Firefox tests/ui/tests/test_discopane.py {posargs}
|
||||||
|
|
||||||
[testenv:smoke-tests]
|
[testenv:smoke-tests]
|
||||||
basepython = python3.7
|
basepython = python3.7
|
||||||
recreate = true
|
passenv = PYTEST_ADDOPTS
|
||||||
passenv = DISPLAY MOZ_HEADLESS PYTEST_ADDOPTS
|
|
||||||
deps =
|
deps =
|
||||||
pytest-base-url
|
pytest>=5.0.1
|
||||||
pytest-selenium
|
pytest-base-url>=1.4.1
|
||||||
pytest-rerunfailures
|
requests>=2.22.0
|
||||||
commands = pytest --driver Firefox --base-url http://olympia.test --verify-base-url --reruns 1 tests/smoke/test_homepage.py {posargs}
|
pytest-rerunfailures>=7.0
|
||||||
|
commands = pytest --base-url http://olympia.test --verify-base-url --reruns 1 tests/smoke/test_homepage.py {posargs}
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:flake8]
|
||||||
deps =
|
deps =
|
||||||
|
|
Загрузка…
Ссылка в новой задаче