Skip to content

Commit 79e8c14

Browse files
etewiahclaude
andcommitted
Add E2E test runner wrapper script
- scripts/run-e2e-tests.sh: Bash wrapper that handles full e2e setup - Checks and sets up e2e database if needed - Starts Rails server on port 3001 - Runs Playwright tests with passed arguments - Cleans up server on exit - Added rake tasks for convenience: - playwright:test[args] - Run tests with optional args - playwright:ui - Run with Playwright UI - playwright:headed - Run with visible browser - playwright:report - Show test report Usage: ./scripts/run-e2e-tests.sh # Run all tests ./scripts/run-e2e-tests.sh --ui # With Playwright UI ./scripts/run-e2e-tests.sh --reset # Force DB reset first bundle exec rake playwright:test 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent af34556 commit 79e8c14

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

lib/tasks/playwright.rake

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,38 @@ namespace :playwright do
9595

9696
load Rails.root.join('db', 'seeds', 'e2e_seeds.rb')
9797
end
98+
99+
desc "Run Playwright E2E tests (sets up env, starts server, runs tests)"
100+
task :test, [:args] => :environment do |_t, task_args|
101+
script_path = Rails.root.join('scripts', 'run-e2e-tests.sh')
102+
103+
unless File.exist?(script_path)
104+
puts "❌ E2E test runner script not found at #{script_path}"
105+
exit 1
106+
end
107+
108+
# Pass any additional arguments to the script
109+
args = task_args[:args] || ''
110+
puts "🎭 Running Playwright E2E tests..."
111+
puts ""
112+
113+
# Execute the wrapper script
114+
exec "#{script_path} #{args}"
115+
end
116+
117+
desc "Run Playwright E2E tests with UI mode"
118+
task ui: :environment do
119+
Rake::Task['playwright:test'].invoke('--ui')
120+
end
121+
122+
desc "Run Playwright E2E tests in headed mode (visible browser)"
123+
task headed: :environment do
124+
Rake::Task['playwright:test'].invoke('--headed')
125+
end
126+
127+
desc "Show Playwright test report"
128+
task report: :environment do
129+
puts "📊 Opening Playwright report..."
130+
exec "npx playwright show-report"
131+
end
98132
end

0 commit comments

Comments
 (0)