- 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>
80 lines
2.8 KiB
TypeScript
80 lines
2.8 KiB
TypeScript
import { chromium } from 'playwright';
|
|
|
|
const TEST_URL = 'https://curaleaf.com/stores/curaleaf-dispensary-48th-street';
|
|
|
|
async function testCuraleafFinal() {
|
|
console.log('\n🎭 Testing Curaleaf Age Gate Bypass - Final Version\n');
|
|
|
|
const browser = await chromium.launch({ headless: true });
|
|
const context = await browser.newContext({
|
|
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
|
viewport: { width: 1280, height: 720 }
|
|
});
|
|
|
|
const page = await context.newPage();
|
|
|
|
try {
|
|
console.log('📍 Step 1: Navigating to Curaleaf...');
|
|
await page.goto(TEST_URL, { waitUntil: 'domcontentloaded' });
|
|
await page.waitForTimeout(2000);
|
|
|
|
let currentUrl = page.url();
|
|
console.log(`Current URL: ${currentUrl}`);
|
|
|
|
if (!currentUrl.includes('/age-gate')) {
|
|
console.log('✅ No age gate - page loaded directly!');
|
|
return;
|
|
}
|
|
|
|
console.log('\n📍 Step 2: Clicking state dropdown...');
|
|
await page.locator('button#state').click();
|
|
await page.waitForTimeout(1000);
|
|
|
|
console.log('📍 Step 3: Selecting Arizona...');
|
|
await page.locator('[role="option"]').filter({ hasText: /^Arizona$/i }).click();
|
|
await page.waitForTimeout(2000);
|
|
|
|
console.log('📍 Step 4: Clicking "I\'m over 21" button...');
|
|
await page.locator('button').filter({ hasText: /I'm over 21/i }).click();
|
|
|
|
// Wait for navigation
|
|
await page.waitForLoadState('domcontentloaded', { timeout: 15000 });
|
|
await page.waitForTimeout(3000);
|
|
|
|
currentUrl = page.url();
|
|
console.log(`\n✅ Final URL: ${currentUrl}`);
|
|
|
|
if (currentUrl.includes('/age-gate')) {
|
|
console.log('❌ Still at age gate - bypass FAILED');
|
|
await page.screenshot({ path: '/tmp/curaleaf-final-failed.png' });
|
|
} else {
|
|
console.log('✅ SUCCESS! Age gate bypassed!');
|
|
await page.screenshot({ path: '/tmp/curaleaf-final-success.png' });
|
|
|
|
// Get and save the cookies
|
|
const cookies = await context.cookies();
|
|
console.log('\n🍪 Successful cookies:');
|
|
cookies.forEach(c => {
|
|
if (c.name.includes('age') || c.name.includes('state') || c.name.includes('verify')) {
|
|
console.log(` ${c.name}: ${c.value}`);
|
|
}
|
|
});
|
|
|
|
// Check if we can see the menu
|
|
const pageContent = await page.textContent('body');
|
|
const hasMenu = pageContent?.toLowerCase().includes('menu') ||
|
|
pageContent?.toLowerCase().includes('shop') ||
|
|
pageContent?.toLowerCase().includes('product');
|
|
console.log(`\nCan see menu/products: ${hasMenu ? '✅' : '❌'}`);
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('❌ Error:', error);
|
|
} finally {
|
|
await browser.close();
|
|
console.log('\n✅ Test completed');
|
|
}
|
|
}
|
|
|
|
testCuraleafFinal();
|