diff --git a/frontend/src/components/App/index.module.css b/frontend/src/components/App/index.module.css index 1c3142b..82173ba 100644 --- a/frontend/src/components/App/index.module.css +++ b/frontend/src/components/App/index.module.css @@ -9,5 +9,6 @@ .editorColumn { min-height: 500px; height: auto; + flex: none; } } diff --git a/frontend/src/components/App/index.spec.tsx b/frontend/src/components/App/index.spec.tsx index 3b489a6..b2e4332 100644 --- a/frontend/src/components/App/index.spec.tsx +++ b/frontend/src/components/App/index.spec.tsx @@ -1,8 +1,10 @@ import { test, expect } from '@playwright/experimental-ct-react'; +import type { MountResult } from '@playwright/experimental-ct-react'; +import type { Page } from 'playwright/test'; import App from '.'; import CodeContextProvider from '../CodeContext'; -test('desktop layout fills the viewport in two aligned columns', async ({ mount, page }) => { +async function mountApp(mount: (component: React.ReactElement) => Promise, page: Page) { await page.addStyleTag({ content: 'html, body, #root { height: 100%; margin: 0; }' }); await page.setViewportSize({ width: 1440, height: 900 }); await mount( @@ -10,6 +12,10 @@ test('desktop layout fills the viewport in two aligned columns', async ({ mount, ); +} + +test('desktop layout fills the viewport in two aligned columns', async ({ mount, page }) => { + await mountApp(mount, page); const main = page.getByTestId('app-main'); const editor = page.getByTestId('app-editor-column'); @@ -30,4 +36,29 @@ test('desktop layout fills the viewport in two aligned columns', async ({ mount, expect(Math.abs(editorBox!.width - examplesBox!.width)).toBeLessThan(24); expect(Math.abs(editorBox!.y - examplesBox!.y)).toBeLessThan(8); expect(editorBox!.x + editorBox!.width).toBeLessThanOrEqual(examplesBox!.x + 2); + expect(editorBox!.height).toBeGreaterThan(viewport.height * 0.7); + expect(Math.abs(editorBox!.height - examplesBox!.height)).toBeLessThan(8); +}); + +test('editor column stays full height after a short output error', async ({ mount, page }) => { + await page.route('**/service/control/run', async (route) => { + await route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ error: 'Error: Could not complete bot check. Please try again.' }), + }); + }); + await mountApp(mount, page); + + const viewport = page.viewportSize()!; + await page.getByRole('button', { name: 'Run' }).click(); + await expect(page.getByText('Could not complete bot check')).toBeVisible(); + + const editorBox = await page.getByTestId('app-editor-column').boundingBox(); + const outputBox = await page.getByTestId('app-examples-column').boundingBox(); + expect(editorBox).toBeTruthy(); + expect(outputBox).toBeTruthy(); + expect(editorBox!.height).toBeGreaterThan(viewport.height * 0.7); + expect(outputBox!.height).toBeGreaterThan(viewport.height * 0.7); + expect(Math.abs(editorBox!.height - outputBox!.height)).toBeLessThan(8); }); diff --git a/frontend/src/components/App/index.tsx b/frontend/src/components/App/index.tsx index 9be9bbf..d16559d 100644 --- a/frontend/src/components/App/index.tsx +++ b/frontend/src/components/App/index.tsx @@ -83,14 +83,16 @@ const App: React.FunctionComponent = () => {
- - - - + + + + {loading && } { - + diff --git a/frontend/src/components/RightPanel/index.tsx b/frontend/src/components/RightPanel/index.tsx index 8302891..b3a7997 100644 --- a/frontend/src/components/RightPanel/index.tsx +++ b/frontend/src/components/RightPanel/index.tsx @@ -24,7 +24,9 @@ const RightPanel: React.FunctionComponent = ({ resp }) => { return (