1+ name : " Copilot: Generate and Run Playwright Tests Until Passing"
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - master
8+
9+ jobs :
10+ generate-and-test :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@main
15+
16+ - name : Setup Python
17+ uses : actions/setup-python@main
18+ with :
19+ python-version : " 3.11"
20+
21+ - name : Install dependencies
22+ run : |
23+ pip install -r requirements.txt
24+ pip install pytest playwright pytest-playwright
25+
26+ - name : Install Playwright browsers
27+ run : |
28+ python -m playwright install
29+
30+ - name : Copilot Generate Playwright Scripts
31+ uses : github/copilot-agent/playwright-generate@main # Example, customize for Python; or use Chat to generate script
32+ with :
33+ github-token : ${{ secrets.GITHUB_TOKEN }}
34+ prompt : " Generate Playwright test scripts covering every user action on this web app."
35+ continue-on-error : true # If your agent doesn't support, replace with python script generation using Copilot Chat
36+
37+ - name : Run Playwright Tests
38+ run : |
39+ pytest tests/ # Or the path to your Playwright scripts
40+
41+ - name : If Tests Fail, Copilot Attempts Fix & Repeats
42+ uses : github/copilot-agent/playwright-fix-and-loop@main # Example, requires agent loop feature
43+ with :
44+ github-token : ${{ secrets.GITHUB_TOKEN }}
45+ max_attempts : 5
46+ continue-on-error : true
47+
48+ - name : Create PR with passing tests or attempted fixes
49+ uses : peter-evans/create-pull-request@main
50+ with :
51+ branch : " copilot/playwright-auto-tests"
52+ title : " Copilot generated Playwright tests (auto-fixed)"
53+ body : " Automated Playwright test generation/fix by Copilot agent."
54+ commit-message : " Copilot agent Playwright tests and fixes"
55+ continue-on-error : true
56+
57+ - name : Auto-merge if passing
58+ uses : pascalgn/automerge-action@main
59+ with :
60+ merge-method : squash
61+ github-token : ${{ secrets.GITHUB_TOKEN }}
62+ continue-on-error : true
0 commit comments