From d48ddeee0e2c6ad8bfdb3d63d8738224d9d407e9 Mon Sep 17 00:00:00 2001 From: osohyun0224 <53892427+osohyun0224@users.noreply.github.com> Date: Mon, 16 Sep 2024 23:10:46 +0900 Subject: [PATCH] fix :: try to error log with try-catch --- tests/playwright-test/test-step.spec.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/playwright-test/test-step.spec.ts b/tests/playwright-test/test-step.spec.ts index cc48a5bb02..b040dff233 100644 --- a/tests/playwright-test/test-step.spec.ts +++ b/tests/playwright-test/test-step.spec.ts @@ -1261,10 +1261,11 @@ test('test with custom location', async ({ runInlineTest }) => { }; `, 'a.test.ts': ` - import { test } from '@playwright/test'; - import { customStep } from './helper'; + import { test, expect } from '@playwright/test'; + import { customStep } from './helper'; - test('test with custom location', async ({ page }) => { + test('test with custom location', async ({ page }) => { + try { await customStep(test, 'User logs in', async () => { await page.goto('http://localhost:1234/login'); await page.fill('input#username', 'testuser'); @@ -1274,8 +1275,12 @@ test('test with custom location', async ({ runInlineTest }) => { const profileVisible = await page.isVisible('.profile'); expect(profileVisible).toBeTruthy(); }); - }); - ` + } catch (e) { + console.error('Login test failed:', e); + throw e; + } + }); + ` }, { reporter: '', workers: 1 }); expect(result.exitCode).toBe(0);