From df10a64a1d2fc8ebc1d79b081d6830f5f343918a Mon Sep 17 00:00:00 2001 From: Bradley Dwyer Date: Thu, 28 Nov 2024 11:42:31 +1000 Subject: [PATCH] thrown error not always caught by test harness --- frontend/console/e2e/cron.spec.ts | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/frontend/console/e2e/cron.spec.ts b/frontend/console/e2e/cron.spec.ts index 4b5bcac03..d86da6858 100644 --- a/frontend/console/e2e/cron.spec.ts +++ b/frontend/console/e2e/cron.spec.ts @@ -36,19 +36,16 @@ test('submit cron form using ⌘+⏎ shortcut', async ({ page }) => { await page.keyboard.press('ControlOrMeta+Enter') const responseEditor = page.locator('#response-editor .cm-content[role="textbox"]') await expect(responseEditor).toBeVisible() + + const responseText = await responseEditor.textContent() + const responseJson = JSON.parse(responseText?.trim() || '{}') + + expect(responseJson).toEqual({}) break } catch (error) { if (attempt === 2) throw error } } - - const responseEditor = page.locator('#response-editor .cm-content[role="textbox"]') - await expect(responseEditor).toBeVisible() - - const responseText = await responseEditor.textContent() - const responseJson = JSON.parse(responseText?.trim() || '{}') - - expect(responseJson).toEqual({}) }) test('submit cron form using ⌘+⏎ shortcut without focusing first', async ({ page }) => { @@ -60,17 +57,13 @@ test('submit cron form using ⌘+⏎ shortcut without focusing first', async ({ await page.keyboard.press('ControlOrMeta+Enter') const responseEditor = page.locator('#response-editor .cm-content[role="textbox"]') await expect(responseEditor).toBeVisible() + const responseText = await responseEditor.textContent() + const responseJson = JSON.parse(responseText?.trim() || '{}') + + expect(responseJson).toEqual({}) break } catch (error) { if (attempt === 2) throw error } } - - const responseEditor = page.locator('#response-editor .cm-content[role="textbox"]') - await expect(responseEditor).toBeVisible() - - const responseText = await responseEditor.textContent() - const responseJson = JSON.parse(responseText?.trim() || '{}') - - expect(responseJson).toEqual({}) })