forked from mozilla/kitsune
-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (156 loc) · 7.47 KB
/
playwright.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Playwright Tests
on:
schedule:
# Playwright tests are running automatically in Firefox on each Monday & in Chromium on each Friday.
- cron: '0 5 * * 1,5'
workflow_dispatch:
inputs:
Browsers:
description: Browsers
required: true
default: firefox
type: choice
options:
- firefox
- chromium
TestSuite:
description: Test Suite to run
required: true
default: All
type: choice
options:
- All
- homePageTests
- topNavbarTests
- footerSectionTests
- contributePagesTests
- messagingSystem
- User Pages
- contactSupportPage
- productSolutionsPage
- productSupportPage
- productTopicsPage
- AAQ
- KB Articles
- kbRestrictedVisibility
- KB Article Translation
- recentRevisionsDashboard
- kbDashboard
- exploreByTopics
- searchTests
- userGroupsTests
env:
TEST_ACCOUNT_12: ${{secrets.AUTOMATION_TEST_ACCOUNT_12}}
TEST_ACCOUNT_13: ${{secrets.AUTOMATION_TEST_ACCOUNT_13}}
TEST_ACCOUNT_MESSAGE_1: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_1}}
TEST_ACCOUNT_MESSAGE_2: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_2}}
TEST_ACCOUNT_MESSAGE_3: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_3}}
TEST_ACCOUNT_MESSAGE_4: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_4}}
TEST_ACCOUNT_MESSAGE_5: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_5}}
TEST_ACCOUNT_MESSAGE_6: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_6}}
TEST_ACCOUNT_SPECIAL_CHARS: ${{secrets.AUTOMATION_TEST_ACCOUNT_SPECIAL_CHARS}}
TEST_ACCOUNTS_PS: ${{secrets.AUTOMATION_ACCOUNTS_PASSWORD}}
TEST_ACCOUNT_MODERATOR: ${{secrets.AUTOMATION_MODERATOR_ACCOUNT}}
BROWSER: ${{secrets.BROWSER}}
DATABASE_URL: postgres://kitsune:kitsune@postgres:5432/kitsune
SECRET_KEY: secret
REDIS_DEFAULT_URL=: edis://redis:6379/1
REDIS_HELPFULVOTES_URL: redis://redis:6379/2
jobs:
playwright_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
if: success() || failure()
run: |
sudo apt-get update
pip3 install --user poetry
poetry install
- name: Download NLTK Data
run: |
poetry run python -m nltk.downloader wordnet omw-1.4
- name: Ensure Playwright browsers are installed
run: |
pip3 install playwright
python -m playwright install
- name: Set up browsers env
if: "github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'"
run: |
if [ "${{ github.event_name }}" == 'schedule' ]; then
current_day=$(date +\%u)
if [ $current_day -eq 1 ]; then
echo "BROWSER=firefox" >> $GITHUB_ENV
elif [ $current_day -eq 5 ]; then
echo "BROWSER=chromium" >> $GITHUB_ENV
fi
elif [ "${{ github.event_name }}" == 'workflow_dispatch' ]; then
echo "BROWSER=${{inputs.Browsers}}" >> $GITHUB_ENV
fi
- name: Creating User Sessions for ${{ env.BROWSER }}
id: create-sessions
working-directory: playwright_tests
run: |
poetry run pytest -m loginSessions --browser ${{ env.BROWSER }} --reruns 1
- name: Run ${{inputs.TestSuite}} Playwright Tests
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
declare dispatch_test_suite="${{inputs.TestSuite}}"
declare all_test_suites=("homePageTests" "topNavbarTests" "footerSectionTests" "contributePagesTests" "messagingSystem" "messagingSystemCleanup" "userContributionTests" "userProfile" "userSettings" "editUserProfileTests" "userQuestions" "contactSupportPage" "productSolutionsPage" "productSupportPage" "productTopicsPage" "aaqPage" "postedQuestions" "kbProductsPage" "kbArticleCreationAndAccess" "beforeThreadTests" "articleThreads" "afterThreadTests" "kbArticleShowHistory" "recentRevisionsDashboard" "kbDashboard" "kbRestrictedVisibility" "kbArticleTranslation" "exploreByTopics" "searchTests" "userGroupsTests")
if [ "$dispatch_test_suite" == "All" ] || [ "${{ github.event_name}}" == "schedule" ] ; then
for test in "${all_test_suites[@]}"; do
if ! poetry run pytest -m ${test} --numprocesses 4 --browser ${{ env.BROWSER }} --reruns 1; then
any_failures=true
fi
done
elif [ "$dispatch_test_suite" == "User Pages" ]; then
for test in "userContributionTests" "userProfile" "userSettings" "editUserProfileTests" "userQuestions"; do
if ! poetry run pytest -m ${test} --numprocesses 4 --browser ${{ env.BROWSER }} --reruns 1; then
any_failures=true
fi
done
elif [ "$dispatch_test_suite" == "AAQ" ]; then
for test in "aaqPage" "postedQuestions"; do
if ! poetry run pytest -m ${test} --numprocesses 4 --browser ${{ env.BROWSER }} --reruns 1; then
any_failures=true
fi
done
elif [ "$dispatch_test_suite" == "KB Articles" ]; then
for test in "kbProductsPage" "kbArticleCreationAndAccess" "beforeThreadTests" "articleThreads" "afterThreadTests" "kbArticleShowHistory"; do
if ! poetry run pytest -m ${test} --numprocesses 4 --browser ${{ env.BROWSER }} --reruns 1; then
any_failures=true
fi
done
elif [ "$dispatch_test_suite" == "KB Article Translation" ]; then
if ! poetry run pytest -m kbArticleTranslation --numprocesses 4 --browser ${{ env.BROWSER }} --reruns 1; then
any_failures=true
fi
else
if ! poetry run pytest -m $dispatch_test_suite --numprocesses 4 --browser ${{ env.BROWSER }} --reruns 1; then
any_failures=true
fi
fi
echo "TESTS_FAILED=$any_failures" >> $GITHUB_ENV
- name: Generating Allure Report
working-directory: playwright_tests
if: success() || failure()
run: |
curl -o allure-2.32.0.tgz -L https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.32.0/allure-commandline-2.32.0.tgz
tar -zxvf allure-2.32.0.tgz
export PATH=$PATH:$PWD/allure-2.32.0/bin
allure generate --single-file reports/allure_reports
- name: Upload the combined test report as artifact
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: Playwright test report
path: |
playwright_tests/allure-report
- name: Playwright Test Status
if: env.TESTS_FAILED == 'true'
run: exit 1