Playwright Tests #78
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright Tests | |
on: | |
schedule: | |
# Firefox tests running on Monday, Wednesday and Friday. Chrome runs Tuesday and Thursday. | |
- cron: '0 5 * * 1,2,3,4,5' | |
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}} | |
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_run'" | |
run: | | |
current_day=$(date +\%u) | |
if [ $current_day -eq 1 ] || [ $current_day -eq 3 ] || [ $current_day -eq 5 ]; then | |
echo "BROWSER=firefox" >> $GITHUB_ENV | |
elif [ $current_day -eq 2 ] || [ $current_day -eq 4 ]; then | |
echo "BROWSER=chrome" >> $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 Homepage tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m homePageTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run Top-Navbar tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m topNavbarTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run Footer tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m footerSectionTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run Contribute Pages tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m contributePagesTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run Messaging System Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m messagingSystem --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run User Contribution Page Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m userContributionTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run User Page Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m userProfile --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run User Settings Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m userSettings --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run User Profile Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m editUserProfileTests --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run User Questions Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m userQuestions --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run Contact Support Page Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m contactSupportPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run Product Solutions Page Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m productSolutionsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run Product Topics Page Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m productTopicsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run AAQ Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m aaqPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run AAQ Questions Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m postedQuestions --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name : Run KB Products Page Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m kbProductsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run KB Article Creation And Access Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m kbArticleCreationAndAccess --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run before kb thread tests setup (${{ env.BROWSER }}) | |
id: kb-threads-setup | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m beforeThreadTests --numprocesses 1 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run KB article threads Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' && steps.kb-threads-setup.outcome == 'success' | |
run: | | |
poetry run pytest -m articleThreads --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run KB article threads tear down (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' && steps.kb-threads-setup.outcome == 'success' | |
run: | | |
poetry run pytest -m afterThreadTests --numprocesses 1 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run KB article show history Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m kbArticleShowHistory --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run KB article revisions dashboard Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m recentRevisionsDashboard --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- name: Run KB Dashboard Tests (${{ env.BROWSER }}) | |
working-directory: playwright_tests | |
if: success() || failure() && steps.create-sessions.outcome == 'success' | |
run: | | |
poetry run pytest -m kbDashboard --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 | |
- 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 |