Hi, I’m Wei! 馃憢

I’m a software engineer that is passionate about creating quality and efficient software. I have experience building web applications with Java, Angular, Javascript, and HTML/CSS.

Playwright End-to-End Testing with Playwright (Python)

Introduction Playwright is an open-source automation library developed by Microsoft for testing web applications. It enables reliable end-to-end testing across modern browsers with a single API. The Python version supports Chromium, Firefox, and WebKit, making it a robust alternative to Selenium or other legacy tools. Key Features Cross-Browser Support: Chromium, Firefox, and WebKit. Headless & Headed Modes: Run tests in both modes. Auto-Waiting: Built-in waiting mechanisms before element actions. Network Interception: Mock or modify network traffic. Async and Sync APIs: Choose between synchronous or asynchronous coding styles. Installation pip install playwright playwright install Basic Test Example from playwright.sync_api import sync_playwright def test_homepage(): with sync_playwright() as p: browser = p.chromium.launch(headless=True) page = browser.new_page() page.goto("https://playwright.dev/") assert "Playwright" in page.title() page.click("text=Get started") assert "intro" in page.url browser.close() test_homepage() Pytest For pytest integration: ...

May 17, 2025 路 2 min 路 214 words 路 Wei Wang

Getting Started with HashiCorp Vault

In modern applications, securing sensitive data like API keys, passwords, and certificates is critical. HashiCorp Vault is a powerful open-source tool designed to manage secrets and protect sensitive data. What Is HashiCorp Vault? Vault helps you: Securely store and access secrets Dynamically generate credentials (e.g., DB credentials) Encrypt/decrypt data without storing it Manage access through fine-grained policies Key Concepts Secrets Engine: Backend that stores secrets (e.g., KV, AWS, DB). Authentication Method: How clients authenticate (e.g., Token, AppRole). Policies: Define who can do what. Leases: Automatic expiration of secrets. Getting Started 1. Install Vault macOS brew install vault Windows Chocolately choco install vault Manual Installation Download the Vault binary from https://developer.hashicorp.com/vault/downloads. Unzip and add the Vault executable to your system鈥檚 PATH. 1.1 Running the vault (Dev Mode) vault server -dev Vault starts in dev mode with a root token printed in the console. ...

May 7, 2025 路 2 min 路 295 words 路 Wei Wang

Using Serilog with ILogger in CSharp

Serilog is a powerful logging library for .NET applications. It supports structured logging and integrates easily with ILogger from Microsoft.Extensions.Logging. Installation Install the necessary NuGet packages: dotnet add package Serilog.AspNetCore dotnet add package Serilog.Sinks.Console Basic Setup in Program.cs (.NET 8+) using Microsoft.Extensions.Hosting; using Serilog; Log.Logger = new LoggerConfiguration() .WriteTo.Console() .CreateLogger(); var builder = WebApplication.CreateBuilder(args); // Replace default logging with Serilog builder.Host.UseSerilog(); // --- Some code here app.Run(); Using ILogger in a Controller or Service using Microsoft.Extensions.Logging; public class MyService { private readonly ILogger<MyService> _logger; public MyService(ILogger<MyService> logger) { _logger = logger; } public void DoWork() { _logger.LogInformation("Doing work at {Time}", DateTime.UtcNow); try { // some code } catch (Exception ex) { _logger.LogError(ex, "An error occurred while doing work"); } } } Benefits Structured logging with properties Multiple sinks (e.g., console, file, Seq) Easy integration with ASP.NET Core Resources Serilog Documentation GitHub Repo

May 6, 2025 路 1 min 路 142 words 路 Wei Wang

Customizing Log Output with Seilog's IDestructuring Policy

Serilog is a powerful logging library for .NET that allows deep customization of how objects are represented in structured logs. One such customization point is IDestructuringPolicy. What is IDestructuringPolicy? IDestructuringPolicy is an interface in Serilog that lets you control how specific objects are transformed into structured log data. This is especially useful when you want to: Omit sensitive fields (e.g., passwords, tokens) Rename properties Format output differently Use Case Example Say you have a User class: ...

August 6, 2024 路 2 min 路 232 words 路 Wei Wang

iPhone Call Menu Automation

With rise in Automated Call Menus, it has become tedious to get past complex menu options. Fortunately iPhone has a built in option to automate this process. Below, I am using Fidelity as an example, as it requires you to login using an numeric representation of your username and password. As my password is very complex, this guide streamlines the process and saves me 1-5 minutes each time I call Fidelity. ...

July 7, 2023 路 2 min 路 256 words 路 Wei Wang