feat(frontend): edit projects and show semantic match evidence
This commit is contained in:
1 parent
5a731c25b7
commit
bc00d6901f
52 files changed
+2992
-111
No files matched your search
@@ -228,7 +228,7 @@ async function saveProfile(candidate: Candidate): Promise<void> {
|
||||
await page.getByLabel("Имя и фамилия").fill(candidate.fullName);
|
||||
await page.getByLabel("Контактный email").fill(candidate.email);
|
||||
await page.getByLabel("Телефон").fill(candidate.phone);
|
||||
for (const heading of ["Роли", "Опыт", "Навыки", "Условия", "Проверка"]) {
|
||||
for (const heading of ["Роли", "Опыт", "Проекты", "Навыки", "Условия", "Проверка"]) {
|
||||
await page.getByRole("button", { name: "Далее", exact: true }).click();
|
||||
await expect(page.getByRole("heading", { name: new RegExp(`\\. ${heading}$`) })).toBeFocused();
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ test.describe("candidate home with the real backend", () => {
|
||||
await expect(page.getByRole("heading", { name: "Профиль", level: 1 })).toBeVisible();
|
||||
await page.getByLabel("Имя и фамилия").fill("Тестовый кандидат");
|
||||
// The profile is a form in steps: walk to the review step, then save.
|
||||
for (const heading of ["Роли", "Опыт", "Навыки", "Условия", "Проверка"]) {
|
||||
for (const heading of ["Роли", "Опыт", "Проекты", "Навыки", "Условия", "Проверка"]) {
|
||||
await page.getByRole("button", { name: "Далее", exact: true }).click();
|
||||
await expect(
|
||||
page.getByRole("heading", { name: new RegExp(`\\. ${heading}$`) }),
|
||||
|
||||
@@ -489,6 +489,25 @@ const noContext = {
|
||||
salary_compatibility: null,
|
||||
};
|
||||
|
||||
const semanticEvidence = [
|
||||
{
|
||||
requirement_kind: "task",
|
||||
requirement_text: "Разработать сервис сверки платежей",
|
||||
item_kind: "project",
|
||||
project_title: "Платежный шлюз",
|
||||
repository_verified: true,
|
||||
similarity: "high",
|
||||
},
|
||||
{
|
||||
requirement_kind: "required_skill",
|
||||
requirement_text: "Проектирование схем PostgreSQL",
|
||||
item_kind: "stack",
|
||||
project_title: null,
|
||||
repository_verified: false,
|
||||
similarity: "medium",
|
||||
},
|
||||
];
|
||||
|
||||
function confirmedEntry(handle: string, grade: string, coverage: number, overrides = {}) {
|
||||
return {
|
||||
candidate_handle: handle,
|
||||
@@ -899,6 +918,71 @@ test.describe("employer candidate search with a stubbed API", () => {
|
||||
await expect(network.getByText("Пробел: подтверждения нет")).toBeVisible();
|
||||
});
|
||||
|
||||
test("explains the matches by meaning without a repository address", async ({ page }) => {
|
||||
const entry = confirmedEntry(handleA, "middle", 0.853333, {
|
||||
semantic_evidence: semanticEvidence,
|
||||
unknown_flags: [{ component: "percentile", reason: "cohort_below_30" }],
|
||||
});
|
||||
const card = {
|
||||
pseudonym: handleA,
|
||||
categories: null,
|
||||
stack: ["go"],
|
||||
self_assessment: null,
|
||||
experience_band: null,
|
||||
work_formats: null,
|
||||
salary_compatibility: null,
|
||||
projects: [
|
||||
{
|
||||
title: "Платежный шлюз",
|
||||
description: "Проводки и сверки платежей.",
|
||||
stack: ["Go", "PostgreSQL"],
|
||||
repository_verified: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
await installFakeApi(page, {
|
||||
searches: [threeGroups({ groups: { main: [entry], near: [], unconfirmed: [] } })],
|
||||
card,
|
||||
});
|
||||
await openSearch(page);
|
||||
await runSearch(page);
|
||||
|
||||
const confirmed = groupSection(page, "Подтвержденные").getByRole("article");
|
||||
const why = confirmed.getByRole("region", { name: "Почему в подборке" });
|
||||
await expect(why.getByRole("heading", { name: "Совпадения по смыслу" })).toBeVisible();
|
||||
const rows = why.getByRole("listitem").filter({ hasText: "сходство" });
|
||||
await expect(rows).toHaveCount(2);
|
||||
await expect(rows.nth(0)).toContainText("Разработать сервис сверки платежей");
|
||||
await expect(rows.nth(0)).toContainText("Проект");
|
||||
await expect(rows.nth(0)).toContainText("Платежный шлюз");
|
||||
await expect(rows.nth(0)).toContainText("Высокое сходство");
|
||||
await expect(rows.nth(0)).toContainText("Публичный репозиторий");
|
||||
await expect(rows.nth(1)).toContainText("Стек");
|
||||
await expect(rows.nth(1)).toContainText("Среднее сходство");
|
||||
await expect(rows.nth(1)).not.toContainText("Публичный репозиторий");
|
||||
await expect(why.getByText("смысловой анализ недоступен")).toHaveCount(0);
|
||||
await expect(confirmed.locator('a[href*="github"]')).toHaveCount(0);
|
||||
await expectNoHorizontalOverflow(page);
|
||||
|
||||
await confirmed.getByRole("button", { name: /Открыть карточку/ }).click();
|
||||
const panel = confirmed.getByRole("region", { name: "Карточка кандидата" });
|
||||
await expect(panel.getByRole("heading", { name: "Проекты" })).toBeVisible();
|
||||
await expect(panel.getByText("Подтвержден публичным репозиторием")).toBeVisible();
|
||||
expect(await panel.innerText()).not.toMatch(/github\.com/);
|
||||
await captureReview(page, "match-semantic-evidence");
|
||||
});
|
||||
|
||||
test("keeps the unavailable wording in the meaning block when ML was down", async ({ page }) => {
|
||||
await installFakeApi(page);
|
||||
await openSearch(page);
|
||||
await runSearch(page);
|
||||
|
||||
const why = groupSection(page, "Подтвержденные")
|
||||
.getByRole("article")
|
||||
.getByRole("region", { name: "Почему в подборке" });
|
||||
await expect(why.getByText("Совпадения по смыслу: смысловой анализ недоступен.")).toBeVisible();
|
||||
});
|
||||
|
||||
test("explains a partial output without a count", async ({ page }) => {
|
||||
await installFakeApi(page, { searches: [threeGroups({ truncated: true })] });
|
||||
await openSearch(page);
|
||||
|
||||
@@ -403,7 +403,7 @@ test.describe("candidate without a confirmed grade with the real backend", () =>
|
||||
await page.getByLabel("Специализация").nth(1).selectOption("network_engineer");
|
||||
await page.getByLabel("Моя оценка уровня").nth(0).selectOption("middle");
|
||||
await page.getByLabel("Моя оценка уровня").nth(1).selectOption("junior");
|
||||
for (const heading of ["Опыт", "Навыки", "Условия", "Проверка"]) {
|
||||
for (const heading of ["Опыт", "Проекты", "Навыки", "Условия", "Проверка"]) {
|
||||
await page.getByRole("button", { name: "Далее", exact: true }).click();
|
||||
await expect(
|
||||
page.getByRole("heading", { name: new RegExp(`\\. ${heading}$`) }),
|
||||
@@ -598,7 +598,17 @@ function previewFor(state: FakeState): Record<string, unknown> {
|
||||
experience_band: null,
|
||||
work_formats: null,
|
||||
salary_compatibility: null,
|
||||
projects: null,
|
||||
projects: fields.includes("projects")
|
||||
? [
|
||||
{
|
||||
title: "Платежный шлюз",
|
||||
description: "Проводки и сверки платежей.",
|
||||
stack: ["Go", "PostgreSQL"],
|
||||
repository_verified: true,
|
||||
},
|
||||
{ title: "Каталог", description: null, stack: [], repository_verified: false },
|
||||
]
|
||||
: null,
|
||||
},
|
||||
evidence: fields.includes("categories")
|
||||
? {
|
||||
@@ -795,6 +805,43 @@ test.describe("candidate visibility states with a stubbed API", () => {
|
||||
await expectNoHorizontalOverflow(page);
|
||||
});
|
||||
|
||||
test("warns before the projects are published and shows them in the preview without an address", async ({
|
||||
page,
|
||||
}) => {
|
||||
const state = freshState({
|
||||
publication: {
|
||||
state: "published",
|
||||
closed_reason: null,
|
||||
fields: ["categories", "projects"],
|
||||
consent_id: c2RecordId,
|
||||
published_at: "2026-10-08T10:00:00Z",
|
||||
version: 1,
|
||||
},
|
||||
});
|
||||
await installFakeApi(page, state);
|
||||
await page.goto("/candidate/privacy");
|
||||
|
||||
const publication = page.getByRole("region", { name: "Публикация карточки", exact: true });
|
||||
const projects = publication.getByRole("checkbox", {
|
||||
name: "Проекты: название, описание и технологии",
|
||||
});
|
||||
await expect(projects).toBeChecked();
|
||||
await expect(publication.getByText(/по ним вас могут узнать/)).toBeVisible();
|
||||
await expect(
|
||||
publication.getByText(/Адрес репозитория и его владелец компаниям не показываются никогда/),
|
||||
).toBeVisible();
|
||||
|
||||
const preview = previewSection(page);
|
||||
await expect(preview.getByRole("heading", { name: "Проекты" })).toBeVisible();
|
||||
await expect(preview.getByText("Платежный шлюз")).toBeVisible();
|
||||
await expect(preview.getByText("PostgreSQL", { exact: true })).toBeVisible();
|
||||
await expect(preview.getByText("Подтвержден публичным репозиторием")).toHaveCount(1);
|
||||
await expect(preview.locator('a[href*="github"]')).toHaveCount(0);
|
||||
await expect(preview.getByText(/github\.com/)).toHaveCount(0);
|
||||
await captureReview(page, "privacy-projects");
|
||||
await expectNoHorizontalOverflow(page);
|
||||
});
|
||||
|
||||
test("a changed search status never publishes the card", async ({ page }) => {
|
||||
const state = freshState();
|
||||
await installFakeApi(page, state);
|
||||
|
||||
@@ -130,7 +130,7 @@ test.describe("candidate profile", () => {
|
||||
await expect(page.getByRole("heading", { name: /\. Проверка$/ })).toBeFocused();
|
||||
return;
|
||||
}
|
||||
for (const heading of ["Роли", "Опыт", "Навыки", "Условия", "Проверка"]) {
|
||||
for (const heading of ["Роли", "Опыт", "Проекты", "Навыки", "Условия", "Проверка"]) {
|
||||
if (await save.isVisible()) break;
|
||||
await nextStep(page, heading);
|
||||
}
|
||||
@@ -201,6 +201,7 @@ test.describe("candidate profile", () => {
|
||||
}) => {
|
||||
const suffix = crypto.randomUUID().slice(0, 8);
|
||||
const name = `Тестовый профиль ${suffix}`;
|
||||
const projectTitle = `Платежный шлюз ${suffix}`;
|
||||
const contactEmail = `contact-${suffix}@example.test`;
|
||||
const { email } = await registerCandidate(page);
|
||||
|
||||
@@ -211,7 +212,7 @@ test.describe("candidate profile", () => {
|
||||
await page.getByLabel("Телефон").fill("+79990000000");
|
||||
await page.getByLabel("Telegram").fill("@candidate_123");
|
||||
|
||||
await expect(page.getByText("Шаг 1 из 6", { exact: true })).toBeVisible();
|
||||
await expect(page.getByText("Шаг 1 из 7", { exact: true })).toBeVisible();
|
||||
await nextStep(page, "Роли");
|
||||
await page.getByRole("button", { name: "Добавить специализацию" }).click();
|
||||
await page.getByLabel("Специализация").selectOption("backend");
|
||||
@@ -236,6 +237,23 @@ test.describe("candidate profile", () => {
|
||||
).toBeFocused();
|
||||
await page.getByRole("checkbox", { name: /Подтверждаю, что места работы 1 и 2/ }).check();
|
||||
|
||||
await nextStep(page, "Проекты");
|
||||
await page.getByRole("button", { name: "Добавить проект" }).click();
|
||||
await page.getByLabel("Название", { exact: true }).fill(projectTitle);
|
||||
await page.getByLabel("Что делает проект и что делали вы").fill("Проводки и сверки платежей.");
|
||||
const projectTags = page.getByLabel("Технологии проекта");
|
||||
await projectTags.fill("Go");
|
||||
await projectTags.press("Enter");
|
||||
await projectTags.fill("PostgreSQL, Kafka");
|
||||
await projectTags.press("Enter");
|
||||
await expect(page.getByRole("button", { name: /Убрать технологию Kafka/ })).toBeVisible();
|
||||
// A wrong repository address stops the step and names the field.
|
||||
await page.getByLabel("Репозиторий на GitHub, необязательно").fill("https://gitlab.com/a/b");
|
||||
await page.getByRole("button", { name: "Далее", exact: true }).click();
|
||||
await expect(page.getByRole("alert").filter({ hasText: "Проекты, проект 1" })).toBeFocused();
|
||||
await expect(page.getByText(/Нужен адрес вида https:\/\/github\.com/).first()).toBeVisible();
|
||||
await page.getByLabel("Репозиторий на GitHub, необязательно").fill("");
|
||||
|
||||
await nextStep(page, "Навыки");
|
||||
await page.getByRole("button", { name: "Добавить навык" }).click();
|
||||
await page.getByLabel("Навык 1", { exact: true }).fill("Go");
|
||||
@@ -307,6 +325,17 @@ test.describe("candidate profile", () => {
|
||||
await expect(page.getByText("Сохраненный шаг аккаунта: Согласия.")).toBeVisible();
|
||||
await expectResponsiveKeyboardFlow(page);
|
||||
|
||||
// The saved project comes back with its tags.
|
||||
await openReview(page);
|
||||
await editStep(page, "проекты", "Проекты");
|
||||
await expect(page.getByLabel("Название", { exact: true })).toHaveValue(projectTitle);
|
||||
await expect(page.getByLabel("Что делает проект и что делали вы")).toHaveValue(
|
||||
"Проводки и сверки платежей.",
|
||||
);
|
||||
await expect(page.getByRole("button", { name: /Убрать технологию PostgreSQL/ })).toBeVisible();
|
||||
await page.reload();
|
||||
await expect(page.getByLabel("Имя и фамилия")).toHaveValue(name);
|
||||
|
||||
const secondContext = await browser.newContext({
|
||||
baseURL: e2eBaseUrl(),
|
||||
locale: "ru-RU",
|
||||
|
||||
Reference in new issue
Block a user