96 lines
3.6 KiB
JavaScript
96 lines
3.6 KiB
JavaScript
|
|
const { chromium } = require('playwright');
|
||
|
|
const path = require('path');
|
||
|
|
|
||
|
|
const OUT_DIR = '/home/zgaetano/media-command-guide/screenshots';
|
||
|
|
const COOKIE_VAL = 's:d16cd74687c1f5e4322b9d24657efe7da055c019d97fb2e0.nHwwxY6iik6jiySDiKS6aUxacWRQy3T+dCiMTN8Fu8s';
|
||
|
|
|
||
|
|
(async () => {
|
||
|
|
const browser = await chromium.launch({
|
||
|
|
headless: true,
|
||
|
|
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-gpu']
|
||
|
|
});
|
||
|
|
|
||
|
|
const context = await browser.newContext({
|
||
|
|
viewport: { width: 1920, height: 1080 },
|
||
|
|
deviceScaleFactor: 1
|
||
|
|
});
|
||
|
|
|
||
|
|
await context.addCookies([{
|
||
|
|
name: 'dragonflight.sid',
|
||
|
|
value: COOKIE_VAL,
|
||
|
|
domain: 'mediacmdr.com',
|
||
|
|
path: '/',
|
||
|
|
httpOnly: true,
|
||
|
|
secure: true
|
||
|
|
}]);
|
||
|
|
|
||
|
|
const page = await context.newPage();
|
||
|
|
|
||
|
|
// 1. Go to Library and select Broadcast Management Group
|
||
|
|
await page.goto('https://mediacmdr.com/', { waitUntil: 'networkidle' });
|
||
|
|
await page.waitForTimeout(2000);
|
||
|
|
|
||
|
|
// Click Library
|
||
|
|
await page.evaluate(() => {
|
||
|
|
const items = Array.from(document.querySelectorAll('.nav-item'));
|
||
|
|
const target = items.find(i => i.innerText.trim().startsWith('Library'));
|
||
|
|
if (target) target.click();
|
||
|
|
});
|
||
|
|
await page.waitForTimeout(3000);
|
||
|
|
|
||
|
|
// Select BMG project from dropdown
|
||
|
|
await page.evaluate(() => {
|
||
|
|
const sel = document.querySelector('.library-project-select, select');
|
||
|
|
if (sel) {
|
||
|
|
sel.value = '5ebf74aa-f5b4-4a83-b089-c9af2cb25d1f';
|
||
|
|
sel.dispatchEvent(new Event('change', { bubbles: true }));
|
||
|
|
}
|
||
|
|
});
|
||
|
|
await page.waitForTimeout(4000);
|
||
|
|
|
||
|
|
// Pause videos and snap
|
||
|
|
await page.evaluate(() => document.querySelectorAll('video').forEach(v => { try { v.pause(); } catch(e){} }));
|
||
|
|
await page.screenshot({ path: path.join(OUT_DIR, '09-media-library-bmg.png'), fullPage: false });
|
||
|
|
console.log('Saved: 09-media-library-bmg.png');
|
||
|
|
|
||
|
|
// 2. Click on the first asset to open Asset Detail / Inspector
|
||
|
|
const clickedAsset = await page.evaluate(() => {
|
||
|
|
const rows = Array.from(document.querySelectorAll('tbody tr, .asset-card, .grid-item, [role="row"]'));
|
||
|
|
// Find a row with asset name
|
||
|
|
for (const r of rows) {
|
||
|
|
if (r.innerText && (r.innerText.includes('.mov') || r.innerText.includes('.mp4') || r.innerText.includes('.mxf') || r.innerText.includes('7H') || r.innerText.includes('KB') || r.innerText.includes('MB') || r.innerText.includes('GB'))) {
|
||
|
|
r.click();
|
||
|
|
return r.innerText.slice(0, 80);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return null;
|
||
|
|
});
|
||
|
|
console.log('Clicked asset:', clickedAsset);
|
||
|
|
await page.waitForTimeout(4000);
|
||
|
|
|
||
|
|
await page.evaluate(() => document.querySelectorAll('video').forEach(v => { try { v.pause(); } catch(e){} }));
|
||
|
|
await page.screenshot({ path: path.join(OUT_DIR, '09b-media-library-asset-inspector.png'), fullPage: false });
|
||
|
|
console.log('Saved: 09b-media-library-asset-inspector.png');
|
||
|
|
|
||
|
|
// 3. Open Downloads modal from Home
|
||
|
|
await page.evaluate(() => {
|
||
|
|
const items = Array.from(document.querySelectorAll('.nav-item'));
|
||
|
|
const target = items.find(i => i.innerText.trim().startsWith('Home'));
|
||
|
|
if (target) target.click();
|
||
|
|
});
|
||
|
|
await page.waitForTimeout(2000);
|
||
|
|
|
||
|
|
// Click Downloads card
|
||
|
|
await page.evaluate(() => {
|
||
|
|
const cards = Array.from(document.querySelectorAll('*'));
|
||
|
|
const dlCard = cards.find(el => el.innerText && el.innerText.includes('Downloads') && el.innerText.includes('Plugin · Dragon-ISO'));
|
||
|
|
if (dlCard) dlCard.click();
|
||
|
|
});
|
||
|
|
await page.waitForTimeout(2000);
|
||
|
|
|
||
|
|
await page.screenshot({ path: path.join(OUT_DIR, '20b-downloads-modal.png'), fullPage: false });
|
||
|
|
console.log('Saved: 20b-downloads-modal.png');
|
||
|
|
|
||
|
|
await browser.close();
|
||
|
|
})();
|