Add Playwright E2E testing infrastructure
- Add playwright-web-flake to flake.nix for NixOS browser support - Pin @playwright/test@1.56.1 to match nixpkgs version - Create playwright.config.ts with Chromium-only, auto-start dev server - Add e2e/smoke.spec.ts with initial smoke tests - Add .mcp.json for Claude browser control via MCP - Update .gitignore for playwright artifacts - Remove E2E test skip from spec.md Known Limitations - Update specs/testing.md to require three-tier testing approach Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
30
flake.nix
30
flake.nix
@@ -2,11 +2,13 @@
|
||||
# ABOUTME: Provides Node.js 24, pnpm, turbo, lefthook, and Docker image output.
|
||||
{
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs.playwright-web-flake.url = "github:pietdevries94/playwright-web-flake/1.56.1";
|
||||
|
||||
outputs = { nixpkgs, ... }:
|
||||
outputs = { nixpkgs, playwright-web-flake, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
playwright-driver = playwright-web-flake.packages.${system}.playwright-driver;
|
||||
|
||||
# Custom Python package: garth (not in nixpkgs)
|
||||
garth = pkgs.python3Packages.buildPythonPackage {
|
||||
@@ -48,32 +50,40 @@
|
||||
devShells.${system} = {
|
||||
# Default development shell with all tools
|
||||
default = pkgs.mkShell {
|
||||
packages = commonPackages ++ (with pkgs; [
|
||||
turbo
|
||||
lefthook
|
||||
]);
|
||||
packages = commonPackages ++ [
|
||||
pkgs.turbo
|
||||
pkgs.lefthook
|
||||
playwright-driver
|
||||
];
|
||||
|
||||
# For native modules (sharp, better-sqlite3, etc.)
|
||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc ];
|
||||
|
||||
# Playwright browser configuration for NixOS (from playwright-web-flake)
|
||||
PLAYWRIGHT_BROWSERS_PATH = "${playwright-driver.browsers}";
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
|
||||
};
|
||||
|
||||
# Ralph sandbox shell with minimal permissions
|
||||
# Used for autonomous Ralph loop execution
|
||||
ralph = pkgs.mkShell {
|
||||
packages = commonPackages ++ (with pkgs; [
|
||||
# Claude CLI (assumes installed globally or via npm)
|
||||
# Add any other tools Ralph needs here
|
||||
]);
|
||||
packages = commonPackages ++ [
|
||||
playwright-driver
|
||||
];
|
||||
|
||||
# Restrictive environment for sandboxed execution
|
||||
shellHook = ''
|
||||
echo "🔒 Ralph Sandbox Environment"
|
||||
echo " Limited to: nodejs, pnpm, git"
|
||||
echo " Limited to: nodejs, pnpm, git, playwright"
|
||||
echo ""
|
||||
'';
|
||||
|
||||
# For native modules
|
||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc ];
|
||||
|
||||
# Playwright browser configuration for NixOS (from playwright-web-flake)
|
||||
PLAYWRIGHT_BROWSERS_PATH = "${playwright-driver.browsers}";
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user