-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
55 lines (46 loc) · 1.33 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
55 lines (46 loc) · 1.33 KB
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
image: mcr.microsoft.com/playwright/python:v1.40.0-jammy
stages:
- test
- report
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Default values, can be overridden when triggering the pipeline
TEST_CASE_PATH: "example/testcase/login_valid.md"
TEMPLATES_PATH: "example/library"
cache:
paths:
- .cache/pip
test_automation:
stage: test
script:
- echo "Installing dependencies..."
- pip install -r requirements.txt
- echo "Running automation test scenarios..."
- mkdir -p reports screenshots
# Run the test case using variables provided during execution or defaults
- echo "Running test case: $TEST_CASE_PATH with templates: $TEMPLATES_PATH"
- python main.py --testcase "$TEST_CASE_PATH" --templates "$TEMPLATES_PATH" --headless
artifacts:
when: always
paths:
- reports/
- screenshots/
- "*.json"
expire_in: 1 week
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
- if: '$CI_COMMIT_BRANCH == "develop"'
- if: '$CI_MERGE_REQUEST_ID'
archive_results:
stage: report
needs:
- test_automation
script:
- tar -czf test-results-${CI_COMMIT_SHORT_SHA}.tar.gz reports/ screenshots/ *.json || true
artifacts:
paths:
- test-results-*.tar.gz
expire_in: 90 days
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: on_success