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
@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

@minhphong306
minhphong306 / pom.api.ts
Created March 29, 2026 11:55
pom.api.ts
import { APIRequestContext } from '@playwright/test';
const BASE_URL = '/api/todo-app/v1';
interface TodoData {
id?: number;
title?: string;
description?: string;
status?: string;
priority?: string;
@minhphong306
minhphong306 / script-lesson-07.spec.ts
Created March 27, 2026 15:32
script-lesson-07.spec.ts
import { test, expect } from '@playwright/test';
test("Test 1: Register page", async ({ page }) => {
await test.step("Step 1: Đi đến trang material. Verify title hiển thị", async () => {
await page.goto("https://material.playwrightvn.com/");
const titleLoc = page.locator("//h1");
await expect(titleLoc).toBeVisible();
});
import {
FullConfig,
FullResult,
Reporter,
Suite,
TestCase,
TestResult
} from '@playwright/test/reporter';
type TestInfo = {
@minhphong306
minhphong306 / 01-login.spec.ts
Created March 22, 2026 15:30
Code demo pwa103
import { test } from '@playwright/test';
test.describe("Dashboard tests", async () => {
const authFile = 'playwright/.auth/user.json';
test.beforeEach(async ({ page }) => {
await page.goto('https://e-commerce-dev.betterbytesvn.com/wp-login.php');
await page.getByRole('textbox', { name: 'Username or Email Address' }).click();
await page.getByRole('textbox', { name: 'Username or Email Address' }).fill('');
await page.getByRole('textbox', { name: 'Password' }).click();
import { test, expect } from "@playwright/test";
import { TodoApi } from "../../src/pom/todo.api";
test("Test: chaining request", async ({ request }) => {
const todoApi = new TodoApi(request);
// Buoc 1: Goi API get --> id lon nhat
const todos = await todoApi.getTodos();
const firstTodoId = todos[0].id;
import { Page, Locator } from '@playwright/test';
export class RegisterPage {
// Khai báo page và các locator
page: Page;
usernameInput: Locator;
emailInput: Locator;
submitButton: Locator;
constructor(page: Page) {
@minhphong306
minhphong306 / README.md
Created February 10, 2026 04:22
README - Playwright TypeScript boilerplate

🎭 Project Name — Playwright Test Automation

End-to-end testing framework built with Playwright and TypeScript.

Playwright TypeScript Node.js License: MIT


@minhphong306
minhphong306 / dom.html
Created February 1, 2026 01:17
DOM example - lesson 05
<!DOCTYPE html>
<html>
<body>
<div class="container">
<!-- Form Đăng Ký -->
<div class="registration-form">
<h2>Form Đăng Ký Học Viên</h2>
<form id="studentForm">
<input id="fullname" name="name" type="text" placeholder="Họ và tên">
<input id="email" name="email" type="email" placeholder="Email">