Skip to content

Commit

Permalink
fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
flap152 committed Dec 28, 2024
1 parent b447ee6 commit 3c9ae12
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/Concerns/MakesAssertions.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public function assertSeeIn($selector, $text, $ignoreCase = false)
// "Did not see expected text [{$text}] within any of the elements [{$selector}]."
"Did not see expected text [{$text}] within element [{$fullSelector}]." //hard coded in test
);

return $this;
}

Expand All @@ -208,12 +209,13 @@ public function assertDontSeeIn($selector, $text, $ignoreCase = false)

PHPUnit::assertNotEmpty($elements);

foreach ($elements as $element){
foreach ($elements as $element) {
PHPUnit::assertFalse(
Str::contains($element->getText(), $text, $ignoreCase),
"Saw unexpected text [{$text}] within element [{$fullSelector}]."
);
}

return $this;
}

Expand All @@ -231,7 +233,7 @@ public function assertSeeAnythingIn($selector)

PHPUnit::assertNotEmpty($elements);

foreach ($elements as $element){
foreach ($elements as $element) {
PHPUnit::assertTrue(
$element->getText() !== '',
"Saw unexpected text [''] within element [{$fullSelector}]."
Expand Down
8 changes: 4 additions & 4 deletions tests/Browser/BrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ public function test_it_handle_wait_for_text_in()
->waitForTextIn('@copy-button', 'Copy', 3);
});
}

public function test_it_handles_assert_see_in_with_multiple_selection()
{
$this->browse(function (Browser $browser) {
$browser->visit('/tests/assert-see-in')
->assertSee( 'Hello World')
->assertDontSee( 'Gesundheit')
->assertSee('Hello World')
->assertDontSee('Gesundheit')
->assertSeeIn('', 'Hello World')
->assertSeeIn('#app > h1', 'Hello World')
->assertSeeIn('#app > div', 'Second')
->assertSeeIn('#app > div:nth-child(3)', 'Third')
->assertDontSeeIn('#app > div:nth-child(3)', 'Second')
;
->assertDontSeeIn('#app > div:nth-child(3)', 'Second');
});
}
}
2 changes: 1 addition & 1 deletion tests/Unit/MakesAssertionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ public function test_assert_dont_see()
//
// $resolver = m::mock(stdClass::class);
// $resolver->shouldReceive('format')->with('foo')->andReturn('body foo');
//// $resolver->shouldReceive('findOrFail')->with('foo')->andReturn($element);
//// $resolver->shouldReceive('findOrFail')->with('foo')->andReturn($element);
// $resolver->shouldReceive('elements')->with('body foo')->andReturn([$element]);
//
// $browser = new Browser($driver, $resolver);
Expand Down
3 changes: 0 additions & 3 deletions tests/Unit/WaitsForElementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Facebook\WebDriver\Exception\TimeOutException;
use Facebook\WebDriver\Remote\RemoteWebElement;
use Facebook\WebDriver\WebDriver;
use Facebook\WebDriver\WebDriverBy;
use Facebook\WebDriver\WebDriverWait;
use Laravel\Dusk\Browser;
use Laravel\Dusk\ElementResolver;
Expand Down Expand Up @@ -71,7 +70,6 @@ public function test_when_available_missing()

$browser = new Browser($driver, $resolver);


try {
$browser->whenAvailable('bar', function ($bar) {
// Callback not fired as selector not found
Expand Down Expand Up @@ -106,7 +104,6 @@ public function test_when_available_present()
});
}


public function test_default_wait_time()
{
Browser::$waitSeconds = 2;
Expand Down

0 comments on commit 3c9ae12

Please sign in to comment.