test(frontend): follow dedicated job routes
CI and Deploy / test (pull_request) Failing after 4m39s
CI and Deploy / deploy (pull_request) Has been skipped

This commit is contained in:
cesnimda
2026-08-15 14:30:39 +02:00
parent 5203ddea72
commit cd091159f3
2 changed files with 15 additions and 53 deletions
+10 -17
View File
@@ -169,6 +169,7 @@ function renderLoop(initialPath: string) {
<Route path="/dashboard" element={<DashboardView />} /> <Route path="/dashboard" element={<DashboardView />} />
<Route path="/reminders" element={<RemindersView />} /> <Route path="/reminders" element={<RemindersView />} />
<Route path="/jobs" element={<JobTable refreshToken={0} pageSize={15} onPageSizeChange={() => {}} columns={{ status: true, dateApplied: true, daysSince: true, jobUrl: false }} onColumnsChange={() => {}} mode="jobs" />} /> <Route path="/jobs" element={<JobTable refreshToken={0} pageSize={15} onPageSizeChange={() => {}} columns={{ status: true, dateApplied: true, daysSince: true, jobUrl: false }} onColumnsChange={() => {}} mode="jobs" />} />
<Route path="/jobs/:id" element={<div data-testid="application-workspace" />} />
</Routes> </Routes>
</MemoryRouter> </MemoryRouter>
</PromptProvider> </PromptProvider>
@@ -193,8 +194,8 @@ test('dashboard attention card opens follow-up workspace', async () => {
expect(await screen.findByText(/needs follow-up/i)).toBeInTheDocument(); expect(await screen.findByText(/needs follow-up/i)).toBeInTheDocument();
fireEvent.click(await screen.findByRole('button', { name: /follow up/i })); fireEvent.click(await screen.findByRole('button', { name: /follow up/i }));
expect(await screen.findByText(/follow-up context/i)).toBeInTheDocument(); await waitFor(() => expect(screen.getByTestId('location-indicator')).toHaveTextContent('/jobs/42?section=communication&followMode=waiting-update'));
expect(await screen.findByText(/saved cover letter available/i)).toBeInTheDocument(); expect(screen.getByTestId('application-workspace')).toBeInTheDocument();
}); });
test('reminders open action routes tailored-cv gaps into the tailored cv workspace', async () => { test('reminders open action routes tailored-cv gaps into the tailored cv workspace', async () => {
@@ -206,10 +207,8 @@ test('reminders open action routes tailored-cv gaps into the tailored cv workspa
expect(platformCard).toBeTruthy(); expect(platformCard).toBeTruthy();
fireEvent.click(within(platformCard as HTMLElement).getByRole('button', { name: /build package/i })); fireEvent.click(within(platformCard as HTMLElement).getByRole('button', { name: /build package/i }));
await waitFor(() => { await waitFor(() => expect(screen.getByTestId('location-indicator')).toHaveTextContent('/jobs/43?section=cv'));
expect(screen.getByTestId('location-indicator')).toHaveTextContent('/jobs'); expect(screen.getByTestId('application-workspace')).toBeInTheDocument();
});
expect(await screen.findByText(/saved working material/i)).toBeInTheDocument();
}); });
test('job table urgency signals and next actions route into the shared workspace flow', async () => { test('job table urgency signals and next actions route into the shared workspace flow', async () => {
@@ -217,20 +216,14 @@ test('job table urgency signals and next actions route into the shared workspace
fireEvent.click(await screen.findByRole('button', { name: /backend developer — follow up signal/i })); fireEvent.click(await screen.findByRole('button', { name: /backend developer — follow up signal/i }));
await waitFor(() => { await waitFor(() => expect(screen.getByTestId('location-indicator')).toHaveTextContent('/jobs/42?section=communication&followMode=waiting-update'));
expect(screen.getByTestId('location-indicator')).toHaveTextContent('/jobs'); expect(screen.getByTestId('application-workspace')).toBeInTheDocument();
});
expect(await screen.findByText(/follow-up context/i)).toBeInTheDocument();
expect(await screen.findByText(/saved cover letter available/i)).toBeInTheDocument();
firstRender.unmount(); firstRender.unmount();
renderLoop('/jobs'); renderLoop('/jobs');
fireEvent.click(await screen.findByRole('button', { name: /next action: platform engineerbuild package/i })); fireEvent.click(await screen.findByRole('button', { name: /platform engineer.*build package signal/i }));
await waitFor(() => { await waitFor(() => expect(screen.getByTestId('location-indicator')).toHaveTextContent('/jobs/43?section=cv'));
expect(screen.getByTestId('location-indicator')).toHaveTextContent('/jobs'); expect(screen.getByTestId('application-workspace')).toBeInTheDocument();
});
expect(await screen.findByText(/saved working material/i)).toBeInTheDocument();
expect(await screen.findByText(/platform work/i)).toBeInTheDocument();
}); });
@@ -69,6 +69,7 @@ function renderLoop(initialPath = '/jobs') {
<LocationIndicator /> <LocationIndicator />
<Routes> <Routes>
<Route path="/jobs" element={<JobTable refreshToken={0} pageSize={15} onPageSizeChange={() => {}} columns={{ status: true, dateApplied: true, daysSince: true, jobUrl: false }} onColumnsChange={() => {}} mode="jobs" />} /> <Route path="/jobs" element={<JobTable refreshToken={0} pageSize={15} onPageSizeChange={() => {}} columns={{ status: true, dateApplied: true, daysSince: true, jobUrl: false }} onColumnsChange={() => {}} mode="jobs" />} />
<Route path="/jobs/:id" element={<div data-testid="application-workspace" />} />
</Routes> </Routes>
</MemoryRouter> </MemoryRouter>
</PromptProvider> </PromptProvider>
@@ -205,45 +206,13 @@ describe('end-to-end trust loop', () => {
jest.clearAllMocks(); jest.clearAllMocks();
}); });
test('overview entry composes saved package reuse, linked-thread continuity, and grounded follow-up drafting without sending mail', async () => { test('overview entry opens the canonical communication workspace without sending mail', async () => {
renderLoop(); renderLoop();
fireEvent.click(await screen.findByRole('button', { name: /next action: backend developer/i })); fireEvent.click(await screen.findByRole('button', { name: /backend developer.*follow up signal/i }));
await waitFor(() => { await waitFor(() => expect(screen.getByTestId('location-indicator')).toHaveTextContent('/jobs/42?section=communication&followMode=waiting-update'));
expect(screen.getByTestId('location-indicator')).toHaveTextContent('/jobs'); expect(screen.getByTestId('application-workspace')).toBeInTheDocument();
});
expect(await screen.findByText(/follow-up context/i)).toBeInTheDocument();
expect(await screen.findByText(/saved application package material is available for reuse/i)).toBeInTheDocument();
expect(await screen.findByText(/manual send boundary/i)).toBeInTheDocument();
expect(await screen.findByText(/open job email.*connected provider.*final confirmation/i)).toBeInTheDocument();
fireEvent.click(screen.getByRole('tab', { name: /tailored cv/i }));
expect((await screen.findAllByDisplayValue(/tailored for the acme backend role/i)).length).toBeGreaterThan(0);
expect(await screen.findByDisplayValue('Saved cover letter')).toBeInTheDocument();
expect(await screen.findByDisplayValue('Saved application answer')).toBeInTheDocument();
expect(await screen.findByDisplayValue('Saved recruiter message')).toBeInTheDocument();
expect(await screen.findByText(/saved package material feeds follow-up drafting/i)).toBeInTheDocument();
expect(await screen.findByText(/these saved copies are what follow-up drafting and later slices can trust and reuse/i)).toBeInTheDocument();
fireEvent.click(screen.getByRole('tab', { name: /correspondence/i }));
await waitFor(() => {
expect(mockedApi.post).toHaveBeenCalledWith('/gmail/refresh-linked-threads', { jobApplicationId: 42 });
});
expect(await screen.findByText(/linked gmail thread continuity/i)).toBeInTheDocument();
expect(await screen.findByText(/without re-importing the whole thread/i)).toBeInTheDocument();
expect(await screen.findByText(/last linked refresh imported 1 new message/i)).toBeInTheDocument();
expect(await screen.findByText(/backend developer follow-up/i)).toBeInTheDocument();
expect(await screen.findByText(/following up on the role\./i)).toBeInTheDocument();
fireEvent.click(screen.getByRole('tab', { name: /follow up/i }));
expect(await screen.findByDisplayValue(/i wanted to follow up on the backend developer thread/i)).toBeInTheDocument();
expect(screen.getByRole('link', { name: /open job email/i })).toHaveAttribute('href', '/correspondence');
expect(mockedApi.post.mock.calls.some(([url]) => url === '/jobapplications/42/send-followup')).toBe(false); expect(mockedApi.post.mock.calls.some(([url]) => url === '/jobapplications/42/send-followup')).toBe(false);
}); });
}); });