feat(frontend): redesign the employer cabinet with step-by-step need and invitation forms

This commit is contained in:
shira committed 2026-10-10 03:01:36 +03:00
1 parent a0869d81a1
commit 15590d127c
45 files changed
+3600 -1983

No files matched your search

+28 -8
View File
@@ -250,10 +250,13 @@ test.describe("organization invitation with the real backend", () => {
if (isInvitationCommand(request)) commands.push(request);
});
// The form has four steps: terms, package, preview, send.
await expect(page.getByText("Шаг 1 из 4")).toBeVisible();
// Step 1: the terms with [100000; 140000] net and a package.
await page.getByLabel("Название роли", { exact: true }).fill("Аналитик SOC, стажировка");
await page.getByLabel("Грейд", { exact: true }).selectOption("intern");
await page.getByLabel("Тип предложения", { exact: true }).selectOption("internship");
await page.getByRole("radio", { name: "Стажер", exact: true }).check();
await page.getByRole("radio", { name: "Стажировка", exact: true }).check();
await page
.getByLabel("Задачи", { exact: true })
.fill("Разбирать события SIEM\nГотовить отчеты об инцидентах");
@@ -270,7 +273,11 @@ test.describe("organization invitation with the real backend", () => {
.fill("Созвон с руководителем смены в течение трех рабочих дней");
await page.getByLabel("От, ₽", { exact: true }).fill("100000");
await page.getByLabel("До, ₽", { exact: true }).fill("140000");
await page.getByLabel("База суммы", { exact: true }).selectOption("net");
await page.getByRole("radio", { name: "После налога (net)", exact: true }).check();
await page.getByRole("button", { name: "Далее", exact: true }).click();
await expect(
page.getByRole("heading", { level: 2, name: "Пакет и срок ответа" }),
).toBeFocused();
const bonus = page.getByRole("group", { name: "Премии и бонусы" });
await bonus.getByRole("radio", { name: "Предусмотрено", exact: true }).check();
await page.getByLabel("Премии и бонусы: описание").fill("Квартальная премия до 10%");
@@ -286,9 +293,10 @@ test.describe("organization invitation with the real backend", () => {
.getByRole("radio", { name: "Не предусмотрено", exact: true })
.check();
await page.getByRole("button", { name: "Показать предпросмотр" }).click();
await page.getByRole("button", { name: "К предпросмотру" }).click();
await expect(page.getByRole("heading", { level: 2, name: "Предпросмотр" })).toBeFocused();
const preview = page.getByRole("region", { name: "Предпросмотр приглашения" });
await expect(preview).toBeFocused();
await expect(preview).toBeVisible();
await expect(preview.getByRole("heading", { name: organizationName })).toBeVisible();
const terms = preview.getByRole("article", { name: "Условия приглашения" });
for (const value of [
@@ -319,17 +327,25 @@ test.describe("organization invitation with the real backend", () => {
expect(commands).toEqual([]);
expect(await inboxItems(candidates)).toEqual([]);
// Step 2: without the communication method the form refuses to send.
// Step 2: without the communication method the form does not leave the
// terms. The send step is only reachable through a valid preview, so
// the employer walks back to the terms and clears the channel.
await page.getByRole("button", { name: "К отправке" }).click();
await expect(page.getByRole("heading", { level: 2, name: "Отправка" })).toBeFocused();
for (let index = 0; index < 3; index += 1) {
await page.getByRole("button", { name: "Назад", exact: true }).click();
}
await expect(page.getByText("Шаг 1 из 4")).toBeVisible();
const channel = page.getByLabel("Канал связи", { exact: true });
await channel.selectOption({ index: 0 });
await page.getByRole("button", { name: "Отправить приглашение" }).click();
await page.getByRole("button", { name: "Далее", exact: true }).click();
const summary = page.getByRole("alert").filter({ hasText: "Проверьте условия приглашения" });
await expect(summary).toBeFocused();
await expect(channel).toHaveAttribute("aria-invalid", "true");
await expect(channel).toHaveAccessibleDescription(
"Выберите способ связи после принятия приглашения.",
);
await expect(page.getByText("Условия изменены после предпросмотра")).toBeVisible();
await expect(page.getByText("Шаг 1 из 4")).toBeVisible();
expect(commands).toEqual([]);
expect(await inboxItems(candidates)).toEqual([]);
@@ -337,6 +353,10 @@ test.describe("organization invitation with the real backend", () => {
// then retried. The browser keeps the key until the command completes.
await channel.selectOption("video_call");
await expect(channel).toHaveAttribute("aria-invalid", "false");
await page.getByRole("button", { name: "Далее", exact: true }).click();
await page.getByRole("button", { name: "К предпросмотру" }).click();
await expect(preview).toBeVisible();
await page.getByRole("button", { name: "К отправке" }).click();
let sendAttempts = 0;
let delivered: SentInvitation | null = null;
await page.route("**/api/v1/organizations/*/invitations/*/send", async (route) => {