rentgen/test-content-script.js
Jacek Wielemborek d1d15fb602 feat(verify): use content script + DOM modification pattern
Implementacja wzorca: background → event → content script → DOM

Jak działa:
1. Background script tworzy testową stronę (browser.tabs.create)
2. Content script wstrzykiwany do tej strony (<all_urls>)
3. Content script modyfikuje DOM (document.body.setAttribute)
4. Content script loguje marker do konsoli
5. Test grep'uje logi za markerem

To dowodzi że cały stack rozszerzenia działa:
- background.ts wykonany
- browser.tabs.create() sukces
- content script injection sukces
- DOM modification sukces

Pełna weryfikacja bez WebDrivera!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 21:11:58 +02:00

11 lines
436 B
JavaScript

// Test content script - only for automated testing
// This script proves that the extension can inject content scripts and execute code
// Set DOM marker (standard pattern for extension testing)
if (document.body) {
document.body.setAttribute('data-rentgen-test', 'executed');
}
// Log marker that test can grep for
console.log('[RENTGEN_CONTENT_SCRIPT_TEST] Content script executed at', Date.now(), 'on', window.location.href);