Fix flaky e2e tests for calendar and projects

This commit is contained in:
Gregor Vostrak
2026-03-23 02:38:34 +01:00
parent b94872b07b
commit a2b0828c54
2 changed files with 11 additions and 10 deletions

View File

@@ -1188,29 +1188,29 @@ test.describe('Resize Events', () => {
const event = page.locator('.fc-event').filter({ hasText: 'Resize running start' }).first(); const event = page.locator('.fc-event').filter({ hasText: 'Resize running start' }).first();
await expect(event).toBeVisible(); await expect(event).toBeVisible();
const eventBox = await event.boundingBox(); // Use the start resizer element directly for more reliable interaction
const topY = eventBox!.y; const startResizer = event.locator('.fc-event-resizer-start');
const centerX = eventBox!.x + eventBox!.width / 2; const resizerBox = await startResizer.boundingBox();
const centerX = resizerBox!.x + resizerBox!.width / 2;
const resizerY = resizerBox!.y + resizerBox!.height / 2;
const [putResponse] = await Promise.all([ const [putResponse] = await Promise.all([
page.waitForResponse( page.waitForResponse(
(r) => (r) => r.url().includes('/time-entries/') && r.request().method() === 'PUT'
r.url().includes('/time-entries/') &&
r.request().method() === 'PUT' &&
r.status() === 200
), ),
(async () => { (async () => {
await page.mouse.move(centerX, topY + 3); await page.mouse.move(centerX, resizerY);
await page.waitForTimeout(100); await page.waitForTimeout(100);
await page.mouse.down(); await page.mouse.down();
const slotLane = page.locator('.fc-timegrid-slot-lane').first(); const slotLane = page.locator('.fc-timegrid-slot-lane').first();
const slotHeight = (await slotLane.boundingBox())!.height; const slotHeight = (await slotLane.boundingBox())!.height;
// Move down (make it start later) // Move down (make it start later)
await page.mouse.move(centerX, topY + slotHeight * 4, { steps: 15 }); await page.mouse.move(centerX, resizerY + slotHeight * 4, { steps: 15 });
await page.mouse.up(); await page.mouse.up();
})(), })(),
]); ]);
expect(putResponse.status()).toBe(200);
const body = await putResponse.json(); const body = await putResponse.json();
// End should remain null for running entries // End should remain null for running entries
expect(body.data.end).toBeNull(); expect(body.data.end).toBeNull();

View File

@@ -850,7 +850,8 @@ test('test that project context menu archive archives the project', async ({ pag
), ),
page.getByRole('menuitem', { name: 'Archive' }).click(), page.getByRole('menuitem', { name: 'Archive' }).click(),
]); ]);
await expect(page.getByTestId('project_table')).not.toContainText(projectName); // After archiving, the project stays visible (default filter is 'all') but status changes to 'Archived'
await expect(row).toContainText('Archived');
}); });
test('test that project context menu delete deletes the project', async ({ page, ctx }) => { test('test that project context menu delete deletes the project', async ({ page, ctx }) => {