Dev console: name suggestions, materials list, history, Tab completion, help, clear (t94)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 23:35:42 -04:00
co-authored by Claude Opus 5.5
parent 780216b174
commit 1db265a018
8 changed files with 210 additions and 39 deletions
+28
View File
@@ -59,6 +59,31 @@ with launch() as (browser, page, url):
tick = page.evaluate('tick')
page.wait_for_timeout(150)
check('dev pause freezes simulation ticks', page.evaluate('tick') == tick)
position = page.evaluate("[bot.x, bot.y, bot.lamp, GAME.tool, $('bagpanel').hidden]")
page.fill('#dev-input', 'give copper')
page.keyboard.press('Tab')
first = page.input_value('#dev-input')
page.keyboard.press('Tab')
check('Tab completes spaced material names and cycles matches', first.startswith('give Copper') and first != page.input_value('#dev-input') and 'Matches:' in page.inner_text('#dev-output'))
page.keyboard.press('ArrowUp')
check('Up recalls the newest submitted command', page.input_value('#dev-input') == 'pause')
page.keyboard.press('ArrowDown')
check('Down beyond newest returns an empty input', page.input_value('#dev-input') == '')
page.keyboard.press('Control+l')
check('Ctrl+L clears output and keeps console focus', page.evaluate("$('dev-output').children.length === 0 && document.activeElement === $('dev-input')"))
page.wait_for_timeout(100)
check('Tab, arrows and Ctrl+L leave bot and game controls alone', page.evaluate("[bot.x, bot.y, bot.lamp, GAME.tool, $('bagpanel').hidden]") == position and page.evaluate('keys.size === 0 && !GAME.ctrl'))
command('materials copperore')
command('help give')
command('give coperore')
check('errors are red while results use normal colour', page.evaluate('''() => {
const rows = $('dev-output').children, error = rows[rows.length - 1];
return error.classList.contains('dev-error') && getComputedStyle(error).color === 'rgb(239, 106, 85)' && getComputedStyle(error).color !== getComputedStyle(rows[0]).color;
}'''))
page.screenshot(path=str(SHOTS / 't94-console.png'))
command('clear')
check('clear command empties output', page.evaluate("$('dev-output').children.length === 0"))
check('submitted history is stored across sessions', page.evaluate("JSON.parse(localStorage.getItem('deepgrain.consoleHistory')).slice(-1)[0] === 'clear'"))
command('step 5')
page.wait_for_function(f'tick === {tick + 5} && devSteps === 0')
page.wait_for_timeout(150)
@@ -93,6 +118,9 @@ with launch() as (browser, page, url):
await startFromSave(sv);
return devWorld && devLog.length === count && devSpeed === 1 && !devPaused && !devFree && $('dev-console').hidden;
}'''))
page.reload()
page.wait_for_function("!$('title').hidden")
check('history is restored on a fresh page', page.evaluate("devInputHistory.items.slice(-1)[0] === 'step 5' && devRecall(devInputHistory, -1) === 'step 5'"))
check('no browser errors', not errors)
browser.close()