feat(frontend): complete candidate flow and public pages
This commit is contained in:
1 parent
a69b1a79bb
commit
e4be4a3956
63 files changed
+1903
-746
No files matched your search
@@ -0,0 +1,147 @@
|
||||
import { expect, test, type Route } from "@playwright/test";
|
||||
|
||||
const accountId = "11111111-1111-4111-8111-111111111111";
|
||||
const session = {
|
||||
account: {
|
||||
id: accountId,
|
||||
email: "visual-candidate@example.test",
|
||||
email_verified: true,
|
||||
scenario: "candidate",
|
||||
onboarding_step: "candidate_questionnaire",
|
||||
created_at: "2026-10-07T12:00:00Z",
|
||||
},
|
||||
csrf_token: "synthetic-csrf-token-for-visual-test",
|
||||
};
|
||||
|
||||
const catalog = {
|
||||
directions: [
|
||||
{
|
||||
code: "development",
|
||||
title: "Разработка",
|
||||
specializations: [
|
||||
{
|
||||
code: "backend",
|
||||
title: "Backend",
|
||||
test_availability: {
|
||||
status: "available",
|
||||
grades: ["intern", "junior", "middle"],
|
||||
task_languages: ["python", "go"],
|
||||
note: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
code: "frontend",
|
||||
title: "Frontend",
|
||||
test_availability: {
|
||||
status: "in_development",
|
||||
grades: [],
|
||||
task_languages: [],
|
||||
note: "Тест по этой специализации готовится.",
|
||||
},
|
||||
},
|
||||
{
|
||||
code: "mobile",
|
||||
title: "Мобильная разработка",
|
||||
test_availability: {
|
||||
status: "in_development",
|
||||
grades: [],
|
||||
task_languages: [],
|
||||
note: "Тест по этой специализации готовится.",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: "security",
|
||||
title: "Безопасность",
|
||||
specializations: [
|
||||
{
|
||||
code: "information_security",
|
||||
title: "Информационная безопасность",
|
||||
test_availability: {
|
||||
status: "in_development",
|
||||
grades: [],
|
||||
task_languages: [],
|
||||
note: "Тест по этой специализации готовится.",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
grades: [
|
||||
{ code: "intern", title: "Стажер" },
|
||||
{ code: "junior", title: "Junior" },
|
||||
{ code: "middle", title: "Middle" },
|
||||
{ code: "senior", title: "Senior" },
|
||||
],
|
||||
};
|
||||
|
||||
const questionnaire = {
|
||||
version: 0,
|
||||
specializations: [],
|
||||
work_context: null,
|
||||
updated_at: null,
|
||||
};
|
||||
|
||||
async function respond(route: Route, body: unknown): Promise<void> {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
}
|
||||
|
||||
test("shows the populated specialization catalog on desktop and mobile", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
await page.route("**/api/v1/**", async (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
if (url.pathname === "/api/v1/identity/sessions/current") {
|
||||
await respond(route, session);
|
||||
return;
|
||||
}
|
||||
if (url.pathname === "/api/v1/me/profile") {
|
||||
await respond(route, { version: 0, confirmed_categories: [] });
|
||||
return;
|
||||
}
|
||||
if (url.pathname === "/api/v1/me/questionnaire") {
|
||||
await respond(route, questionnaire);
|
||||
return;
|
||||
}
|
||||
if (url.pathname === "/api/v1/me/assessment-availability") {
|
||||
await respond(route, { specializations: [] });
|
||||
return;
|
||||
}
|
||||
if (url.pathname === "/api/v1/me/assessment-results") {
|
||||
await respond(route, { items: [], page: { has_more: false, next_cursor: null } });
|
||||
return;
|
||||
}
|
||||
if (url.pathname === "/api/v1/specializations") {
|
||||
await respond(route, catalog);
|
||||
return;
|
||||
}
|
||||
await route.continue();
|
||||
});
|
||||
|
||||
await page.setViewportSize({ width: 1440, height: 1100 });
|
||||
await page.goto("/candidate/questionnaire");
|
||||
await expect(page.getByRole("heading", { level: 1, name: "Анкета" })).toBeVisible();
|
||||
const specialization = page.getByLabel("Специализация", { exact: true });
|
||||
await expect(specialization.locator("option", { hasText: "Backend" })).toHaveCount(1);
|
||||
await expect(
|
||||
specialization.locator("option", { hasText: "Информационная безопасность" }),
|
||||
).toHaveCount(1);
|
||||
await specialization.selectOption("backend");
|
||||
await expect(page.getByText(/Проверка опубликована для уровней:/)).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath("questionnaire-catalog-desktop.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await expect(specialization).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath("questionnaire-catalog-mobile.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user