-
Notifications
You must be signed in to change notification settings - Fork 0
feat(web): 手持ち PDF 経歴書のフォーム流し込み UI と注入機構(ADR-0024 / #524・#528) #539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| import { expect, test, type Page } from "@playwright/test"; | ||
|
|
||
| import { RESUME_IMPORT_MESSAGES } from "../src/constants/messages"; | ||
| import { setupAuth, waitForAuthenticatedLayout } from "./helpers/auth"; | ||
|
|
||
| /** | ||
| * 手持ち PDF 経歴書のフォーム流し込み(ADR-0024 / #528)E2E。 | ||
| * | ||
| * シナリオ: | ||
| * 1. 空フォームの新規ユーザは「PDF から自動入力」パネルを見る | ||
| * 2. PDF をアップロード(POST /api/agent/resume-import/pdf をモック) | ||
| * 3. 抽出結果がフォーム(氏名・職務要約・自己PR)に反映される(DB 非更新) | ||
| * 4. 反映成功のトーストが出る | ||
| */ | ||
|
|
||
| /** 職務経歴書の最小 API モック。latest は 404 = 空フォーム(パネルが出る条件)。 */ | ||
| async function setupEmptyResume(page: Page) { | ||
| await page.route("**/api/master-data/qualification", (route) => | ||
| route.fulfill({ status: 200, contentType: "application/json", body: "[]" }), | ||
| ); | ||
| await page.route("**/api/master-data/technology-stack", (route) => | ||
| route.fulfill({ status: 200, contentType: "application/json", body: "[]" }), | ||
| ); | ||
| await page.route("**/api/resumes/latest", (route) => | ||
| route.fulfill({ | ||
| status: 404, | ||
| contentType: "application/json", | ||
| body: JSON.stringify({ code: "NOT_FOUND", message: "not found" }), | ||
| }), | ||
| ); | ||
| } | ||
|
|
||
| test.describe("PDF 経歴書インポート", () => { | ||
| test.beforeEach(async ({ page }) => { | ||
| await setupAuth(page); | ||
| await setupEmptyResume(page); | ||
| }); | ||
|
|
||
| test("空フォームで PDF をアップロードすると抽出結果が反映される", async ({ page }) => { | ||
| await page.route("**/api/agent/resume-import/pdf", async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: "application/json", | ||
| body: JSON.stringify({ | ||
| full_name: "山田 太郎", | ||
| career_summary: "バックエンドエンジニアとして 5 年の経験があります。", | ||
| self_pr: "品質と保守性を重視した設計が得意です。", | ||
| experiences: [ | ||
| { | ||
| company: "株式会社サンプル", | ||
| business_description: "受託開発", | ||
| start_date: "2020-04", | ||
| end_date: "2023-03", | ||
| description: "API 開発を担当。", | ||
| }, | ||
| ], | ||
| }), | ||
| }); | ||
| }); | ||
|
|
||
| await page.goto("/career"); | ||
| await waitForAuthenticatedLayout(page); | ||
|
|
||
| // 空フォームの新規ユーザにパネルが見える | ||
| await expect(page.getByText(RESUME_IMPORT_MESSAGES.HEADING)).toBeVisible(); | ||
|
|
||
| // 隠しファイル input に PDF を投入する(マジックバイト付きのダミー) | ||
| await page | ||
| .getByLabel(RESUME_IMPORT_MESSAGES.UPLOAD_LABEL) | ||
| .setInputFiles({ | ||
| name: "resume.pdf", | ||
| mimeType: "application/pdf", | ||
| buffer: Buffer.from("%PDF-1.7\n...dummy..."), | ||
| }); | ||
|
|
||
| // 抽出結果がフォームへ反映される(空フォームなので確認ダイアログは出ない) | ||
| await expect(page.getByText(RESUME_IMPORT_MESSAGES.APPLIED_TOAST)).toBeVisible(); | ||
| // 氏名入力に抽出値が入る | ||
| await expect(page.getByPlaceholder("例: 山田 太郎")).toHaveValue("山田 太郎"); | ||
| }); | ||
|
|
||
| test("非対応 PDF(スキャン)はエラーメッセージを表示する", async ({ page }) => { | ||
| await page.route("**/api/agent/resume-import/pdf", async (route) => { | ||
| await route.fulfill({ | ||
| status: 422, | ||
| contentType: "application/json", | ||
| body: JSON.stringify({ | ||
| code: "VALIDATION_ERROR", | ||
| message: "テキストを含む PDF のみ対応しています。スキャン画像の PDF は読み取れないため、お手数ですが手入力をお願いします。", | ||
| }), | ||
| }); | ||
| }); | ||
|
|
||
| await page.goto("/career"); | ||
| await waitForAuthenticatedLayout(page); | ||
|
|
||
| await page | ||
| .getByLabel(RESUME_IMPORT_MESSAGES.UPLOAD_LABEL) | ||
| .setInputFiles({ | ||
| name: "scan.pdf", | ||
| mimeType: "application/pdf", | ||
| buffer: Buffer.from("%PDF-1.7\n...scan..."), | ||
| }); | ||
|
|
||
| await expect(page.getByText(/テキストを含む PDF のみ対応/)).toBeVisible(); | ||
|
Check failure on line 105 in web/e2e/resume-import.spec.ts
|
||
| }); | ||
| }); | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| .panel { | ||
| border: 1px solid var(--color-border, #d0d7de); | ||
| border-radius: 8px; | ||
| padding: 16px; | ||
| margin-bottom: 16px; | ||
| background: var(--color-surface, #fff); | ||
| } | ||
|
|
||
| .header { | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| .title { | ||
| font-size: 1rem; | ||
| font-weight: 600; | ||
| margin: 0; | ||
| } | ||
|
|
||
| .hint { | ||
| font-size: 0.85rem; | ||
| color: var(--color-text-muted, #57606a); | ||
| margin: 8px 0 12px; | ||
| line-height: 1.6; | ||
| } | ||
|
|
||
| .dropzone { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| justify-content: center; | ||
| gap: 6px; | ||
| padding: 24px 16px; | ||
| border: 2px dashed var(--color-border, #d0d7de); | ||
| border-radius: 8px; | ||
| cursor: pointer; | ||
| text-align: center; | ||
| transition: border-color 0.15s, background 0.15s; | ||
| } | ||
|
|
||
| .dropzone:hover, | ||
| .dragOver { | ||
| border-color: var(--color-accent, #0969da); | ||
| background: var(--color-accent-subtle, rgba(9, 105, 218, 0.06)); | ||
| } | ||
|
|
||
| .dropzone[aria-disabled="true"] { | ||
| cursor: progress; | ||
| opacity: 0.7; | ||
| } | ||
|
|
||
| .dropHint { | ||
| font-size: 0.85rem; | ||
| color: var(--color-text-muted, #57606a); | ||
| } | ||
|
|
||
| .uploadLabel { | ||
| font-size: 0.9rem; | ||
| font-weight: 600; | ||
| color: var(--color-accent, #0969da); | ||
| } | ||
|
|
||
| .importing { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| gap: 8px; | ||
| font-size: 0.9rem; | ||
| color: var(--color-text-muted, #57606a); | ||
| } | ||
|
|
||
| .fileInput { | ||
| display: none; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.