Assertions

Assertions take the form of

should.SUBJECT[(SUBJECT_ARG)][.not][.VERB][(VERB_ARG)]

or in the case of boolean subjects:

should[.not][.be].SUBJECT[(SUBJECT_ARG)]

with an arbitrary amount of filler words in between.

Subjects

text

Extracts the textContent from the subject element using playwrights textContent

await element.should.have.text('someText')

class

Extracts the classList from the subject element

await element.should.have.class('some-class')

empty

Checks if subject element matches :empty selector

await element.should.be.empty

disabled

Checks if subject element matches :disabled selector

await element.should.be.disabled

length

value

Extracts the value property of the subject element.
This is different from attr('value'), which only extracts the initial value.

await element.should.have.value('someValue')

keys

attr

Extracts an attribute from the subject element using playwrights getAttribute

await element.should.have.attribute('some-attribute').equaling('someValue')

Verbs

equals

Alias equal, equaling

contains

Alias contain, containing

includes

Alias include, including

exist

Alias exists, existing