Skip to content

Commit

Permalink
feature: Add new step for text assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
nmfzone committed Nov 16, 2019
1 parent c5bb43d commit dcbe723
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/DuskContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,36 @@ public function assertElementInvisible($selector)
});
}

/**
* Checks, that text is exists on the page.
*
* Example: Then I should see "hello world" on the page
* Example: And I should see "welcome" on the page
*
* @Then /^(?:|I )should see "(?P<text>(?:[^"]|\\")*)" on the page$/
*/
public function assertPageContainsText($text)
{
$this->browse(function (Browser $browser) use ($text) {
$browser->assertSee($text);
});
}

/**
* Checks, that text doesn't exist on the page.
*
* Example: Then I should not see "foo bar" on the page
* Example: And I should not see "You are a looser" on the page
*
* @Then /^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)" on the page$/
*/
public function assertPageDoesntContainsText($text)
{
$this->browse(function (Browser $browser) use ($text) {
$browser->assertDontSee($text);
});
}

/**
* Fills in form field with specified selector.
*
Expand Down

0 comments on commit dcbe723

Please sign in to comment.