import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1600, height: 900 } });
page.on('pageerror', (e) => console.log('PAGEERROR', e.message));
await page.goto('http://localhost:5199/');
await page.waitForSelector('#btn-new');
await page.evaluate(() => localStorage.clear());
await page.click('#btn-new');
await page.waitForTimeout(400);
await page.keyboard.down('ArrowUp');
await page.waitForTimeout(1400);
await page.keyboard.up('ArrowUp');
await page.keyboard.down('ArrowLeft');
await page.waitForTimeout(700);
await page.keyboard.up('ArrowLeft');
await page.waitForTimeout(2500); // let smoke puffs accumulate
await page.screenshot({ path: '/tmp/p6-house.png' });
// pond view
await page.keyboard.down('ArrowRight');
await page.waitForTimeout(2800);
await page.keyboard.up('ArrowRight');
await page.waitForTimeout(1200);
await page.screenshot({ path: '/tmp/p7-pond.png' });
await browser.close();
