vitest-dev / vitest-dev/vitest
`await expect.element(page).not.toHaveTextContent()`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Clear and concise description of the problem
When testing components, it is currently not possible to check that the rendering is empty (some of our components have conditions, and might not render anything.
expect.element(page) doesn't work because page is not a locator.
But I can't use page.getBy.... because there is nothing to get...
Suggested solution
await expect.element(page).not.toHaveTextContent()
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name implementation files or tests. Start by locating the expect.element API and the existing toHaveTextContent matcher tests, then check how page objects differ from locators. Done means the proposed negated assertion can verify that a component renders no content, with coverage for the empty-rendering case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100