Skip to content

Instantly share code, notes, and snippets.

View imshaiknasir's full-sized avatar
🎯
Being consistent

NASIR imshaiknasir

🎯
Being consistent
View GitHub Profile

guide to install Node.js LTS version 22+

This is the easiest way to get Node.js up and running, and it generally handles the path configuration for you.

  1. Download the LTS Installer:

    • Open your web browser and go to the official Node.js website: https://nodejs.org/en/download/
    • You will see two main download options: "LTS" (Long Term Support) and "Current." Click on the "LTS" button. This will typically download the latest LTS version, which will be Node.js 22+ at the time of this writing.
    • Select the macOS Installer (.pkg).

1. The Architecture of Selenium

To understand Playwright's innovation, we first need to understand the traditional architecture of Selenium. It has several distinct layers and uses the standard W3C WebDriver protocol.

The Flow of a Command in Selenium:

  1. Your Test Script (Client): You write your code using Selenium's language bindings (e.g., selenium-python, selenium-java).
  2. JSON Wire Protocol over HTTP: Your script sends a command (e.g., "click this button") as an HTTP request to a local server. This is a standard REST API call.
  3. The WebDriver (e.g., ChromeDriver, GeckoDriver): This is a separate, standalone executable file. It acts as a server and a translator. It receives the HTTP request from your script.
  4. Internal Protocol: The WebDriver then translates that HTTP command into a command that the browser can understand, using its own internal communication protocol (often built on the Chrome DevTools Protocol or a similar vendor-specific API).
# Requires -RunAsAdministrator
# This script checks for Windows Updates and installs them automatically
# Create a log file path
$logPath = "$env:USERPROFILE\Desktop\WindowsUpdateCheck.log"
$date = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
# Function to write to both console and log file
function Write-Log {
param($Message)

I'll help you create a comprehensive project structure for E2E automation testing that follows best practices and incorporates all your required technologies. Let me plan this out first.

e2e-automation/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       β”œβ”€β”€ main.yml                 # Main CI workflow
β”‚       └── scheduled-tests.yml      # Scheduled test runs
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ fixtures/                    # Playwright test fixtures
@imshaiknasir
imshaiknasir / .cursorrules
Created February 8, 2025 13:37
# .cursorrules for Playwright Web/API Automation (JavaScript/TypeScript)
You are an expert in Playwright automation for both web and API testing using JavaScript and TypeScript. Your goal is to generate code that is robust, maintainable, and aligned with modern best practices in automated testing.
─────────────────────────────────────────────
1. CODE STYLE & STRUCTURE
- Write clean, idiomatic ES6+/TypeScript code with strict type safety.
- Prefer functional and declarative programming patterns; avoid unnecessary classes or boilerplate.
- Use meaningful variable and function names (e.g., isLoading, hasError, handleClick).
- Organize test code using the @playwright/test runner (use describe, test, beforeEach, afterAll) to keep tests isolated and maintainable.
- Separate page objects, utilities, and test files for clarity.
@imshaiknasir
imshaiknasir / agent.py
Created February 5, 2025 11:32
browserUse_Amazon_Demo
from langchain_google_genai import ChatGoogleGenerativeAI
from browser_use import Agent
from dotenv import load_dotenv
from pydantic import SecretStr
import asyncio
import os
load_dotenv()
async def main():
@imshaiknasir
imshaiknasir / setup_cursor_ubuntu.md
Created February 2, 2025 14:44 — forked from evgenyneu/setup_cursor_ubuntu.md
Install Cursor AI code editor on Ubuntu 24.04 LTS

Install Cursor AI editor on Ubuntu 24.04

  1. Use the Download button on www.cursor.com web site. It will download the NAME.AppImage file.

  2. Copy the .AppImage file to your Applications directory

cd ~/Downloads
mkdir -p ~/Applications
mv NAME.AppImage ~/Applications/cursor.AppImage
@imshaiknasir
imshaiknasir / Plarwright_Prompt.md
Created January 29, 2025 07:45
Prompt for Playwright Code Generation using AI

Given the following DOM structure: [DOM HTML Structure]

Generate Playwright test code in TypeScript to perform [specific action].

Here is the page URL: [URL]

Requirements:

## Study
@imshaiknasir
imshaiknasir / alllurePATH_fix.md
Created December 25, 2024 10:13
allure command is not recognized, meaning the Allure CLI is not installed or not added to the system PATH. Here’s how to resolve this issue:

Steps to Fix

  1. Install Allure CLI
    • If you haven’t already installed the Allure CLI, you need to do so. You can install it using Node.js or manually:
      • Using Node.js:
        npm install -g allure-commandline --save-dev
        This installs Allure globally and adds it to your PATH.