Files
cannaiq/backend/archive/test-improved-age-gate.ts
Kelly d91c55a344 feat: Add stale process monitor, users route, landing page, archive old scripts
- Add backend stale process monitoring API (/api/stale-processes)
- Add users management route
- Add frontend landing page and stale process monitor UI on /scraper-tools
- Move old development scripts to backend/archive/
- Update frontend build with new features

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 04:07:31 -07:00

47 lines
1.4 KiB
TypeScript

import puppeteer from 'puppeteer-extra';
import StealthPlugin from 'puppeteer-extra-plugin-stealth';
import { bypassAgeGate, setAgeGateCookies } from './src/utils/age-gate';
puppeteer.use(StealthPlugin());
async function test() {
const browser = await puppeteer.launch({
headless: 'new',
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-blink-features=AutomationControlled'
]
});
const page = await browser.newPage();
await page.setViewport({ width: 1920, height: 1080 });
await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36');
const url = 'https://curaleaf.com/stores/curaleaf-az-48th-street';
console.log('Setting age gate cookies before navigation...');
await setAgeGateCookies(page, url, 'Arizona');
console.log('Loading Curaleaf page...');
await page.goto(url, {
waitUntil: 'domcontentloaded',
timeout: 60000
});
await page.waitForTimeout(3000);
console.log(`\nURL after navigation: ${page.url()}`);
// Try to bypass if age gate still appeared
const success = await bypassAgeGate(page, 'Arizona');
console.log(`\nFinal URL: ${page.url()}`);
console.log(`Result: ${page.url().includes('/age-gate') ? '❌ FAILED - Still at age gate' : '✅ SUCCESS - Past age gate'}`);
await browser.close();
process.exit(page.url().includes('/age-gate') ? 1 : 0);
}
test().catch(console.error);