This commit is contained in:
Benjamin Forehand Jr 2018-05-24 14:55:41 -04:00
Родитель 684ccfa0da
Коммит 5ec794da09
6 изменённых файлов: 60 добавлений и 58 удалений

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

@ -57,4 +57,4 @@ RUN pipenv install --python=$(which python3.6)
ENTRYPOINT [ "pipenv", "run" ]
CMD ["pytest", "--driver", "Firefox", "--verify-server-url", "--variables", "variables.json", "--html", "report.html"]
CMD ["pytest"]

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

@ -11,7 +11,7 @@ clean: ## Delete pyc files
build: ## Build Docker image
@docker build -t "${DOCKER_TAG}" .
.PHONY: docker-tests
.PHONY: docker-ui-tests
docker-ui-tests: clean build ## Run tests in container
@docker run \
--net="host" \
@ -21,13 +21,13 @@ docker-ui-tests: clean build ## Run tests in container
.PHONY: ui-tests
ui-tests: ## Run tests outside of container
@pipenv run pytest --driver=Firefox --server-url=http://localhost:5000 --verify-server-url --variables=variables.json --html=report.html
@pipenv run pytest
.PHONY: setup-redash
setup-redash: ## Setup redash instance
@docker-compose run --rm server create_db
@docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests"
@wget -q ${REDASH_SERVER_URL}setup --post-data="name=Ashley McTest&email=ashley@example.com&password=REPLACE ME&org_name=default" -O /dev/null
@wget -q "${REDASH_SERVER_URL}setup" --post-data="name=Ashley McTest&email=ashley@example.com&password=REPLACE ME&org_name=default" -O /dev/null
.PHONY: bash
bash: ## Run bash in container as user

91
Pipfile.lock сгенерированный
Просмотреть файл

@ -1,20 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "965c019e00fe38782f6b122d2615c37c079098f1084feaab10a760063b171b3f"
},
"host-environment-markers": {
"implementation_name": "cpython",
"implementation_version": "3.6.1",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_python_implementation": "CPython",
"platform_release": "17.5.0",
"platform_system": "Darwin",
"platform_version": "Darwin Kernel Version 17.5.0: Fri Apr 13 19:32:32 PDT 2018; root:xnu-4570.51.2~1/RELEASE_X86_64",
"python_full_version": "3.6.1",
"python_version": "3.6",
"sys_platform": "darwin"
"sha256": "d6131fc6bb32a8212eeebf2348c457d8e2b3ee816f4efb0603666c850ffd8da6"
},
"pipfile-spec": 6,
"requires": {
@ -29,6 +16,13 @@
]
},
"default": {
"atomicwrites": {
"hashes": [
"sha256:240831ea22da9ab882b551b31d4225591e5e447a68c5e188db5b89ca1d487585",
"sha256:a24da68318b08ac9c9c45029f4a10371ab5b20e4226738e150e6e7c571630ae6"
],
"version": "==1.1.5"
},
"attrs": {
"hashes": [
"sha256:4b90b09eeeb9b88c35bc642cbac057e45a5fd85367b985bd2809c62b7b939265",
@ -38,45 +32,45 @@
},
"certifi": {
"hashes": [
"sha256:9fa520c1bacfb634fa7af20a76bcbd3d5fb390481724c597da32c719a7dca4b0",
"sha256:13e698f54293db9f89122b0581843a782ad0934a4fe0172d2a980ba77fc61bb7"
"sha256:13e698f54293db9f89122b0581843a782ad0934a4fe0172d2a980ba77fc61bb7",
"sha256:9fa520c1bacfb634fa7af20a76bcbd3d5fb390481724c597da32c719a7dca4b0"
],
"version": "==2018.4.16"
},
"chardet": {
"hashes": [
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691",
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
],
"version": "==3.0.4"
},
"idna": {
"hashes": [
"sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4",
"sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f"
"sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f",
"sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4"
],
"version": "==2.6"
},
"more-itertools": {
"hashes": [
"sha256:11a625025954c20145b37ff6309cd54e39ca94f72f6bb9576d1195db6fa2442e",
"sha256:0dd8f72eeab0d2c3bd489025bb2f6a1b8342f9b198f6fc37b52d15cfa4531fea",
"sha256:c9ce7eccdcb901a2c75d326ea134e0886abfbea5f93e91cc95de9507c0816c44"
"sha256:2b6b9893337bfd9166bee6a62c2b0c9fe7735dcf85948b387ec8cba30e85d8e8",
"sha256:6703844a52d3588f951883005efcf555e49566a48afd4db4e965d69b883980d3",
"sha256:a18d870ef2ffca2b8463c0070ad17b5978056f403fb64e3f15fe62a52db21cc0"
],
"version": "==4.1.0"
"version": "==4.2.0"
},
"pluggy": {
"hashes": [
"sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff",
"sha256:d345c8fe681115900d6da8d048ba67c25df42973bda370783cd58826442dcd7c",
"sha256:e160a7fcf25762bb60efc7e171d4497ff1d8d2d75a3d0df7a21b76821ecbf5c5",
"sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff"
"sha256:e160a7fcf25762bb60efc7e171d4497ff1d8d2d75a3d0df7a21b76821ecbf5c5"
],
"version": "==0.6.0"
},
"py": {
"hashes": [
"sha256:983f77f3331356039fdd792e9220b7b8ee1aa6bd2b25f567a963ff1de5a64f6a",
"sha256:29c9fab495d7528e80ba1e343b958684f4ace687327e6f789a94bf3d1915f881"
"sha256:29c9fab495d7528e80ba1e343b958684f4ace687327e6f789a94bf3d1915f881",
"sha256:983f77f3331356039fdd792e9220b7b8ee1aa6bd2b25f567a963ff1de5a64f6a"
],
"version": "==1.5.3"
},
@ -85,14 +79,16 @@
"sha256:ea1d3b0297fdeccc47d034a005e6cd16e206ad32258aeffbca47f0c516a63082",
"sha256:ece35948abcb65f4dc230bd7464323bc83e7c02d35aaaeea53fd728effc0df14"
],
"index": "pypi",
"version": "==2.0.0"
},
"pytest": {
"hashes": [
"sha256:829230122facf05a5f81a6d4dfe6454a04978ea3746853b2b84567ecf8e5c526",
"sha256:54713b26c97538db6ff0703a12b19aeaeb60b5e599de542e7fca0ec83b9038e8"
"sha256:39555d023af3200d004d09e51b4dd9fdd828baa863cded3fd6ba2f29f757ae2d",
"sha256:c76e93f3145a44812955e8d46cdd302d8a45fbfc7bf22be24fe231f9d8d8853a"
],
"version": "==3.5.1"
"index": "pypi",
"version": "==3.6.0"
},
"pytest-base-url": {
"hashes": [
@ -103,15 +99,16 @@
},
"pytest-html": {
"hashes": [
"sha256:23bf611f3048decc1cf5281238574155d07190e0d1370f91318eec6b8031a6c1",
"sha256:bbb6cb7936bc4944cd8122f72e9981157149714648d3596ec1ff2b2ed9baeac1"
"sha256:3171027ee492382904c1f143889b699751c54d4e1ada836aa394a68c3c707c0b",
"sha256:47cc6edca06e4a036045bcc16ace13f470846a9ef1103ba2c851780ed44e3f4b"
],
"version": "==1.17.0"
"index": "pypi",
"version": "==1.18.0"
},
"pytest-metadata": {
"hashes": [
"sha256:ec37c48f44e7973cc6d06b36a148d3a3432e5dda8b8a40239fb52099b202907f",
"sha256:2d495b61542cb25dfc52fbf40c7a02220c7c127b7ba8974e6c72d6c9593c547a"
"sha256:2d495b61542cb25dfc52fbf40c7a02220c7c127b7ba8974e6c72d6c9593c547a",
"sha256:ec37c48f44e7973cc6d06b36a148d3a3432e5dda8b8a40239fb52099b202907f"
],
"version": "==1.7.0"
},
@ -120,6 +117,7 @@
"sha256:050a357a8bc9d38241052a277a5da3d67ff4801a807e8918113a88defee11c97",
"sha256:b3c36a212d0b5a3ba61fccbf9f754aa2286840dc2ae910a04b67c72685a1bca7"
],
"index": "pypi",
"version": "==1.12.0"
},
"pytest-variables": {
@ -127,6 +125,7 @@
"sha256:59c00b95779657532ac5f8209b28b5d447c8b4bc4210c1d6bdf9a42aa201f9b0",
"sha256:7808b77b643b9f8a24f1ee1c32132648b1c62ab93956f20fe101dde66db6d09a"
],
"index": "pypi",
"version": "==1.7.1"
},
"requests": {
@ -145,8 +144,8 @@
},
"six": {
"hashes": [
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb",
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9"
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
],
"version": "==1.11.0"
},
@ -159,8 +158,8 @@
},
"zope.component": {
"hashes": [
"sha256:2776ab93945c8df3781fdcc2126dc7080e9a1d64fef5f76a21550473cbb505bf",
"sha256:1b29aa65413f6dda29e64e2352a6aa13d9ba70078f6b91f328573488788d531c"
"sha256:1b29aa65413f6dda29e64e2352a6aa13d9ba70078f6b91f328573488788d531c",
"sha256:2776ab93945c8df3781fdcc2126dc7080e9a1d64fef5f76a21550473cbb505bf"
],
"version": "==4.4.1"
},
@ -173,15 +172,15 @@
},
"zope.interface": {
"hashes": [
"sha256:467d364b24cb398f76ad5e90398d71b9325eb4232be9e8a50d6a3b3c7a1c8789",
"sha256:3d184aff0756c44fff7de69eb4cd5b5311b6f452d4de28cb08343b3f21993763",
"sha256:21506674d30c009271fe68a242d330c83b1b9d76d62d03d87e1e9528c61beea6",
"sha256:f41037260deaacb875db250021fe883bf536bf6414a4fd25b25059b02e31b120",
"sha256:3d184aff0756c44fff7de69eb4cd5b5311b6f452d4de28cb08343b3f21993763",
"sha256:467d364b24cb398f76ad5e90398d71b9325eb4232be9e8a50d6a3b3c7a1c8789",
"sha256:57c38470d9f57e37afb460c399eb254e7193ac7fb8042bd09bdc001981a9c74c",
"sha256:9ada83f4384bbb12dedc152bcdd46a3ac9f5f7720d43ac3ce3e8e8b91d733c10",
"sha256:e881ef610ff48aece2f4ee2af03d2db1a146dc7c705561bd6089b2356f61641f",
"sha256:e6b77ae84f2b8502d99a7855fa33334a1eb6159de45626905cb3e454c023f339",
"sha256:a1daf9c5120f3cc6f2b5fef8e1d2a3fb7bbbb20ed4bfdc25bc8364bc62dcf54b",
"sha256:57c38470d9f57e37afb460c399eb254e7193ac7fb8042bd09bdc001981a9c74c"
"sha256:e6b77ae84f2b8502d99a7855fa33334a1eb6159de45626905cb3e454c023f339",
"sha256:e881ef610ff48aece2f4ee2af03d2db1a146dc7c705561bd6089b2356f61641f",
"sha256:f41037260deaacb875db250021fe883bf536bf6414a4fd25b25059b02e31b120"
],
"version": "==4.5.0"
}

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

@ -4,7 +4,7 @@ set -e
case "$1" in
ui_test)
exec pipenv run pytest --driver=Firefox --base-url=http://redash:5000 --verify-base-url --variables=variables.json --html=report.html
exec pipenv run pytest
;;
*)
exec "$@"

2
pytest.ini Normal file
Просмотреть файл

@ -0,0 +1,2 @@
[pytest]
addopts = --driver=Firefox --server-url=http://localhost:5000 --verify-server-url --variables=variables.json --self-contained-html --html=report.html

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

@ -36,6 +36,12 @@ def _verify_url(request, server_url, user, org):
session.get(server_url, verify=False)
@pytest.fixture(name='server_url')
def fixture_server_url(request):
"""Return the URL to the Redash server."""
return request.config.option.server_url
@pytest.fixture(name='org', scope='session')
def fixture_org():
"""Return the slug of an org."""
@ -61,12 +67,6 @@ def fixture_login_page(selenium, server_url, org):
return login_page.open()
@pytest.fixture(name='server_url')
def fixture_server_url(request):
"""Return the URL to the Redash server."""
return request.config.option.server_url
def pytest_addoption(parser):
"""Add custom options to pytest."""
group = parser.getgroup('redash')
@ -83,4 +83,5 @@ def pytest_addoption(parser):
'--verify-server-url',
action='store_true',
default=not os.getenv('VERIFY_SERVER_URL', 'false').lower() == 'false',
help='verify the server url.')
help='verify the server url.',
)