Laravel 5: Testing – Cheatsheet: Laravel Dusk testing assertions

Cheatsheet: Laravel Dusk testing assertions

Laravel Dusk: list of assertions.


[one_third]
assertTitle
assertTitleContains
assertUrlIs
assertPathIs
assertPathBeginsWith
assertPathIsNot
assertFragmentIs
assertFragmentBeginsWith
assertFragmentIsNot
assertRouteIs
assertQueryStringHas
assertQueryStringMissing
assertHasCookie
assertCookieMissing
[/one_third][one_third]
assertCookieValue
assertPlainCookieValue
assertSourceHas
assertSourceMissing
assertSee
assertDontSee
assertSeeIn
assertDontSeeIn
assertSeeLink
assertDontSeeLink
assertInputValue
assertInputValueIsNot
assertChecked
assertNotChecked
[/one_third][one_third_last]
assertRadioSelected
assertRadioNotSelected
assertSelected
assertNotSelected
assertSelectHasOptions
assertSelectMissingOptions
assertSelectHasOption
assertSelectMissingOption
assertValue
assertVisible
assertPresent
assertMissing
assertDialogOpened
[/one_third_last]


Title

assertTitle

assertTitleContains

Url

assertUrlIs

Path (relative)

assertPathIs

assertPathBeginsWith

assertPathIsNot

Url fragment

What is url fragment?

assertFragmentIs

assertFragmentBeginsWith

assertFragmentIsNot

Route

assertRouteIs

Query: url params (GET key/val pairs) testing

assertQueryStringHas

assertQueryStringMissing

Cookie

assertHasCookie

assertCookieMissing

assertCookieValue

assertPlainCookieValue

HTML Source Code

assertSourceHas

assertSourceMissing

Text on page

assertSee

assertDontSee

Text on page inside of selectors

A few words about selectors.

Selectors seem to be HTML tags – see here, but also elements identified by ID, CLASS
They are case insensitive, your tag could be ‘H1’, but in assertion you can ask for ‘h1’.
Allows for text to be inside of other elements, like: a, label, input etc. – sample:


assertSeeIn

assertDontSeeIn

Link

Input

assertInputValue

assertInputValueIsNot

Checkbox

assertChecked

assertNotChecked

Radio

assertRadioSelected

assertRadioNotSelected

Drop-down (<select>)

assertSelected

assertNotSelected

assertSelectHasOptions

assertSelectMissingOptions

assertSelectHasOption

assertSelectMissingOption

Selector (form field etc.- all that have attr value) current value

assertValue

Visibility

assertVisible

seem to add functionality to all ‘see in code’ methods described above

assertPresent

assertMissing

Dialog Open

assertDialogOpened