fix: correct Playwright interaction selectors and deployment branch m… #2
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: E2E Tests & Auto-Deploy | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| permissions: | |
| contents: write | |
| jobs: | |
| test-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install Dependencies | |
| run: npm install | |
| - name: Install Playwright Browsers | |
| run: npx playwright install --with-deps chromium | |
| - name: Run E2E Playwright Tests | |
| run: npx playwright test | |
| - name: Conditional Auto-Deploy to Main | |
| if: | | |
| github.event_name == 'push' && | |
| github.ref != 'refs/heads/main' && | |
| contains(github.event.head_commit.message, 'MAIN') | |
| run: | | |
| echo "Trigger keyword 'MAIN' detected and tests passed. Executing automatic deployment to main." | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout -B main origin/main | |
| git merge origin/${{ github.ref_name }} --no-edit | |
| git push origin main |