Files
TOJE2E/README.md
ChenKaiLiuG e139daa410 Initialize
2026-01-29 11:48:45 +08:00

124 lines
2.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TOJE2E - NTOJ E2E 測試專案
這是針對 NTOJ (New TOJ) 的端對端測試專案,使用 Playwright 框架。
## 專案連結
TOJ github repo: https://github.com/TFcis/NTOJ
TOJ website: https://toj.tfcis.org/oj/
TOJ spec:
- https://tobiichi3227.eu.org:312/NTOJ/system/
- https://tobiichi3227.eu.org:312/NTOJ/std/
- https://tobiichi3227.eu.org:312/NTOJ/std-manage/
- https://tobiichi3227.eu.org:312/NTOJ/contest/
- https://tobiichi3227.eu.org:312/NTOJ/contest-manage/
## 專案結構
```
TOJE2E/
├── tests/ # 測試文件
├── pages/ # Page Object Models
├── utils/ # 工具函數和測試資料
├── playwright.config.ts # Playwright 配置
└── package.json # 依賴和腳本
```
## 安裝
```bash
npm install
npx playwright install --with-deps
```
## 運行測試
### 無頭模式Headless
適合在沒有圖形介面或背景運行時使用:
```bash
npm test
# 或
npm run test:headless
```
### 非無頭模式Headed - 有視窗)
適合在本地開發時使用,可以看到瀏覽器執行過程:
```bash
npm run test:headed
```
### UI 模式(互動式)
Playwright 的圖形化測試介面,可以逐步執行、除錯:
```bash
npm run test:ui
```
### 除錯模式
單步執行測試,適合開發和除錯:
```bash
npm run test:debug
```
### 查看測試報告
測試完成後查看 HTML 報告:
```bash
npm run test:report
```
### 錄製測試Codegen
自動生成測試程式碼:
```bash
npm run test:codegen
```
## 測試配置
測試目標https://tobiichi3227.eu.org:312
測試帳號配置在 `.env` 檔案中:
- TEST_EMAIL=fsdoiujfs@example.org
- TEST_PASSWORD=Fsdoiujfs
## 常用場景
### 1. 本地開發時執行並觀看
```bash
npm run test:headed
```
### 2. 快速執行所有測試
```bash
npm test
```
### 3. 執行特定測試檔案
```bash
npx playwright test tests/01-basic.spec.ts
```
### 4. 執行特定測試(帶視窗)
```bash
npx playwright test tests/01-basic.spec.ts --headed
```
## 測試狀態
✅ Playwright 環境設置完成
✅ 基本測試框架建立
⚠️ 待開發:登入測試、題目測試、提交測試
## 下一步
1. 創建登入測試
2. 創建 Page Object Models
3. 測試題目瀏覽功能
4. 測試程式碼提交功能
5. 測試比賽相關功能