diff --git a/src/Concerns/MakesAssertions.php b/src/Concerns/MakesAssertions.php index b508fcdc3..8e6c2067f 100644 --- a/src/Concerns/MakesAssertions.php +++ b/src/Concerns/MakesAssertions.php @@ -145,11 +145,12 @@ public function assertPlainCookieValue($name, $value) * Assert that the given text is present on the page. * * @param string $text + * @param bool $ignoreCase * @return $this */ - public function assertSee($text) + public function assertSee($text, $ignoreCase = false) { - return $this->assertSeeIn('', $text); + return $this->assertSeeIn('', $text, $ignoreCase); } /** @@ -168,16 +169,17 @@ public function assertDontSee($text) * * @param string $selector * @param string $text + * @param bool $ignoreCase * @return $this */ - public function assertSeeIn($selector, $text) + public function assertSeeIn($selector, $text, $ignoreCase = false) { $fullSelector = $this->resolver->format($selector); $element = $this->resolver->findOrFail($selector); PHPUnit::assertTrue( - Str::contains($element->getText(), $text), + Str::contains($element->getText(), $text, $ignoreCase), "Did not see expected text [{$text}] within element [{$fullSelector}]." ); diff --git a/src/Concerns/WaitsForElements.php b/src/Concerns/WaitsForElements.php index 7c5ed0c01..54be34931 100644 --- a/src/Concerns/WaitsForElements.php +++ b/src/Concerns/WaitsForElements.php @@ -95,18 +95,19 @@ public function waitUntilMissingText($text, $seconds = null) * * @param array|string $text * @param int|null $seconds + * @param bool $ignoreCase * @return $this * * @throws \Facebook\WebDriver\Exception\TimeoutException */ - public function waitForText($text, $seconds = null) + public function waitForText($text, $seconds = null, $ignoreCase = false) { $text = Arr::wrap($text); $message = $this->formatTimeOutMessage('Waited %s seconds for text', implode("', '", $text)); - return $this->waitUsing($seconds, 100, function () use ($text) { - return Str::contains($this->resolver->findOrFail('')->getText(), $text); + return $this->waitUsing($seconds, 100, function () use ($text, $ignoreCase) { + return Str::contains($this->resolver->findOrFail('')->getText(), $text, $ignoreCase); }, $message); } @@ -116,16 +117,17 @@ public function waitForText($text, $seconds = null) * @param string $selector * @param array|string $text * @param int|null $seconds + * @param bool $ignoreCase * @return $this * * @throws \Facebook\WebDriver\Exception\TimeoutException */ - public function waitForTextIn($selector, $text, $seconds = null) + public function waitForTextIn($selector, $text, $seconds = null, $ignoreCase = false) { $message = 'Waited %s seconds for text "'.$this->escapePercentCharacters($text).'" in selector '.$selector; - return $this->waitUsing($seconds, 100, function () use ($selector, $text) { - return $this->assertSeeIn($selector, $text); + return $this->waitUsing($seconds, 100, function () use ($selector, $text, $ignoreCase) { + return $this->assertSeeIn($selector, $text, $ignoreCase); }, $message); }