Skip to content

Commit f2ff3b1

Browse files
committed
Improve Playwright E2E exercises for hands-on approach
- Remove /setupTests and /tests commands from Mode A exercise - Focus on developer-driven setup and structure choices - Add detailed step-by-step Copilot collaboration workflow - Include specific context variables and inline chat examples - Update Mode B to use agent-driven approach without slash commands - Better align exercises with their respective modes
1 parent 06a932a commit f2ff3b1

File tree

2 files changed

+126
-14
lines changed

2 files changed

+126
-14
lines changed

exercises/copilot-advanced-mode-a.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,36 @@ Welcome to the advanced hands-on GitHub Copilot training! This document is desig
44

55
The goal is to use Copilot as your intelligent pair programming partner for complex software engineering tasks, where you drive the architecture and decision-making while leveraging AI assistance for implementation details.
66

7+
> 🏴‍☠️ If ye be into testing, skip to the end for an optional Playwri### If Playwright be new to ye:
8+
9+
**Discovery Phase:**
10+
- Ask Copilot: `What is Playwright and how would it benefit testing this FastAPI + HTML dashboard application?`
11+
- Use `#codebase` context: "Based on this project structure, what would be the most valuable E2E test scenarios?"
12+
13+
**Hands-On Learning:**
14+
1. **Installation:** Choose Python or Node.js and install Playwright yourself
15+
2. **Basic Test Creation:**
16+
- Create your first test file in your chosen location
17+
- **Inline Chat:** "Write a simple Playwright test that opens localhost:8000 and checks the page title"
18+
3. **Dashboard-Specific Tests:**
19+
- Select the dashboard HTML and ask: "Help me write tests for the technology analysis workflow"
20+
- Use `#openSimpleBrowser` to understand the user flow while writing tests
21+
4. **Advanced Scenarios:**
22+
- Add tests for API integration, chart rendering, error states
23+
- **Inline Chat:** "Add screenshot capture and test reporting to this Playwright test"
24+
25+
**Key Test Scenarios to Implement:**
26+
- Dashboard loads successfully
27+
- API calls return data and populate charts
28+
- User interactions (dropdowns, buttons) work correctly
29+
- Error handling displays proper messages
30+
- Data source switching functions properly
31+
32+
**Integration Tips:**
33+
- Run tests with `npx playwright test` (Node.js) or `pytest` (Python)
34+
- Add to CI pipeline by creating your own workflow
35+
- Use Copilot to help generate test reports and debugging utilitiescise!
36+
737
## Essential Advanced Copilot Features
838

939
Master these sophisticated techniques throughout all exercises:
@@ -554,4 +584,38 @@ Choose exercises based on your development interests and skill areas:
554584

555585
---
556586

557-
These exercises are designed to challenge your mastery of advanced Copilot features while building real-world, production-ready software. Focus on understanding each suggestion, validating the generated code, and adapting it to your specific needs. Remember: you are the architect—Copilot is your intelligent implementation partner.
587+
## Optional Exercise: End-to-End Testing with Playwright 🏴‍☠️
588+
589+
Yarr! If ye be a fan of testin’ the whole ship from stem to stern, this be for ye. Playwright lets ye test yer dashboard in real browsers, just like a real user.
590+
591+
### If ye already know Playwright:
592+
593+
**Setup and Structure (You Choose):**
594+
- Create your E2E test directory structure (`tests/e2e/`, `e2e/`, or wherever ye prefer)
595+
- Install Playwright: `pip install playwright` (Python) or `npm install playwright` (Node.js)
596+
- Use `#openSimpleBrowser` to preview the dashboard while developing tests
597+
598+
**Test Development with Copilot:**
599+
- **Step 1:** Create a basic test file and ask Copilot:
600+
```
601+
#file:app/templates/index.html #file:app/main.py
602+
603+
Help me write a Playwright test that loads the dashboard, clicks the analysis button, and verifies a chart appears. Use the existing API endpoints and HTML structure.
604+
```
605+
- **Step 2:** Select your test code and use **Inline Chat:** "Add assertions for chart data and error handling"
606+
- **Step 3:** Expand with more complex user journeys (change data sources, modify parameters, etc.)
607+
608+
### If Playwright be new to ye:
609+
- Ask Copilot: `What is Playwright and how can I use it for E2E testing in this project?`
610+
- Use `/explain` and `/setupTests` to:
611+
1. Learn what Playwright does and why it’s useful
612+
2. Scaffold a basic E2E test (e.g., check dashboard loads, API returns data, chart renders)
613+
3. Get Copilot to write a test that clicks buttons, fills forms, or checks chart output
614+
4. Use `#openSimpleBrowser` to see the app in action
615+
- Try both Python and Node.js Playwright flavors—Copilot can help with either!
616+
617+
**Bonus:**
618+
- Add E2E tests to your CI pipeline for true production-readiness
619+
- Use Copilot to generate test reports and screenshots
620+
621+
*For more, see [Playwright for Python](https://playwright.dev/python/) or [Playwright for JS](https://playwright.dev/)*

exercises/copilot-advanced-mode-b.md

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,33 @@
22

33
Welcome to the agent-driven GitHub Copilot training! This document is designed for developers who want to explore the cutting edge of AI-assisted software development using GitHub Copilot as an autonomous development agent.
44

5-
**⚠️ Important:** This mode requires a fundamentally different mindset. You are not making wishes—you are providing strategic direction, maintaining oversight, and ensuring quality at every step. The agent executes, but you remain the architect and decision-maker.
5+
**⚠️ Important:** This mode requires a fundamentally different mindset. You are not making wishes—you are providing strategic direction, maintaining oversight, and ensuring quality at every step. The agent executes, but you remain the architect and decis### If Playwright be new to ye:
6+
7+
**Agent-Guided Learning and Implementation:**
8+
```
9+
@workspace I'm new to Playwright and want to implement E2E testing for this dashboard. Please:
10+
11+
1. Explain what Playwright is and why it's valuable for this type of application
12+
2. Analyze our current project structure to recommend the best E2E testing approach
13+
3. Guide me through setting up Playwright with our FastAPI + HTML dashboard
14+
4. Create a comprehensive E2E test that validates the full user workflow
15+
5. Include instructions for running tests and integrating with our development process
16+
17+
Consider both Python and Node.js options and recommend the best fit for our stack.
18+
```
19+
20+
**Key Agent-Driven Test Scenarios:**
21+
- Dashboard loads and initializes correctly
22+
- API integration and data flow validation
23+
- User interface interactions (dropdowns, buttons, forms)
24+
- Chart rendering and data visualization validation
25+
- Error handling and edge case coverage
26+
- Cross-browser compatibility testing
27+
28+
**Integration and CI/CD:**
29+
- Use `#openSimpleBrowser` to validate user experience during development
30+
- Have the agent create CI pipeline integration
31+
- Generate test reports and debugging utilities> 🏴‍☠️ If ye be into testing, skip to the end for an optional Playwright E2E exercise!
632

733
## Prerequisites: Setting Up Agent-Driven Development
834

@@ -532,18 +558,40 @@ Validate security implementations with security testing tools.
532558

533559
---
534560

535-
## Critical Success Factors for Agent-Driven Development
561+
## Optional Exercise: End-to-End Testing with Playwright 🏴‍☠️
562+
563+
Yarr! If ye want to test the whole dashboard like a true pirate, Playwright be the tool for E2E adventures.
564+
565+
### If ye already know Playwright:
566+
567+
**Agent-Driven Test Development:**
568+
- Set up your E2E test structure (`tests/e2e/`, `e2e/`, or wherever ye prefer)
569+
- Install Playwright: `pip install playwright` (Python) or `npm install playwright` (Node.js)
570+
- Use `#openSimpleBrowser` to preview the dashboard during development
571+
572+
**Agent Collaboration for E2E Tests:**
573+
```
574+
@workspace I want to create comprehensive E2E tests for this dashboard application using Playwright. Please:
575+
576+
1. Analyze the existing HTML structure and API endpoints
577+
2. Design a test strategy that covers the full user workflow
578+
3. Generate Playwright tests for dashboard loading, user interactions, and chart validation
579+
4. Include proper error handling and edge case testing
580+
581+
Use the existing project structure and maintain consistency with our testing patterns.
582+
```
536583

537-
**Human Responsibilities:**
538-
1. **Strategic Oversight:** Always approve architectural decisions before implementation
539-
2. **Quality Gates:** Validate each phase before proceeding to the next
540-
3. **Risk Management:** Understand the implications of each change
541-
4. **Knowledge Transfer:** Ensure you understand what the agent has implemented
584+
### If Playwright be new to ye:
585+
- Ask Copilot: `What is Playwright and how can I use it for E2E testing in this project?`
586+
- Use `/explain` and `/setupTests` to:
587+
1. Learn what Playwright does and why it’s useful
588+
2. Scaffold a basic E2E test (dashboard loads, API returns data, chart appears)
589+
3. Get Copilot to write a test that clicks, fills, or checks chart output
590+
4. Use `#openSimpleBrowser` to see the app in action
591+
- Try both Python and Node.js Playwright flavors—Copilot can help with either!
542592

543-
**Agent Responsibilities:**
544-
1. **Transparency:** Explain all decisions and implementations clearly
545-
2. **Validation:** Confirm understanding before proceeding with complex changes
546-
3. **Documentation:** Maintain comprehensive documentation of all changes
547-
4. **Testing:** Ensure comprehensive testing at every step
593+
**Bonus:**
594+
- Add E2E tests to your CI pipeline for true production-readiness
595+
- Use Copilot to generate test reports and screenshots
548596

549-
**Remember:** The agent is your implementation partner, not your replacement. You remain accountable for all architectural decisions, code quality, and system behavior. Use this mode to explore the possibilities of AI-assisted development while maintaining professional responsibility for the outcomes.
597+
*For more, see [Playwright for Python](https://playwright.dev/python/) or [Playwright for JS](https://playwright.dev/)*

0 commit comments

Comments
 (0)