Merge branch 'filter-car-table' #329
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
# This YAML file defines a GitHub Actions workflow for running automated content tests on the index page of a project. | |
# The workflow is triggered on push events to the 'main', 'gh-pages', 'validation-testing', 'live', and 'validation-and-automation-testing' branches. | |
# The workflow runs on the latest version of Ubuntu. | |
# The 'test' job is defined, which consists of several steps: | |
# 1. Checkout code: This step checks out the code from the repository using the 'actions/checkout' action. | |
# 2. Set up Python: This step sets up the Python environment using the 'actions/setup-python' action. | |
# 3. Install dependencies: This step installs the required Python packages using the 'pip' command. | |
# 4. Run tests with pytest-playwright: This step runs the content tests using the 'pytest-playwright' framework and generates a JSON report. | |
# 5. Upload test results: This step uploads the generated test results JSON file as an artifact. | |
# 6. Check test results: This step checks if any tests failed by parsing the test results JSON file. | |
# The workflow is designed to continue running even if there are test failures, as specified by the 'continue-on-error' flag in the 'Run tests with pytest-playwright' step. | |
# The test results are stored in the 'test-results.json' file and can be accessed as an artifact. | |
# Note: This is just a documentation comment and does not execute any code. | |
name: Index Page Automated Content Tests | |
on: | |
push: | |
branches: | |
- main | |
- live | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.12.5" | |
- name: Install dependencies | |
run: | | |
pip install pytest-playwright | |
pip install playwright | |
pip install pytest-json-report | |
playwright install | |
- name: Run tests with pytest-playwright | |
run: | | |
pytest tests/test*.py --json-report --json-report-file=test-results.json | |
continue-on-error: true | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: test-results.json | |
- name: Check if any tests ran | |
run: | | |
if grep -q '"total": 0,' test-results.json; then | |
echo "No tests were run" | |
exit 1 | |
fi | |
- name: Check test results | |
run: | | |
if grep -q '"failed":' test-results.json; then | |
echo "Tests failed" | |
exit 1 | |
else | |
echo "Tests passed" | |
fi |