Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tests/BrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function test_with_method()

$browser->with('prefix', function ($browser) {
$this->assertInstanceof(Browser::class, $browser);
$this->assertEquals('body prefix', $browser->resolver->prefix);
$this->assertSame('body prefix', $browser->resolver->prefix);
});
}

Expand All @@ -99,7 +99,7 @@ public function test_with_method_with_page()

$browser->with('prefix', function ($browser) use ($page) {
$this->assertInstanceof(Browser::class, $browser);
$this->assertEquals('body prefix', $browser->resolver->prefix);
$this->assertSame('body prefix', $browser->resolver->prefix);
$this->assertEquals($page, $browser->page);
$this->assertFalse($page->asserted);
});
Expand All @@ -112,7 +112,7 @@ public function test_within_method()

$browser->within('prefix', function ($browser) {
$this->assertInstanceof(Browser::class, $browser);
$this->assertEquals('body prefix', $browser->resolver->prefix);
$this->assertSame('body prefix', $browser->resolver->prefix);
});
}

Expand All @@ -129,7 +129,7 @@ public function test_within_method_with_page()

$browser->within('prefix', function ($browser) use ($page) {
$this->assertInstanceof(Browser::class, $browser);
$this->assertEquals('body prefix', $browser->resolver->prefix);
$this->assertSame('body prefix', $browser->resolver->prefix);
$this->assertEquals($page, $browser->page);
$this->assertFalse($page->asserted);
});
Expand All @@ -143,7 +143,7 @@ public function test_elsewhere_method()
$browser->with('prefix', function ($browser) {
$browser->elsewhere('.my-class', function ($browser) {
$this->assertInstanceof(Browser::class, $browser);
$this->assertEquals('body .my-class', $browser->resolver->prefix);
$this->assertSame('body .my-class', $browser->resolver->prefix);
});
});
}
Expand Down
10 changes: 5 additions & 5 deletions tests/ComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public function test_resolver_prefix()
$browser = new Browser($driver);

$browser->within($component = new TestComponent, function ($browser) {
$this->assertEquals('body #component-root', $browser->resolver->prefix);
$this->assertSame('body #component-root', $browser->resolver->prefix);

$browser->within($nested = new TestNestedComponent, function ($browser) {
$this->assertEquals('body #component-root #nested-root', $browser->resolver->prefix);
$this->assertSame('body #component-root #nested-root', $browser->resolver->prefix);

$browser->with('prefix', function ($browser) {
$this->assertEquals('body #component-root #nested-root prefix', $browser->resolver->prefix);
$this->assertSame('body #component-root #nested-root prefix', $browser->resolver->prefix);
});
});
});
Expand Down Expand Up @@ -94,7 +94,7 @@ public function test_root_selector_can_be_dusk_hook()
$component->selector = '@dusk-hook-root';

$browser->within($component, function ($browser) {
$this->assertEquals('body [dusk="dusk-hook-root"]', $browser->resolver->prefix);
$this->assertSame('body [dusk="dusk-hook-root"]', $browser->resolver->prefix);
});
}

Expand All @@ -107,7 +107,7 @@ public function test_root_selector_can_be_element_alias()
$component->selector = '@component-alias';

$browser->within($component, function ($browser) {
$this->assertEquals('body #component-alias', $browser->resolver->prefix);
$this->assertSame('body #component-alias', $browser->resolver->prefix);
});
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Concerns/InteractsWithElementsTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laravel\Dusk\Tests\Conserns;
namespace Laravel\Dusk\Tests\Concerns;

use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\RemoteWebElement;
Expand Down
40 changes: 20 additions & 20 deletions tests/ElementResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,47 @@ public function test_resolve_for_typing_resolves_by_id()
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForTyping('#foo'));
$this->assertSame('foo', $resolver->resolveForTyping('#foo'));
}

public function test_resolve_for_typing_falls_back_to_selectors_without_id()
{
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForTyping('foo'));
$this->assertSame('foo', $resolver->resolveForTyping('foo'));
}

public function test_resolve_for_selection_resolves_by_id()
{
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForSelection('#foo'));
$this->assertSame('foo', $resolver->resolveForSelection('#foo'));
}

public function test_resolve_for_selection_falls_back_to_selectors_without_id()
{
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForSelection('foo'));
$this->assertSame('foo', $resolver->resolveForSelection('foo'));
}

public function test_resolve_for_radio_selection_resolves_by_id()
{
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForRadioSelection('#foo'));
$this->assertSame('foo', $resolver->resolveForRadioSelection('#foo'));
}

public function test_resolve_for_radio_selection_falls_back_to_selectors_without_id()
{
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForRadioSelection('foo', 'value'));
$this->assertSame('foo', $resolver->resolveForRadioSelection('foo', 'value'));
}

public function test_resolve_for_radio_selection_throws_exception_without_id_and_without_value()
Expand All @@ -77,70 +77,70 @@ public function test_resolve_for_checking_resolves_by_id()
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForChecking('#foo'));
$this->assertSame('foo', $resolver->resolveForChecking('#foo'));
}

public function test_resolve_for_checking_falls_back_to_selectors_without_id()
{
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForChecking('foo'));
$this->assertSame('foo', $resolver->resolveForChecking('foo'));
}

public function test_resolve_for_attachment_resolves_by_id()
{
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForAttachment('#foo'));
$this->assertSame('foo', $resolver->resolveForAttachment('#foo'));
}

public function test_resolve_for_attachment_falls_back_to_selectors_without_id()
{
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForAttachment('foo'));
$this->assertSame('foo', $resolver->resolveForAttachment('foo'));
}

public function test_resolve_for_field_resolves_by_id()
{
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForField('#foo'));
$this->assertSame('foo', $resolver->resolveForField('#foo'));
}

public function test_resolve_for_field_falls_back_to_selectors_without_id()
{
$driver = m::mock(stdClass::class);
$driver->shouldReceive('findElement')->once()->andReturn('foo');
$resolver = new ElementResolver($driver);
$this->assertEquals('foo', $resolver->resolveForField('foo'));
$this->assertSame('foo', $resolver->resolveForField('foo'));
}

public function test_format_correctly_formats_selectors()
{
$resolver = new ElementResolver(new stdClass);
$this->assertEquals('body #modal', $resolver->format('#modal'));
$this->assertSame('body #modal', $resolver->format('#modal'));

$resolver = new ElementResolver(new stdClass, 'prefix');
$this->assertEquals('prefix #modal', $resolver->format('#modal'));
$this->assertSame('prefix #modal', $resolver->format('#modal'));

$resolver = new ElementResolver(new stdClass, 'prefix');
$resolver->pageElements(['@modal' => '#modal']);
$this->assertEquals('prefix #modal', $resolver->format('@modal'));
$this->assertSame('prefix #modal', $resolver->format('@modal'));

$resolver = new ElementResolver(new stdClass, 'prefix');
$resolver->pageElements([
'@modal' => '#first',
'@modal-second' => '#second',
]);
$this->assertEquals('prefix #first', $resolver->format('@modal'));
$this->assertEquals('prefix #second', $resolver->format('@modal-second'));
$this->assertEquals('prefix #first-third', $resolver->format('@modal-third'));
$this->assertEquals('prefix [dusk="missing-element"]', $resolver->format('@missing-element'));
$this->assertSame('prefix #first', $resolver->format('@modal'));
$this->assertSame('prefix #second', $resolver->format('@modal-second'));
$this->assertSame('prefix #first-third', $resolver->format('@modal-third'));
$this->assertSame('prefix [dusk="missing-element"]', $resolver->format('@missing-element'));
}

public function test_find_by_id_with_colon()
Expand All @@ -154,6 +154,6 @@ public function test_find_by_id_with_colon()
$method->setAccessible(true);
$result = $method->invoke($resolver, '#frmLogin:strCustomerLogin_userID');

$this->assertEquals('foo', $result);
$this->assertSame('foo', $result);
}
}
6 changes: 3 additions & 3 deletions tests/WaitsForElementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function test_default_wait_time()
//
}

$this->assertEquals(2, floor(microtime(true) - $then));
$this->assertSame(2.0, floor(microtime(true) - $then));
}

public function test_default_wait_time_can_be_overridden()
Expand All @@ -43,7 +43,7 @@ public function test_default_wait_time_can_be_overridden()
//
}

$this->assertEquals(0, floor(microtime(true) - $then));
$this->assertSame(0.0, floor(microtime(true) - $then));
}

public function test_wait_using()
Expand Down Expand Up @@ -120,7 +120,7 @@ public function test_wait_for_text_failure_message_containing_a_percent_characte
$browser->waitForText('Discount: 20%', 1);
$this->fail('waitForText() did not timeout.');
} catch (TimeOutException $e) {
$this->assertEquals('Waited 1 seconds for text [Discount: 20%].', $e->getMessage());
$this->assertSame('Waited 1 seconds for text [Discount: 20%].', $e->getMessage());
}
}
}