tastejs/todomvc · error · Error
Cannot determine what kind of selectors this app uses.
Error message
Cannot determine what kind of selectors this app uses.
What it means
Thrown at cypress/e2e/spec.cy.js:513, the final else branch of the same selector-detection block as error 2. It fires when the framework is not in `usesIDSelectors` AND neither `input#new-todo` nor `input.new-todo` can be found anywhere in the document, including inside shadow roots (findDeep walks shadow trees at line 487-495). In practice this means the app never rendered its new-todo input: the page did not load, the build was skipped, the framework threw during boot, or the markup uses a non-standard selector the spec does not recognize.
Source
Thrown at cypress/e2e/spec.cy.js:513
}
cy.document().then(doc => {
if (framework in usesIDSelectors) {
setSelectors(usesIDSelectors[framework])
createTodoCommands(usesIDSelectors[framework])
} else if (findDeep(doc, 'input#new-todo') && findDeep(doc, 'input.new-todo')) {
throw new Error(
'Cannot determine what kind of selectors this app uses. Add it to usesIDSelectors.'
)
} else if (findDeep(doc, 'input#new-todo')) {
cy.log('app uses ID selectors')
setSelectors(true)
createTodoCommands(true)
} else if (findDeep(doc, 'input.new-todo')) {
cy.log('app uses class selectors')
setSelectors(false)
createTodoCommands(false)
} else {
throw new Error(
'Cannot determine what kind of selectors this app uses.'
)
}
})
})
beforeEach(() => {
// catch any framework that debounces its localStorage writes
// and causes items to "appear" in a new test all of the sudden
hasNoItems()
})
afterEach(() => {
// to detect when a test queued up some operation
// and it happens AFTER test finishes
currentTestId = 0
})
View on GitHub (pinned to ff43b02e59)
Solutions
- Confirm the app actually loads: open the same URL Cypress visits in a browser and check the new-todo input is present and focused.
- Build the example first (`npm run build` in the framework folder) so dist/ exists for build-step frameworks.
- Verify baseUrl in cypress.config.js and the frameworkFolders mapping at line 38 point to the runnable index.html.
- If the app legitimately uses a non-standard selector, add the framework to `usesIDSelectors` at line 132 AND extend the idSelectors/classSelectors maps so the chosen style has the right query.
- Check the browser console / Cypress command log for a framework boot error that prevented the input from rendering.
Defensive patterns
Strategy: validation
Validate before calling
// Assert the app booted before selector detection runs, so a load failure
// surfaces as a clear assertion instead of the generic 'cannot determine' throw.
cy.document().then(doc => {
const hasAnyInput = findDeep(doc, 'input')
if (!hasAnyInput) {
throw new Error(`App at ${Cypress.config('baseUrl')} rendered no <input>; build missing or wrong URL.`)
}
}) Prevention
- Always build the framework (npm run build) before running the spec; build-step frameworks serve from dist/ (see frameworkFolders line 38).
- Pin baseUrl in cypress.config.js and smoke-test it with a `cy.visit()` + `cy.get('body')` sanity check in a separate minimal spec.
- Add a pre-flight script that curls the app URL and fails if the new-todo input is absent.
- If a framework uses a non-standard selector, register it in `usesIDSelectors` and extend the selector maps rather than hoping detection finds it.
- Watch for framework boot errors in the browser console — a swallowed exception is the usual cause of a missing input.
When it happens
Trigger: Cypress visited a URL that returned a 404 or a blank page; the example's build output (dist/) was never produced so baseUrl serves nothing; the framework's JS errored on boot so the input was never created; the app renders the input under a different selector (e.g. a custom element name) that matches neither convention; a timing issue where the document is queried before the framework has hydrated (though `cy.document().then(...)` yields after load, slow hydration can still lose the race).
Common situations: Forgot `npm run build` for a build-step framework (angular, react, vue, lit, svelte all land in dist/ per frameworkFolders at line 38); baseUrl or framework folder mapping is wrong so the wrong page loads; a new example with bespoke markup; a framework boot error swallowed by the app but visible as a missing input; shadow-DOM app where findDeep's recursive walk misses a closed shadow root.
Related errors
- Cannot determine what kind of selectors this app uses. Add i
- Please specify the framework name to test. See fold
- Invalid number of tests ${N} from env "${Cypress.env('times'
AI-assisted analysis of tastejs/todomvc@ff43b02e59 (2026-08-13).
Data as JSON: /api/errors/bc9eaeed293d7377.
Report an issue: GitHub.