forked from mozilla/bedrock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-integration-tests.sh
executable file
·57 lines (49 loc) · 2.22 KB
/
run-integration-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
set -xe
# Defaults
: ${PYTEST_PROCESSES:="1"}
: ${BASE_URL:="https://www-dev.allizom.org"}
: ${SELENIUM_HOST:="localhost"}
: ${SELENIUM_PORT:="4444"}
: ${BROWSER_NAME:="firefox"}
: ${TESTS_PATH:="tests"}
: ${RESULTS_PATH:="${TESTS_PATH}/results"}
# Common arguments
if [ "${DRIVER}" = "SauceLabs" ]; then
# Temporarily exclude logs for Saucelabs jobs https://github.com/pytest-dev/pytest-selenium/issues/288
CMD="SAUCELABS_W3C=true SELENIUM_EXCLUDE_DEBUG=logs py.test"
else
CMD="py.test"
fi
CMD="${CMD} -r a"
CMD="${CMD} --verbose"
CMD="${CMD} --workers ${PYTEST_PROCESSES}"
CMD="${CMD} --base-url ${BASE_URL}"
CMD="${CMD} --reruns 2"
CMD="${CMD} --html ${RESULTS_PATH}/index.html"
CMD="${CMD} --junitxml ${RESULTS_PATH}/junit.xml"
if [ -n "${DRIVER}" ]; then CMD="${CMD} --driver ${DRIVER}"; fi
# Remote arguments
if [ "${DRIVER}" = "Remote" ]; then
CMD="${CMD} --selenium-host ${SELENIUM_HOST}"
CMD="${CMD} --selenium-port ${SELENIUM_PORT}"
CMD="${CMD} --capability browserName \"${BROWSER_NAME}\""
if [ -n "${BROWSER_VERSION}" ]; then CMD="${CMD} --capability browserVersion \"${BROWSER_VERSION}\""; fi
if [ -n "${PLATFORM}" ]; then CMD="${CMD} --capability platformName \"${PLATFORM}\""; fi
fi
# Sauce Labs arguments
if [ "${DRIVER}" = "SauceLabs" ]; then
CMD="${CMD} --capability browserName \"${BROWSER_NAME}\""
if [ -n "${BROWSER_VERSION}" ]; then CMD="${CMD} --capability browserVersion \"${BROWSER_VERSION}\""; fi
if [ -n "${PLATFORM}" ]; then CMD="${CMD} --capability platformName \"${PLATFORM}\""; fi
if [ -n "${SELENIUM_VERSION}" ]; then CMD="${CMD} --capability selenium-version \"${SELENIUM_VERSION}\""; fi
if [ -n "${BUILD_TAG}" ]; then CMD="${CMD} --capability build \"${BUILD_TAG}\""; fi
if [ -n "${SCREEN_RESOLUTION}" ]; then CMD="${CMD} --capability screenResolution \"${SCREEN_RESOLUTION}\""; fi
if [ -n "${PRIVACY}" ]; then CMD="${CMD} --capability public \"${PRIVACY}\""; fi
fi
if [ -n "${MARK_EXPRESSION}" ]; then CMD="${CMD} -m \"${MARK_EXPRESSION}\""; fi
CMD="${CMD} ${TESTS_PATH}"
eval ${CMD}