-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-playwright-simple.js
More file actions
64 lines (58 loc) · 1.93 KB
/
Copy pathtest-playwright-simple.js
File metadata and controls
64 lines (58 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { chromium } from 'playwright';
console.log('🧪 Starting simple Playwright test...');
try {
console.log('🔧 Launching chromium with Windows-compatible settings...');
const browser = await chromium.launch({
headless: true,
timeout: 60000,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-gpu',
'--no-zygote',
'--disable-software-rasterizer',
'--disable-extensions',
'--disable-background-networking',
'--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows',
'--disable-breakpad',
'--disable-component-extensions-with-background-pages',
'--disable-default-apps',
'--disable-features=Translate,BlinkGenPropertyTrees',
'--disable-hang-monitor',
'--disable-prompt-on-repost',
'--disable-renderer-backgrounding',
'--disable-sync',
'--force-color-profile=srgb',
'--metrics-recording-only',
'--no-first-run',
'--password-store=basic',
'--use-mock-keychain',
'--enable-automation',
'--disable-infobars',
'--disable-popup-blocking',
'--safebrowsing-disable-auto-update',
],
});
console.log('✅ Browser launched successfully!');
console.log('📄 Creating page...');
const page = await browser.newPage();
console.log('✅ Page created successfully!');
console.log('🌐 Navigating to example.com...');
await page.goto('https://example.com', {
waitUntil: 'domcontentloaded',
timeout: 30000,
});
console.log('✅ Navigation successful!');
const title = await page.title();
console.log(`📄 Page title: ${title}`);
await page.close();
await browser.close();
console.log('✅ Browser closed successfully!');
console.log('🎉 Test completed successfully!');
} catch (error) {
console.error('❌ Test failed:', error.message);
console.error('Stack:', error.stack);
process.exit(1);
}