diff --git a/tests/e2e/contact-submit.spec.ts b/tests/e2e/contact-submit.spec.ts index e965086..af7d71d 100644 --- a/tests/e2e/contact-submit.spec.ts +++ b/tests/e2e/contact-submit.spec.ts @@ -6,7 +6,26 @@ const password = process.env.E2E_ADMIN_PASSWORD; const baseUrl = (process.env.E2E_BASE_URL ?? 'http://178.104.200.7/taxbaik').replace(/\/$/, ''); test.describe('contact submit', () => { + test('creates an inquiry through the public API', async ({ request }) => { + const stamp = Date.now(); + + const createResponse = await request.post(`${baseUrl}/api/inquiry`, { + data: { + name: `Public-${stamp}`, + phone: '010-1234-5678', + email: `public-${stamp}@example.com`, + serviceType: '기타', + message: 'Playwright로 전송한 공개 문의 테스트입니다.', + }, + }); + expect(createResponse.ok()).toBeTruthy(); + const createBody = await createResponse.json(); + expect(createBody.message).toContain('상담 신청이 접수되었습니다'); + }); + test('creates an inquiry and shows it in admin list', async ({ page, request }) => { + test.skip(!password, 'E2E_ADMIN_PASSWORD is required to verify the admin list.'); + const stamp = Date.now(); const name = `E2E-${stamp}`; const phone = '010-1234-5678'; @@ -23,10 +42,6 @@ test.describe('contact submit', () => { }, }); expect(createResponse.ok()).toBeTruthy(); - const createBody = await createResponse.json(); - expect(createBody.message).toContain('상담 신청이 접수되었습니다'); - - test.skip(!password, 'E2E_ADMIN_PASSWORD is required to verify the admin list.'); const token = await getAdminToken(request, baseUrl, username, password); await installAdminToken(page, token);