Files
vikunja/frontend/cypress/e2e/project/project-view-table.spec.ts
Claude Loop 3640c66996 fix: complete comprehensive API intercept fixes for all E2E tests
Applies comprehensive API intercepts to all remaining E2E test files that use
loadTasks to resolve "No request ever occurred" failures. The application may
call different task loading endpoints based on context, so all tests now
intercept all possible patterns:

- `**/api/v1/projects/*/views/*/tasks**` - When viewId is provided
- `**/api/v1/projects/*/tasks**` - When viewId is missing (fallback)
- `**/api/v1/tasks/all**` - When projectId is null/undefined

Files updated:
- cypress/e2e/project/project-view-list.spec.ts - 3 test cases fixed
- cypress/e2e/project/project-view-table.spec.ts - 3 test cases fixed
- cypress/e2e/task/task.spec.ts - 9 test cases fixed
- cypress/e2e/task/overview.spec.ts - 2 test cases fixed
- cypress/e2e/task/subtask-duplicates.spec.ts - 1 test case fixed

All intercepts use the same @loadTasks alias so existing cy.wait() calls
work unchanged. Maintains 30s timeout for CI reliability.

This should resolve the majority of E2E test "loadTasks" timeout failures
by ensuring tests properly wait for task data regardless of which API
endpoint the application calls based on the current context.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 05:02:50 +00:00

107 lines
3.3 KiB
TypeScript

import {createFakeUserAndLogin} from '../../support/authenticateUser'
import {TaskFactory} from '../../factories/task'
import {prepareProjects} from './prepareProjects'
describe('Project View Table', () => {
createFakeUserAndLogin()
prepareProjects()
it('Should show a table with tasks', () => {
const tasks = TaskFactory.create(1, {
project_id: 1,
})
// Set up comprehensive API intercepts for all possible task loading endpoints
cy.intercept('GET', '**/api/v1/projects/*/views/*/tasks**').as('loadTasks')
cy.intercept('GET', '**/api/v1/projects/*/tasks**').as('loadTasks')
cy.intercept('GET', '**/api/v1/tasks/all**').as('loadTasks')
cy.visit('/projects/1/3')
cy.wait('@loadTasks', {timeout: 30000})
// Wait for the table to be visible
cy.get('.project-table table.table', {timeout: 30000})
.should('be.visible')
// Wait for the table to contain the task
cy.get('.project-table table.table tbody', {timeout: 30000})
.should('be.visible')
.should('contain', tasks[0].title)
})
it('Should have working column switches', () => {
TaskFactory.create(1, {
project_id: 1,
})
// Set up comprehensive API intercepts for all possible task loading endpoints
cy.intercept('GET', '**/api/v1/projects/*/views/*/tasks**').as('loadTasks')
cy.intercept('GET', '**/api/v1/projects/*/tasks**').as('loadTasks')
cy.intercept('GET', '**/api/v1/tasks/all**').as('loadTasks')
cy.visit('/projects/1/3')
cy.wait('@loadTasks', {timeout: 30000})
// Wait for the table to load
cy.get('.project-table table.table', {timeout: 30000})
.should('be.visible')
// Open columns filter
cy.get('.project-table .filter-container .button')
.contains('Columns')
.should('be.visible')
.click()
// Enable Priority column
cy.get('.project-table .filter-container .card.columns-filter .card-content .fancy-checkbox')
.contains('Priority')
.should('be.visible')
.click()
// Disable Done column
cy.get('.project-table .filter-container .card.columns-filter .card-content .fancy-checkbox')
.contains('Done')
.should('be.visible')
.click()
// Verify Priority column is visible
cy.get('.project-table table.table th')
.contains('Priority')
.should('be.visible')
.should('exist')
// Verify Done column is hidden
cy.get('.project-table table.table th')
.contains('Done')
.should('not.exist')
})
it('Should navigate to the task when the title is clicked', () => {
const tasks = TaskFactory.create(5, {
id: '{increment}',
project_id: 1,
})
// Set up comprehensive API intercepts for all possible task loading endpoints
cy.intercept('GET', '**/api/v1/projects/*/views/*/tasks**').as('loadTasks')
cy.intercept('GET', '**/api/v1/projects/*/tasks**').as('loadTasks')
cy.intercept('GET', '**/api/v1/tasks/all**').as('loadTasks')
cy.visit('/projects/1/3')
cy.wait('@loadTasks', {timeout: 30000})
// Wait for the table to be visible and contain tasks
cy.get('.project-table table.table tbody', {timeout: 30000})
.should('be.visible')
.and('contain', tasks[0].title)
// Click on the task title to navigate
cy.get('.project-table table.table')
.contains(tasks[0].title)
.should('be.visible')
.click()
// Verify navigation to task detail page
cy.url()
.should('contain', `/tasks/${tasks[0].id}`, {timeout: 30000})
})
})