-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_scoring.mjs
More file actions
28 lines (22 loc) · 872 Bytes
/
test_scoring.mjs
File metadata and controls
28 lines (22 loc) · 872 Bytes
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
import puppeteer from 'puppeteer';
import fs from 'fs';
import path from 'path';
(async () => {
const browser = await puppeteer.launch({
headless: "new"
});
const page = await browser.newPage();
await page.setViewport({ width: 1440, height: 900 });
console.log('Navigating to game...');
await page.goto('http://localhost:3000');
await page.waitForSelector('#instruction-overlay');
console.log('Uploading test.mid...');
const fileInput = await page.$('#midi-upload');
await fileInput.uploadFile('./test.mid');
console.log('Waiting 5 seconds for notes to fall and miss...');
await new Promise(r => setTimeout(r, 5000));
console.log('Capturing screenshot...');
await page.screenshot({ path: '../temporary_screenshots/screenshot-gameplay.png' });
await browser.close();
console.log('Done.');
})();