forked from mozilla/kitsune
-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (155 loc) · 7.82 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
name: Playwright Tests
on:
schedule:
# Playwright tests are running automatically in Firefox on each Monday & in Chrome on each Friday.
- cron: '0 5 * * 1,5'
workflow_dispatch:
inputs:
Browsers:
description: Browsers
required: true
default: firefox
type: choice
options:
- firefox
- chrome
TestSuite:
description: Test Suite to run
required: true
default: All
type: choice
options:
- All
- homePageTests
- topNavbarTests
- footerSectionTests
- contributePagesTests
- messagingSystem
- User Pages
- contactSupportPage
- productSolutionsPage
- productTopicsPage
- AAQ
- KB Articles
- KB Restricted Visibility
- KB Article Translation
- recentRevisionsDashboard
- kbDashboard
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: 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=chrome" >> $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" "productTopicsPage" "aaqPage" "postedQuestions" "kbProductsPage" "kbArticleCreationAndAccess" "beforeThreadTests" "articleThreads" "afterThreadTests" "kbArticleShowHistory" "recentRevisionsDashboard" "kbDashboard" "restrictedArticleCreation" "kbRestrictedVisibilitySingleGroup" "whitelistingDifferentGroup" "kbRestrictedVisibilityMultipleGroups" "removingAllArticleRestrictions" "kbRemovedRestrictions" "deleteAllRestrictedTestArticles" "kbArticleTranslation")
if [ "$dispatch_test_suite" == "All" ] || [ "${{ github.event_name}}" == "schedule" ] ; then
for test in "${all_test_suites[@]}"; do
if ! poetry run pytest -m ${test} --numprocesses 2 --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 2 --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 2 --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 2 --browser ${{ env.BROWSER }} --reruns 1; then
any_failures=true
fi
done
elif [ "$dispatch_test_suite" == "KB Restricted Visibility" ]; then
for test in "restrictedArticleCreation" "kbRestrictedVisibilitySingleGroup" "whitelistingDifferentGroup" "kbRestrictedVisibilityMultipleGroups" "removingAllArticleRestrictions" "kbRemovedRestrictions" "deleteAllRestrictedTestArticles"; do
if ! poetry run pytest -m ${test} --numprocesses 2 --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 2 --browser ${{ env.BROWSER }} --reruns 1; then
any_failures=true
fi
else
if ! poetry run pytest -m $dispatch_test_suite --numprocesses 2 --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: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
brew install allure
allure generate --single-file reports/allure_reports
- name: Upload the combined test report as artifact
if: success() || failure()
uses: actions/upload-artifact@v2
with:
name: Playwright test report
path: |
playwright_tests/allure-report
- name: Playwright Test Status
if: env.TESTS_FAILED == 'true'
run: exit 1