[Feature]: Implement hasAttribute(String)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- java
- Ambito
- testing-qa
Direzione di ricerca
Inizia dal punto di ingresso delle asserzioni Java mostrato nell’issue, PlaywrightAssertions.assertThat, e ispeziona gli overload esistenti di hasAttribute. Conferma come viene rappresentata l’assenza di un attributo del locator e aggiungi la forma richiesta che accetta solo String, in modo che la presenza e l’assenza possano essere verificate senza un valore; il lavoro è completo quando l’API supporta l’uso mostrato di .not().hasAttribute("min").
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
🚀 Feature Request
I want to check if a locator has an attribute.
I think that's what toHaveAttribute(name) is doing in typescript.
I tried to:
assertThat(getInputLocator()).not().hasAttribute("min", ""); // that will forbid empty min but not a filled value
or
assertThat(getInputLocator()).not().hasAttribute("min", Pattern.compile(".*"));
And the result is:
- unexpected value "undefined"
With a new API hasAttribute(String attributeName), I would be able to do:
assertThat(getInputLocator()).not().hasAttribute("min");
That will test if there is an attribute min.
Example
import com.microsoft.playwright.assertions.PlaywrightAssertions;
import java.util.regex.Pattern;
Locator el = page.locator("#my-el");
// Assert the attribute is NOT present:
PlaywrightAssertions.assertThat(el)
.not()
.hasAttribute("min", Pattern.compile(".*"));
Motivation
The only workaround I found is to get the attribute and asserts it's null. But it's not the good practice.
Having that will help to check to the absence of a attribute.
- Lingua principale
- Java
- Stelle
- 1.6k
- Fork
- 298
- Merge medio
- 3g 2h
- PR unite (30g)
- 14
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.
Altre issue di microsoft/playwright-java
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
microsoft/playwright-java#1963 · 1 commento ·
-
P3-collecting-feedback
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
microsoft/playwright-java#1885 · 3 commenti · 4 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
microsoft/playwright-java#1881 · 3 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
microsoft/playwright-java#1876 · 1 commento ·
-
P3-collecting-feedback
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
microsoft/playwright-java#1875 ·
Tutte le issue di microsoft/playwright-java
Issue simili
-
Bug Java Platform: Java
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
getsentry/sentry-java#6138 · 1 commento ·
-
bug needs triage p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100