refactor: tests arrange and teardown sections #331
This file contains hidden or 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: GraphQL Tests | |
| on: | |
| push: | |
| branches: [ dev ] | |
| pull_request: | |
| branches: [ dev ] | |
| jobs: | |
| graphql-tests: | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| browser: [chromium] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # - name: Create .env file | |
| # shell: bash | |
| # env: | |
| # SECRET_ENV_FILE: ${{ secrets.VC_TESTING_MODULE_ENV_FILE }} | |
| # run: | | |
| # echo "Creating .env file..." | |
| # echo "$SECRET_ENV_FILE" > .env | |
| # chmod 600 .env | |
| # echo "..Done." | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13.7' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest-html | |
| - name: Install Playwright Browsers | |
| run: playwright install --with-deps ${{ matrix.browser }} | |
| - name: Run GraphQL Tests | |
| env: | |
| ADMIN_USERNAME: ${{ secrets.ADMIN_USERNAME }} | |
| ADMIN_PASSWORD: ${{ secrets.ADMIN_PASSWORD }} | |
| STORE_ID: store-acme | |
| USERS_PASSWORD: ${{ secrets.USERS_PASSWORD }} | |
| BACKEND_BASE_URL: https://vcptcore-demo.govirto.com | |
| FRONTEND_BASE_URL: https://vcptcore-demo-storefront.govirto.com | |
| run: | | |
| echo "Running GraphQL tests against ${{ env.FRONTEND_BASE_URL }}" | |
| pytest tests_graphql/tests/ -m "not ignore" --browser ${{ matrix.browser }} --html=graphql-report.html --self-contained-html --tracing=retain-on-failure -v -s | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: graphql-test-results-${{ matrix.browser }} | |
| path: | | |
| graphql-report.html | |
| playwright-report/ | |
| test-results/ | |
| retention-days: 30 |