Skip to content

Instantly share code, notes, and snippets.

View minhphong306's full-sized avatar
😄
Don't watch the clock. Do what it does! Keep going!

Phong Do minhphong306

😄
Don't watch the clock. Do what it does! Keep going!
View GitHub Profile

Functional Test Case

TC ID Title Steps Expected Result
FUNC_001 Login successfully Enter valid account → Click Login User login successfully

UI Test Case

Tóm tắt

  1. Có cần gen 2 bộ test case không? (1 cho manual + 1 cho AI chạy Playwright) → Không. Dùng 1 bộ test case viết theo format có cấu trúc, dùng chung cho cả manual lẫn làm input để AI sinh script Playwright. Chỉ cần bổ sung thông tin selector cho phần auto, không phải viết lại 2 bộ khác nhau.

  2. Bạn cần làm gì ở bước "cho AI dùng MCP Playwright chạy test"? → Đích đến nên là: dùng MCP Playwright cho AI khám phá trang + sinh ra file code .spec.ts, rồi tự chạy lại bằng npx playwright test. Không nên dừng ở việc để AI điều khiển browser trực tiếp (chậm, không ổn định).

  3. Với người làm manual, chưa có kinh nghiệm auto như bạn, cách này có hiệu quả không?Có, nhưng AI chỉ rút ngắn đường học chứ không xóa bỏ việc học. Nó giúp bạn vượt rào cản khó nhất (viết selector), nhưng bạn vẫn cần học đọc và sửa lỗi test cơ bản để thật sự "biết auto".

Trả lời chi tiết

@minhphong306
minhphong306 / truncate-text.spec.ts
Created May 7, 2026 03:09
truncate-text.spec.ts
import { test, expect } from '@playwright/test';
test('truncate-text', async ({ page }) => {
await page.goto('https://material.playwrightvn.com/pages/007-page-with-truncate.html');
page.on('console', msg => {
console.log(`[browser ${msg.type()}]`, msg.text());
});
const isTruncated = await page.getByTestId('stat-label-zones').evaluate((el) => {
@minhphong306
minhphong306 / test.spec.ts
Created April 13, 2026 15:33
test.spec.ts
test("Test api create todo - multile validation", async ({ request }) => {
const body = {
"title": "Todo - Minh Phong [K22 - Multiple validation]",
"description": "Write comprehensive docs for the API",
"status": "pending",
"priority": "high",
"due_date": "2025-10-25T17:00:00",
"user_id": 1
}
@minhphong306
minhphong306 / test-lesson-10.spec.ts
Created April 13, 2026 14:13
test-lesson-10.spec.ts
import { test, expect } from "@playwright/test";
test("Test playwright selector", async ({ page }) => {
await test.step("Step 1: Goto user registration website", async () => {
await page.goto("https://material.playwrightvn.com/01-xpath-register-page.html");
});
await test.step("Step 2: Get heading value", async () => {
const textContent = await page.getByRole("heading").textContent();
console.log(textContent);
@minhphong306
minhphong306 / catpcha.spec.ts
Created April 8, 2026 14:40
catpcha.spec.ts
import { test, expect } from '@playwright/test';
import Tesseract from 'tesseract.js';
import fs from 'fs';
test('Giải mã Captcha bằng Tesseract OCR', async ({ page }) => {
// Bước 1: Mở trang thực hành
await page.goto('https://material.playwrightvn.com/036-captcha.html');
// Bước 2: Định vị (Locate) và Chụp ảnh (Screenshot) phần tử Captcha
const anhCaptcha = page.locator('#captcha-canvas'); // Selector id chứa ảnh captcha
@minhphong306
minhphong306 / requirement.md
Created April 8, 2026 13:59
requirement.md

Overview

Help me build a skill called "playwright-project-setup". This skill will be used to set up a new Playwright project.

Requirements

This skill contains 6 steps:

  1. Check if project is initialized or not. If not, we should run npm init -y playwright@latest
  2. Ask user for module structure, this will be used when we create the folder structure. The module structure is as follows:

For example, user has two modules: storefront, dashboard

@minhphong306
minhphong306 / helper-util.md
Created April 8, 2026 07:00
helper-util.md

Ranh giới giữa HelperUtil (Utility) thường khá mong manh, và tùy vào quy định của từng dự án mà chúng có thể được dùng thay thế cho nhau.

Tuy nhiên, nếu xét về mặt thiết kế phần mềm "chuẩn bài", mình có thể phân biệt dựa trên mục đíchngữ cảnh sử dụng như sau:


1. Sự khác biệt cốt lõi

Đặc điểm Utility (Util) Helper
@minhphong306
minhphong306 / test.spec.ts
Last active March 30, 2026 14:20
test.spec.ts
import { test, expect } from '@playwright/test';
test.describe("Test suite: Material site", async () => {
test.beforeAll(async () => {
console.log("BeforeAll: Trước khi tất cả các test chạy");
});
test.afterAll(async () => {
console.log("AfterAll: sau khi tất cả các test chạy");
})
@minhphong306
minhphong306 / content.md
Created March 29, 2026 14:51
content.md

Bạn là một QA Engineer có kinh nghiệm trong testing ứng dụng thương mại điện tử.

Hãy viết test case chi tiết cho chức năng sau:

[ TÊN CHỨC NĂNG / FEATURE ] Ví dụ: Đăng ký tài khoản, Đặt hàng, Thanh toán, Tìm kiếm sản phẩm...


1. Functional Test Cases