🎭 剧作家 + GitHub Copilot 框架
使用GitHub Copilot生成自然语言测试的自动化测试框架。
先决条件
- Node.js 16及以上版本
- VS Code Insiders(开发者预览版) (文件等)附有扩展内容/附件 GitHub Copilot (需订阅)
- 下载地址:https://code.visualstudio.com/insiders/
安装
# Clonar el repositorio
git clone https://github.com/TheGatogol/mcp-test-automation.git
cd mcp-test-automation
# Instalar todo automáticamente (dependencias + navegadores)
npm run setup使用Copilot创建测试
- 创建一个空文件
tests/practicaTestQAcademy.spec.js
- 将这段文字复制并粘贴到文件中:
Crea un archivo de Playwright llamado practicaTestQAcademy.spec.js que haga los siguientes pasos:
1. Importar test y expect de @playwright/test
2. Crear un test llamado "Login en TestQAcademy"
3. Navegar a https://practica.testqacademy.com/
4. Escribir "admin" en el campo con id qa-username-input
5. Escribir "123456" en el campo con id qa-password-input
6. Hacer click en el botón con id qa-login-button
7. Verificar que el login fue exitoso
Al terminar de generar el archivo:
Ejecuta el test que acabas de generar.- 选择全部文本 并按下
Ctrl+I以开启内联Copilot Chat
- Copilot 将生成测试代码
- 接受代码并授予写入权限 并删除指令文本
- 手动执行测试:
npx playwright test practicaTestQAcademy.spec.js --headed执行测试
# Ejecutar todos los tests
npx playwright test
# Ejecutar un test específico
npx playwright test nombre.spec.ts
# Ver tests ejecutándose en navegador
npx playwright test --headed
# Modo debug paso a paso
npx playwright test --debug
# Abrir reporte HTML
npx playwright show-report
# Generar selectores (abre navegador interactivo)
npx playwright codegen https://practica.testqacademy.com/结构
├── tests/ # Tus tests van aquí
├── test-results/ # Videos y traces (se genera automáticamente)
├── playwright-report/ # Reportes HTML (se genera automáticamente)
├── playwright.config.js # Configuración
└── package.json调试
如果测试失败:
- 查看视频 在
test-results/ - 打开轨迹:
npx playwright show-trace test-results/[carpeta]/trace.zipCopilot使用技巧
- 在评论中要具体明确
- 使用元素的确切ID(qa-username-input,qa-password-input,等)
- 列出测试的步骤
- 包括最后的验证
______________________________________________________________________
开发者
何塞·罗德里戈·埃斯库蒂亚·里奥斯\ 📧 rodrigoingsis@gmail.com(电子邮箱地址,可直接翻译为“电子邮箱:rodrigoingsis@gmail.com”,但为保持原格式,此处仅做符号说明)
______________________________________________________________________
有问题吗?检查一下:
- GitHub Copilot已在VS Code Insiders中启用
- 选择器与实际页面相匹配
- 页面加载正常
