Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions scripts/smoke-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,44 @@ async function selectTerminalText(cdp, sessionId, targetText = 'Compilation succ
return { ...selection, before, paintBounds: paint.bounds, paint };
}

async function dragTerminalHeader(cdp, sessionId, deltaY) {
const start = await evaluate(cdp, sessionId, `(() => {
const header = document.getElementById('terminal-panel-header');
const panel = document.getElementById('terminal-panel');
const container = document.getElementById('terminal-container');
if (!header || !panel || !container) return null;
const headerRect = header.getBoundingClientRect();
return {
x: headerRect.left + (headerRect.width * 0.25),
y: headerRect.top + (headerRect.height / 2),
panelHeight: panel.getBoundingClientRect().height,
containerHeight: container.getBoundingClientRect().height,
};
})()`);
assert(start, 'Terminal resize controls did not render');

const endY = start.y + deltaY;
await cdp.send('Input.dispatchMouseEvent', {
type: 'mousePressed', x: start.x, y: start.y, button: 'left', buttons: 1, clickCount: 1,
}, sessionId);
await cdp.send('Input.dispatchMouseEvent', {
type: 'mouseMoved', x: start.x, y: endY, button: 'left', buttons: 1,
}, sessionId);
await cdp.send('Input.dispatchMouseEvent', {
type: 'mouseReleased', x: start.x, y: endY, button: 'left', buttons: 0, clickCount: 1,
}, sessionId);

return evaluate(cdp, sessionId, `(() => {
const panel = document.getElementById('terminal-panel');
const container = document.getElementById('terminal-container');
return {
before: ${JSON.stringify(start)},
panelHeight: panel?.getBoundingClientRect().height ?? null,
containerHeight: container?.getBoundingClientRect().height ?? null,
};
})()`);
}

async function captureScreenshot(cdp, sessionId) {
const { data } = await cdp.send('Page.captureScreenshot', {
format: 'png',
Expand Down Expand Up @@ -946,6 +984,24 @@ int main() {
const hasEditor = await evaluate(cdp, sessionId, `!!document.querySelector('.monaco-editor')`);
assert(hasEditor, 'Monaco editor did not render');

const grownTerminal = await dragTerminalHeader(cdp, sessionId, -60);
assert(grownTerminal.panelHeight > grownTerminal.before.panelHeight,
`Dragging the terminal header up did not grow the panel: ${JSON.stringify(grownTerminal)}`);
assert(grownTerminal.containerHeight > grownTerminal.before.containerHeight,
`Dragging the terminal header up did not grow the terminal content: ${JSON.stringify(grownTerminal)}`);

const shrunkTerminal = await dragTerminalHeader(cdp, sessionId, 120);
assert(shrunkTerminal.panelHeight < shrunkTerminal.before.panelHeight,
`Dragging the terminal header down did not shrink the panel: ${JSON.stringify(shrunkTerminal)}`);
assert(shrunkTerminal.containerHeight < shrunkTerminal.before.containerHeight,
`Dragging the terminal header down did not shrink the terminal content: ${JSON.stringify(shrunkTerminal)}`);

if (process.env.BROWSER_SMOKE_ONLY === 'terminal-resize') {
console.log(`Terminal resize drag smoke passed: ${JSON.stringify({ grownTerminal, shrunkTerminal })}`);
server.close();
return { sessionId, capabilities, createdFileText: null, terminalText: '' };
}

if (!realRun) {
const settingsDefault = await evaluate(cdp, sessionId, `(() => {
const button = document.getElementById('btn-settings');
Expand Down
Loading