Download source/scripts/shots.mjs from WilburDev/earshelf: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/WilburDev/earshelf/resolve/main/source/scripts/shots.mjs
- Command line
-
hf download hf://spaces/WilburDev/earshelf/source/scripts/shots.mjs
-
curl -L -o shots.mjs https://huggingface.co/spaces/WilburDev/earshelf/resolve/main/source/scripts/shots.mjs
1.34 kB
| import { chromium } from '@playwright/test'; | |
| const out = process.argv[2]; | |
| const b = await chromium.launch({ channel: 'chrome' }); | |
| for (const [name, vp, scheme] of [['desk', { width: 1280, height: 800 }, 'light'], ['phone', { width: 360, height: 740 }, 'light'], ['phone-dark', { width: 360, height: 740 }, 'dark'], ['land', { width: 667, height: 320 }, 'light']]) { | |
| const ctx = await b.newContext({ viewport: vp, colorScheme: scheme, deviceScaleFactor: 2 }); | |
| const p = await ctx.newPage(); | |
| await p.addInitScript(() => localStorage.setItem('earshelf.noWarm', '1')); | |
| await p.goto('http://localhost:4175/'); | |
| await p.screenshot({ path: `${out}/${name}-1-empty.png` }); | |
| await p.setInputFiles('#file', 'tests/fixtures/lighthouse.epub'); | |
| await p.waitForSelector('#player:not([hidden])'); | |
| await p.click('#play').catch(() => {}); | |
| await p.locator('.s').nth(2).click(); | |
| await p.waitForTimeout(400); | |
| await p.screenshot({ path: `${out}/${name}-2-player.png` }); | |
| await p.click('#voice-btn'); | |
| await p.waitForTimeout(300); | |
| await p.screenshot({ path: `${out}/${name}-3-voice.png` }); | |
| await p.keyboard.press('Escape'); | |
| await p.click('#back'); | |
| await p.click('#sample'); | |
| await p.click('#back'); | |
| await p.waitForTimeout(300); | |
| await p.screenshot({ path: `${out}/${name}-4-shelf.png` }); | |
| await ctx.close(); | |
| } | |
| await b.close(); | |