microsoft / microsoft/playwright-java
[Feature]: Numerical Comparison Assertions for hasCount
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 1.6k
- Fork
- 298
- Merge medio
- 3g 2h
- PR unite (30g)
- 14
Descrizione
🚀 Feature Request
Currently, assertThat(locator).hasCount(n) only supports strict equality. In many real-world testing scenarios, the exact number of elements is dynamic, and we only need to verify if the count meets a certain threshold (e.g., "at least one item is present" or "no more than 10 items").
Example
Proposed Methods: hasCountGreaterThan(int n), hasCountLessThan(int n), hasCountAtLeast(int n), hasCountAtMost(int n).
Motivation
Improved Readability: Replaces less intuitive workarounds like assertThat(locator).not().hasCount(0).
Native Polling: These checks would leverage Playwright’s built-in auto-waiting mechanism, making tests much more stable than manual polling loops.
Implementation: The implementation is straightforward as Playwright already has the infrastructure to retrieve element counts and poll for conditions. It simply requires adding comparison operators to the assertion logic.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia individuando l’implementazione esistente dell’assertion hasCount e l’infrastruttura di polling di Playwright utilizzata per recuperare il numero di elementi. Verifica come le assertion comparabili espongono le condizioni maggiore di, minore di, almeno e al massimo. Il lavoro è completato quando i metodi proposti supportano i controlli delle soglie con il polling nativo e migliorano la leggibilità rispetto ai controlli di uguaglianza negati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- testing
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100