-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
59 lines (54 loc) · 1.63 KB
/
.gitlab-ci.yml
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
58
59
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- when: always
stages:
- setup
- test
variables:
VENV_DIR: venv
HEADLESS: "true"
BROWSER_NAME: "firefox"
USERNAME: $USERNAME
PASSWORD: $PASSWORD
pytest_firefox:
image: python:3.10
stage: test
before_script:
- apt-get update && apt-get install -y firefox-esr xvfb
- python -m venv $VENV_DIR
- source $VENV_DIR/bin/activate
- wget "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz"
- tar -xvzf geckodriver-v0.33.0-linux64.tar.gz
- chmod +x geckodriver
- export PATH=`pwd`:${PATH}
- python -m pip install --upgrade pip
- pip install -r requirements.txt
script:
- firefox --version
- exit_code=0
- Xvfb :99 &
- export DISPLAY=:99
- geckodriver --version || (echo "GeckoDriver not found, running tests in headless mode" && export HEADLESS="true")
- | # it's important to use this syntax here, because individual lines don't persist $? from one line to the next
set +e
if [ "$HEADLESS" = "true" ]; then
pytest --headless tests/test_explore_page.py -s -v --junitxml=testresults.xml --report-log test_run.log
exit_code=$?
else
pytest tests/test_explore_page.py -s -v --cache-clear;
exit_code=$?
fi
set -e
- message="Failed job at ${CI_JOB_URL} , issues ${message}"
- echo "${CI_PIPELINE_SOURCE}"
- find latest_logs
- exit $exit_code
artifacts:
when: on_failure
paths:
- latest_logs
- test_run.log
reports:
junit: testresults.xml