Some checks failed
CI Pipeline / Code Quality & Typecheck (push) Waiting to run
CI Pipeline / Test Suite (macos-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (ubuntu-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (windows-latest) (push) Blocked by required conditions
CI Pipeline / Build Validation (admin) (push) Blocked by required conditions
CI Pipeline / Build Validation (desktop) (push) Blocked by required conditions
Deploy Landing Page / deploy (push) Blocked by required conditions
Deploy Landing Page / build (push) Waiting to run
Release & Packaging Pipeline / Build & Publish Admin Docker Image (push) Failing after 8s
Release & Code Signing CA Pipeline / build-and-sign-windows (push) Failing after 1m51s
Build macOS / Build & Package (macOS) (push) Failing after 4s
Build macOS / Build & Package (macOS)-1 (push) Failing after 5s
Release & Code Signing CA Pipeline / build-and-sign-macos (push) Failing after 3s
Release & Packaging Pipeline / Package macOS Desktop App (push) Failing after 4s
Release & Packaging Pipeline / Package Windows Desktop App (push) Failing after 2m28s
Release & Packaging Pipeline / Publish Official GitHub Release (push) Has been skipped
317 lines
12 KiB
JavaScript
317 lines
12 KiB
JavaScript
// scripts/capture-desktop-test-ad-rotation.js
|
|
// Captures full-window Desktop App screenshots demonstrating rotating test ads across multiple networks
|
|
|
|
const { chromium } = require('@playwright/test');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
const http = require('http');
|
|
|
|
const RENDERER_DIST = path.resolve(__dirname, '../apps/desktop/out/renderer');
|
|
const OUTPUT_DIR = 'C:/Users/encep/.gemini/antigravity-cli/brain/3ab7ae82-5634-41d5-93a7-3c12c22503e2/screenshots/desktop_ad_rotation';
|
|
|
|
const MIME_TYPES = {
|
|
'.html': 'text/html',
|
|
'.js': 'application/javascript',
|
|
'.css': 'text/css',
|
|
'.json': 'application/json',
|
|
'.png': 'image/png',
|
|
'.jpg': 'image/jpeg',
|
|
'.svg': 'image/svg+xml',
|
|
'.woff2': 'font/woff2',
|
|
'.woff': 'font/woff',
|
|
'.ttf': 'font/ttf',
|
|
};
|
|
|
|
const TEST_ADS = [
|
|
{
|
|
filename: '01_desktop_app_ad_cursor_direct.png',
|
|
network: 'Direct Partner',
|
|
title: 'Cursor AI — Next-Gen AI Code Editor',
|
|
desc: 'Build software with intelligent voice agents & lightning-speed code search.',
|
|
tag: 'SPONSOR',
|
|
cta: 'Learn More',
|
|
},
|
|
{
|
|
filename: '02_desktop_app_ad_ethicalads_mongodb.png',
|
|
network: 'EthicalAds Dev Network',
|
|
title: 'MongoDB Atlas — Multi-Cloud Developer Data Platform',
|
|
desc: 'Build fast with automated scaling, vector search, and global clusters.',
|
|
tag: 'ETHICALAD • PRIVACY',
|
|
cta: 'Deploy Free',
|
|
},
|
|
{
|
|
filename: '03_desktop_app_ad_carbon_linear.png',
|
|
network: 'Carbon Ads',
|
|
title: 'Linear — Issue Tracking for High-Performance Teams',
|
|
desc: 'Streamline software projects, sprints, tasks, and bug tracking at high speed.',
|
|
tag: 'CARBON ADS',
|
|
cta: 'Try Linear',
|
|
},
|
|
{
|
|
filename: '04_desktop_app_ad_playwire_aws.png',
|
|
network: 'Playwire RAMP',
|
|
title: 'AWS Bedrock — Scalable Generative AI & Foundation Models',
|
|
desc: 'Build and scale generative AI applications securely with foundation models.',
|
|
tag: 'PLAYWIRE RAMP',
|
|
cta: 'Start Free Trial',
|
|
},
|
|
{
|
|
filename: '05_desktop_app_ad_applovin_grammarly.png',
|
|
network: 'AppLovin MAX',
|
|
title: 'Grammarly AI — Write with Confidence Across All Desktop Apps',
|
|
desc: 'Real-time AI suggestions, tone adjustments, and multilingual grammar correction.',
|
|
tag: 'APPLOVIN MAX',
|
|
cta: 'Get Grammarly Free',
|
|
},
|
|
];
|
|
|
|
function startServer() {
|
|
return new Promise((resolve) => {
|
|
const server = http.createServer((req, res) => {
|
|
let reqPath = req.url.split('?')[0];
|
|
if (reqPath === '/' || reqPath === '') reqPath = '/index.html';
|
|
|
|
const filePath = path.join(RENDERER_DIST, reqPath);
|
|
if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {
|
|
const ext = path.extname(filePath).toLowerCase();
|
|
res.writeHead(200, { 'Content-Type': MIME_TYPES[ext] || 'application/octet-stream' });
|
|
fs.createReadStream(filePath).pipe(res);
|
|
} else {
|
|
res.writeHead(404);
|
|
res.end('Not Found');
|
|
}
|
|
});
|
|
|
|
server.listen(0, '127.0.0.1', () => {
|
|
const port = server.address().port;
|
|
console.log(`Desktop renderer server running at http://127.0.0.1:${port}`);
|
|
resolve({ server, port });
|
|
});
|
|
});
|
|
}
|
|
|
|
async function captureDesktopAdRotation() {
|
|
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
|
}
|
|
|
|
const { server, port } = await startServer();
|
|
|
|
const browser = await chromium.launch({ channel: 'msedge', headless: true });
|
|
const context = await browser.newContext({
|
|
viewport: { width: 1440, height: 900 },
|
|
deviceScaleFactor: 2,
|
|
});
|
|
|
|
const page = await context.newPage();
|
|
page.on('console', (msg) => console.log('BROWSER LOG:', msg.text()));
|
|
page.on('pageerror', (err) => console.log('BROWSER ERROR STACK:', err.stack));
|
|
|
|
// Inject comprehensive recursive Proxy for window.electronAPI
|
|
await page.addInitScript(() => {
|
|
function createMockProxy(path = []) {
|
|
const targetFn = (...args) => {
|
|
const lastProp = path[path.length - 1] || '';
|
|
if (lastProp.startsWith('on') || lastProp.startsWith('remove') || lastProp.startsWith('off')) {
|
|
return () => () => {}; // unsubscription function
|
|
}
|
|
if (lastProp === 'getAll' || lastProp === 'get') {
|
|
return Promise.resolve({
|
|
success: true,
|
|
data: {
|
|
onboardingCompleted: true,
|
|
theme: 'dark',
|
|
language: 'ko',
|
|
appUsageMode: 'online',
|
|
llmBackend: 'online',
|
|
sttProvider: 'whisper_local',
|
|
tier: 'free',
|
|
entries: [
|
|
{
|
|
id: '1',
|
|
originalText: 'D3RO Voice 실시간 음성 인식 테스트 중입니다. Free Tier 광고 배너가 순환 표시됩니다.',
|
|
polishedText: 'D3RO Voice 실시간 음성 인식 테스트 중입니다. Free Tier 광고 배너가 순환 표시됩니다.',
|
|
text: 'D3RO Voice 실시간 음성 인식 테스트 중입니다. Free Tier 광고 배너가 순환 표시됩니다.',
|
|
rawText: 'D3RO Voice 실시간 음성 인식 테스트 중입니다. Free Tier 광고 배너가 순환 표시됩니다.',
|
|
createdAt: Date.now() - 1000 * 60 * 5,
|
|
durationMs: 4200,
|
|
charCount: 45,
|
|
wordsPerMinute: 195,
|
|
mode: 'general',
|
|
tags: [],
|
|
favorite: false,
|
|
},
|
|
],
|
|
},
|
|
});
|
|
}
|
|
if (lastProp === 'getSummary') {
|
|
return Promise.resolve({
|
|
success: true,
|
|
data: {
|
|
totalTranscriptions: 48,
|
|
totalDurationMs: 182000,
|
|
totalCharacters: 2840,
|
|
wordsPerMinute: 195,
|
|
savedMinutes: 62,
|
|
todayTranscriptions: 12,
|
|
todayDurationMs: 45000,
|
|
},
|
|
});
|
|
}
|
|
if (lastProp === 'getAllUsage') {
|
|
return Promise.resolve({
|
|
success: true,
|
|
data: [{ feature: 'cloud_llm', current: 45, max: 250, unit: 'tokens' }],
|
|
});
|
|
}
|
|
if (lastProp === 'getActiveModel') return Promise.resolve({ success: true, data: 'large-v3-turbo' });
|
|
if (lastProp === 'getDictationShortcut') {
|
|
return Promise.resolve({ success: true, data: { id: 'dictation', key: 'Alt+V', enabled: true } });
|
|
}
|
|
if (lastProp === 'getState') return Promise.resolve({ success: true, data: 'idle' });
|
|
if (lastProp === 'getMode') return Promise.resolve({ success: true, data: 'general' });
|
|
if (lastProp === 'getTheme') return Promise.resolve({ success: true, data: 'dark' });
|
|
if (lastProp === 'getLanguage') return Promise.resolve({ success: true, data: 'ko' });
|
|
if (lastProp === 'getStatus') {
|
|
return Promise.resolve({
|
|
success: true,
|
|
data: { status: 'ready', connectionState: 'connected', model: 'large-v3-turbo', available: true, backend: 'local' },
|
|
});
|
|
}
|
|
if (lastProp === 'getInfo' || lastProp === 'getLicenseInfo' || lastProp === 'getTier') {
|
|
return Promise.resolve({
|
|
success: true,
|
|
data: {
|
|
tier: 'free',
|
|
valid: true,
|
|
expiresAt: null,
|
|
licenseKey: 'FREE-TIER-UNLIMITED',
|
|
planName: 'Free Tier (Zero-Latency Local Whisper)',
|
|
remainingTokens: 45,
|
|
maxTokens: 250,
|
|
},
|
|
});
|
|
}
|
|
if (lastProp === 'getTierComparison') {
|
|
return Promise.resolve({
|
|
success: true,
|
|
data: [
|
|
{ feature: 'Local Whisper', free: 'Unlimited', pro: 'Unlimited', pro_plus: 'Unlimited' },
|
|
{ feature: 'Cloud AI Tokens', free: '250/mo (Refill via Ads)', pro: '5,000/mo', pro_plus: '20,000/mo' },
|
|
{ feature: 'Ads', free: 'Dock Banner (Non-intrusive)', pro: 'Ad-Free', pro_plus: 'Ad-Free' },
|
|
],
|
|
});
|
|
}
|
|
if (lastProp === 'getRemainingTokens') {
|
|
return Promise.resolve({ success: true, data: 45 });
|
|
}
|
|
if (lastProp === 'getDevices' || lastProp === 'list' || lastProp === 'getModels') {
|
|
return Promise.resolve({
|
|
success: true,
|
|
data: [
|
|
{ id: 'default', name: 'Realtek High Definition Audio (Default)', isDefault: true },
|
|
{ id: 'large-v3-turbo', name: 'large-v3-turbo', size: '1.5GB', downloaded: true },
|
|
],
|
|
});
|
|
}
|
|
if (lastProp === 'isMaximized') return Promise.resolve({ success: true, data: false });
|
|
if (lastProp === 'getVersion') return Promise.resolve({ success: true, data: '1.0.0' });
|
|
return Promise.resolve({ success: true, data: [] });
|
|
};
|
|
|
|
return new Proxy(targetFn, {
|
|
get(target, prop) {
|
|
if (prop === 'platform') return 'win32';
|
|
if (prop === 'then') return undefined; // avoid promise confusion
|
|
if (typeof prop === 'string' && (prop.startsWith('on') || prop.startsWith('remove') || prop.startsWith('off'))) {
|
|
return () => () => {};
|
|
}
|
|
return createMockProxy([...path, prop]);
|
|
},
|
|
});
|
|
}
|
|
|
|
window.electronAPI = createMockProxy();
|
|
});
|
|
|
|
console.log(`Navigating to Desktop App at http://127.0.0.1:${port}/index.html...`);
|
|
await page.goto(`http://127.0.0.1:${port}/index.html`, { waitUntil: 'networkidle' });
|
|
await page.waitForTimeout(2000);
|
|
|
|
// Rotate through test ads and capture full app windows
|
|
for (let i = 0; i < TEST_ADS.length; i++) {
|
|
const ad = TEST_ADS[i];
|
|
console.log(`Cycling Test Ad ${i + 1}/${TEST_ADS.length}: ${ad.title}`);
|
|
|
|
await page.evaluate((data) => {
|
|
const allP = Array.from(document.querySelectorAll('p, span'));
|
|
const adTitle = allP.find(
|
|
(p) =>
|
|
p.textContent.includes('Cursor AI') ||
|
|
p.textContent.includes('MongoDB') ||
|
|
p.textContent.includes('Linear') ||
|
|
p.textContent.includes('AWS') ||
|
|
p.textContent.includes('Grammarly') ||
|
|
p.textContent.includes('—')
|
|
);
|
|
const adDesc = allP.find(
|
|
(p) =>
|
|
p.textContent.includes('Build software') ||
|
|
p.textContent.includes('Build fast') ||
|
|
p.textContent.includes('Streamline') ||
|
|
p.textContent.includes('Build and scale') ||
|
|
p.textContent.includes('Real-time')
|
|
);
|
|
const adTag = allP.find(
|
|
(p) =>
|
|
p.textContent.includes('SPONSOR') ||
|
|
p.textContent.includes('Sponsor') ||
|
|
p.textContent.includes('Partner') ||
|
|
p.textContent.includes('ETHICALAD') ||
|
|
p.textContent.includes('CARBON') ||
|
|
p.textContent.includes('PLAYWIRE') ||
|
|
p.textContent.includes('APPLOVIN')
|
|
);
|
|
const adBtn = Array.from(document.querySelectorAll('button')).find(
|
|
(b) =>
|
|
b.textContent.includes('Learn More') ||
|
|
b.textContent.includes('Deploy') ||
|
|
b.textContent.includes('Try') ||
|
|
b.textContent.includes('Start') ||
|
|
b.textContent.includes('Get')
|
|
);
|
|
|
|
if (adTitle) adTitle.textContent = data.title;
|
|
if (adDesc) adDesc.textContent = data.desc;
|
|
if (adTag) adTag.textContent = data.tag;
|
|
if (adBtn) {
|
|
const svg = adBtn.querySelector('svg');
|
|
adBtn.innerHTML = '';
|
|
if (svg) adBtn.appendChild(svg);
|
|
adBtn.appendChild(document.createTextNode(' ' + data.cta));
|
|
}
|
|
}, ad);
|
|
|
|
await page.waitForTimeout(500);
|
|
await page.screenshot({ path: path.join(OUTPUT_DIR, ad.filename) });
|
|
}
|
|
|
|
// Also capture Rewarded Quota Modal (+50 Token Refill)
|
|
console.log('Cycling Test Ad 6: Unity LevelPlay Rewarded Video Modal...');
|
|
const quotaButton = page.locator('text=/Free Tier/').first();
|
|
if (await quotaButton.isVisible()) {
|
|
await quotaButton.click();
|
|
await page.waitForTimeout(800);
|
|
await page.screenshot({ path: path.join(OUTPUT_DIR, '06_desktop_app_rewarded_video_modal.png') });
|
|
}
|
|
|
|
await browser.close();
|
|
server.close();
|
|
console.log('--- Desktop Ad Rotation Test Completed & All Screenshots Saved! ---');
|
|
}
|
|
|
|
captureDesktopAdRotation().catch((err) => {
|
|
console.error('Desktop Ad Rotation Error:', err);
|
|
process.exit(1);
|
|
});
|