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

Mock API là gì? Tại sao phải Mock API và cách thực hiện

Mock API là gì?

Mock API (API giả lập) là một phiên bản giả của API thực, được tạo ra để mô phỏng hành vi và phản hồi của API thật mà không cần kết nối đến server backend thực tế. Mock API trả về dữ liệu mẫu đã được định nghĩa trước thay vì dữ liệu thực từ database hay các service khác.

Ví dụ thực tế:

Giả sử bạn đang phát triển một ứng dụng quản lý sản phẩm:

API thực:

@minhphong306
minhphong306 / q1.md
Last active September 15, 2025 03:29

Câu Hỏi Phỏng Vấn Selenium Java - Từ Cơ Bản Đến Nâng Cao

PHẦN 1: CÂU HỎI CƠ BẢN

1. Selenium WebDriver là gì?

Trả lời: Selenium WebDriver là một công cụ automation testing mã nguồn mở, cho phép tương tác trực tiếp với trình duyệt web thông qua các API native của browser. WebDriver hỗ trợ nhiều ngôn ngữ lập trình như Java, Python, C#, Ruby và JavaScript.

Ví dụ code Java:

@minhphong306
minhphong306 / middle-golang-interview-questions.md
Created September 11, 2025 06:22
middle-golang-interview-questions.md

Core Golang Concepts

1. Goroutines & Concurrency

  • Goroutines là gì, khác gì với thread
  • Channel (buffered vs unbuffered)
  • Select statement
  • WaitGroup, Mutex, RWMutex
  • Race condition và cách xử lý
  • Context package và cách sử dụng
@minhphong306
minhphong306 / structure.md
Created September 8, 2025 17:18
structure.md

Playwright Framework Structure

playwright-framework/
├── .github/
│   └── workflows/
│       ├── ci.yml
│       ├── nightly.yml
│       └── release.yml
├── config/
import { test, expect, Page } from '@playwright/test';
import { faker } from '@faker-js/faker';
import path from 'path';
test.describe('Lesson 02 - Ex 01', async () => {
const baseUrl = 'https://material.playwrightvn.com/';
const registerData = {
username: faker.person.fullName(),
email: faker.internet.email(),
@minhphong306
minhphong306 / playwright-snowflake.md
Last active August 19, 2025 10:30
playwright-snowflake.md

1. Cài đặt dependencies

npm install @playwright/test playwright
npm install snowflake-sdk
npm install dotenv
npm install --save-dev @types/snowflake-sdk @types/node typescript

2. Kết nối Snowflake với snowflake-sdk

@minhphong306
minhphong306 / code.ts
Created June 29, 2025 07:50
Code need help
import { test } from '@playwright/test';
test("Register", async ({ page }) => {
await page.goto('https://material.playwrightvn.com/');
await page.click('//a[@href="01-xpath-register-page.html"]');
await page.locator('//input[@id="username"]').fill('Trangdt98');
await page.locator('//input[@id="email"]').fill('[email protected]');
await page.locator('//input[@id="female"]').check();
await page.locator('//input[@id="traveling"]').check();
await page.locator('//select[@id="country"]').selectOption({ value: "usa" });
await page.locator('//input[@id="profile"]').setInputFiles("D:/pw-course (1)/Data/165522424_10225222190398060_7591752606277882188_n.jpg");
@minhphong306
minhphong306 / prompt.md
Created June 8, 2025 03:53
Playwright Prompt Template

Playwright Testing Standards and Best Practices

Testing Architecture

  • Follow the Page Object Model pattern strictly
  • Separate locators and actions in page object files
  • Maintain directory structure that mirrors business logic
  • Page objects should be independent from one another when possible
  • Reuse existing page objects and utilities before creating new ones
@minhphong306
minhphong306 / pw.py
Created March 18, 2025 23:56
Python Playwright multi thread cookie
import threading
import time
from playwright.sync_api import sync_playwright
import requests
# Biến toàn cục để lưu cookie và lock để đảm bảo thread-safe
cookie_storage = None
cookie_lock = threading.Lock()
# Luồng 1: Login và lấy cookie
const listA = [1, 2, 3, 4];
const listB = [4, 5, 6];
// Build map
const mapA = {
'1': true,
'2': true,
'3': true
};
listA.forEach(item => mapA[item] = true);