From 6f87647cb3e6b98dcd816111416cb3acf6165ffb Mon Sep 17 00:00:00 2001 From: EwelinaLasowy Date: Tue, 18 Jan 2022 09:25:08 +0100 Subject: [PATCH] #17 - fix --- tests/Browser/AuthenticationTest.php | 3 ++- tests/Browser/Pages/HomePage.php | 22 +--------------------- tests/Browser/Pages/Page.php | 5 ----- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/tests/Browser/AuthenticationTest.php b/tests/Browser/AuthenticationTest.php index a583aab..adc1faa 100644 --- a/tests/Browser/AuthenticationTest.php +++ b/tests/Browser/AuthenticationTest.php @@ -6,6 +6,7 @@ namespace Tests\Browser; use Illuminate\Foundation\Testing\DatabaseMigrations; use Laravel\Dusk\Browser; +use Tests\Browser\Pages\HomePage; use Tests\DuskTestCase; use Toby\Models\User; @@ -25,7 +26,7 @@ class AuthenticationTest extends DuskTestCase { $this->browse(function (Browser $browser): void { $browser->loginAs($this->user) - ->visit("/") + ->visit(new HomePage()) ->assertVisible("@user-menu") ->click("@user-menu") ->assertVisible("@user-menu-list") diff --git a/tests/Browser/Pages/HomePage.php b/tests/Browser/Pages/HomePage.php index 9b351bb..8e12114 100644 --- a/tests/Browser/Pages/HomePage.php +++ b/tests/Browser/Pages/HomePage.php @@ -8,33 +8,13 @@ use Laravel\Dusk\Browser; class HomePage extends Page { - /** - * Get the URL for the page. - * - * @return string - */ public function url() { return "/"; } - /** - * Assert that the browser is on the page. - */ public function assert(Browser $browser): void { - // - } - - /** - * Get the element shortcuts for the page. - * - * @return array - */ - public function elements() - { - return [ - "@element" => "#selector", - ]; + $browser->assertPathIs($this->url()); } } diff --git a/tests/Browser/Pages/Page.php b/tests/Browser/Pages/Page.php index dcef466..954c185 100644 --- a/tests/Browser/Pages/Page.php +++ b/tests/Browser/Pages/Page.php @@ -8,11 +8,6 @@ use Laravel\Dusk\Page as BasePage; abstract class Page extends BasePage { - /** - * Get the global element shortcuts for the site. - * - * @return array - */ public static function siteElements() { return [