Skip to content

makefile(web): auto-heal Playwright install and preserve output for s…#1

Merged
rodneyaquino merged 2 commits into
mainfrom
chore/makefile-web-autoheal
Nov 6, 2025
Merged

makefile(web): auto-heal Playwright install and preserve output for s…#1
rodneyaquino merged 2 commits into
mainfrom
chore/makefile-web-autoheal

Conversation

@rodneyaquino
Copy link
Copy Markdown
Owner

🧩 PR: Improve Playwright Web Test Reliability and Visibility

🎯 Summary

This update enhances the test-web target in the Makefile to make Playwright runs more self-healing and transparent. If the local CLI or dependencies are missing, it now auto-installs them and continues the test flow.

✅ What Changed

Makefile – test-web target

test-web: ## Run Playwright E2E (includes a11y)
	@printf "$(BLUE)🌐 Web E2E (Playwright)$(NC)\n"
	@cd tests/web && \
		if [ ! -x node_modules/.bin/playwright ]; then \
			printf "$(YELLOW)⚠️  Playwright not found. Installing deps...$(NC)\n"; \
			npm install && npx playwright install --with-deps || npx playwright install; \
		fi
	@cd tests/web && npm test 2>&1 | tee $(abspath $(WEB_LOG)) || { printf "$(RED)❌ Web failed$(NC)\n"; exit 1; }
	@perl -i -pe 's/\e\[[0-9;]*[A-Za-z]//g' $(WEB_LOG) || true
	@printf "$(GREEN)✅ Web passed$(NC)\n"

💡 Why

  • Before: Playwright CLI wasn't always available in fresh clones or CI runs. Missing binaries caused sh: playwright: command not found errors and empty logs.
  • Now: The task self-checks for node_modules/.bin/playwright, installs deps if absent, and cleans ANSI codes for reliable log parsing.
  • Result:
    • No more manual npm install before running make test-all
    • Full Playwright output visible in console and web-results.txt
    • Skipped test counts now display cleanly in summary

🧠 Notes

  • Keeps Makefile behavior consistent across local and CI runs
  • Continues to log everything to test-results/web-results.txt
  • Safe re-entry: repeated runs skip reinstall if already present

🧪 Example Output

🌐 Web E2E (Playwright)
⚠️  Playwright not found. Installing deps...
Running 7 tests using 4 workers
  ✓ WEB-001: login with valid credentials shows inventory page (1.9s)
  - WEB-A11Y-KNOWN-BUG-001: header sort dropdown is missing an accessible name
  ✓ WEB-004: sorting A→Z then Z→A changes first visible item (1.3s)
  1 skipped
  6 passed (4.4s)

✅ Web passed

🔍 Verification

  • Ran make test-web locally on a clean machine
  • Verified skipped test counts appear in make summary
  • Confirmed exit codes propagate correctly (fail on real test errors)

@rodneyaquino rodneyaquino merged commit badd7c0 into main Nov 6, 2025
1 check passed
@rodneyaquino rodneyaquino self-assigned this Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant