From 1536fe03c991efcca02fdf56780c763e9a9382ed Mon Sep 17 00:00:00 2001 From: Tony Lea Date: Sun, 15 Sep 2024 20:33:47 -0400 Subject: [PATCH] Adding updates to tests --- tests/Browser/ConfirmPasswordTest.php | 2 +- tests/Browser/ForgotPasswordTest.php | 2 +- tests/Browser/LogoutTest.php | 0 tests/Browser/Pages/ConfirmPassword.php | 2 +- tests/Browser/Pages/Login.php | 2 +- tests/Browser/Pages/PasswordResetRequest.php | 2 +- tests/Browser/Pages/Register.php | 2 +- tests/Browser/Pages/TwoFactorAuth.php | 2 +- tests/Browser/Pages/TwoFactorChallenge.php | 2 +- tests/Browser/Pages/VerifyEmail.php | 2 +- tests/Browser/RegisterTest.php | 2 +- tests/Browser/Traits.php | 2 +- tests/Browser/TwoFactorAuthTest.php | 2 +- tests/Browser/TwoFactorChallengeTest.php | 2 +- tests/Browser/VerifyEmailTest.php | 2 +- tests/Datasets/Urls.php | 2 +- tests/DuskTestCase.php | 9 ++------- tests/Pest.php | 13 +++++-------- tests/TestCase.php | 8 +------- 19 files changed, 23 insertions(+), 37 deletions(-) delete mode 100644 tests/Browser/LogoutTest.php diff --git a/tests/Browser/ConfirmPasswordTest.php b/tests/Browser/ConfirmPasswordTest.php index a3fdfa6..1435092 100644 --- a/tests/Browser/ConfirmPasswordTest.php +++ b/tests/Browser/ConfirmPasswordTest.php @@ -52,4 +52,4 @@ ->clickAndWaitForReload('@submit-button') ->assertSee('Test Confirmed'); }); -}); +}); \ No newline at end of file diff --git a/tests/Browser/ForgotPasswordTest.php b/tests/Browser/ForgotPasswordTest.php index b977a4f..67682bc 100644 --- a/tests/Browser/ForgotPasswordTest.php +++ b/tests/Browser/ForgotPasswordTest.php @@ -70,4 +70,4 @@ ->waitFor('@auth-login') ->assertPathIs('/auth/login'); }); -}); +}); \ No newline at end of file diff --git a/tests/Browser/LogoutTest.php b/tests/Browser/LogoutTest.php deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Browser/Pages/ConfirmPassword.php b/tests/Browser/Pages/ConfirmPassword.php index 2a85bd1..7b1a8e9 100644 --- a/tests/Browser/Pages/ConfirmPassword.php +++ b/tests/Browser/Pages/ConfirmPassword.php @@ -13,4 +13,4 @@ public function url(): string { return '/auth/password/confirm'; } -} +} \ No newline at end of file diff --git a/tests/Browser/Pages/Login.php b/tests/Browser/Pages/Login.php index ab9ddff..800244b 100644 --- a/tests/Browser/Pages/Login.php +++ b/tests/Browser/Pages/Login.php @@ -27,4 +27,4 @@ public function formLoginAsJohnDoe(Browser $browser) return $this; } -} +} \ No newline at end of file diff --git a/tests/Browser/Pages/PasswordResetRequest.php b/tests/Browser/Pages/PasswordResetRequest.php index 3834074..3aa986f 100644 --- a/tests/Browser/Pages/PasswordResetRequest.php +++ b/tests/Browser/Pages/PasswordResetRequest.php @@ -13,4 +13,4 @@ public function url(): string { return '/auth/password/reset'; } -} +} \ No newline at end of file diff --git a/tests/Browser/Pages/Register.php b/tests/Browser/Pages/Register.php index 3c4a306..e14fe1e 100644 --- a/tests/Browser/Pages/Register.php +++ b/tests/Browser/Pages/Register.php @@ -43,4 +43,4 @@ public function assertUserReceivedEmail() return $mail->hasTo($user->email); }); } -} +} \ No newline at end of file diff --git a/tests/Browser/Pages/TwoFactorAuth.php b/tests/Browser/Pages/TwoFactorAuth.php index 5da8ef3..6546c38 100644 --- a/tests/Browser/Pages/TwoFactorAuth.php +++ b/tests/Browser/Pages/TwoFactorAuth.php @@ -13,4 +13,4 @@ public function url(): string { return '/user/two-factor-authentication'; } -} +} \ No newline at end of file diff --git a/tests/Browser/Pages/TwoFactorChallenge.php b/tests/Browser/Pages/TwoFactorChallenge.php index f778491..4840914 100644 --- a/tests/Browser/Pages/TwoFactorChallenge.php +++ b/tests/Browser/Pages/TwoFactorChallenge.php @@ -13,4 +13,4 @@ public function url(): string { return '/auth/two-factor-challenge'; } -} +} \ No newline at end of file diff --git a/tests/Browser/Pages/VerifyEmail.php b/tests/Browser/Pages/VerifyEmail.php index 8da865d..fea562e 100644 --- a/tests/Browser/Pages/VerifyEmail.php +++ b/tests/Browser/Pages/VerifyEmail.php @@ -13,4 +13,4 @@ public function url(): string { return '/auth/verify'; } -} +} \ No newline at end of file diff --git a/tests/Browser/RegisterTest.php b/tests/Browser/RegisterTest.php index 09279ff..7df391c 100644 --- a/tests/Browser/RegisterTest.php +++ b/tests/Browser/RegisterTest.php @@ -64,4 +64,4 @@ }); }); -// Add more tests to test when the Name field is shown on the register page, or if the user keeps the password on a separate screen +// Add more tests to test when the Name field is shown on the register page, or if the user keeps the password on a separate screen \ No newline at end of file diff --git a/tests/Browser/Traits.php b/tests/Browser/Traits.php index f1dc961..24a724e 100644 --- a/tests/Browser/Traits.php +++ b/tests/Browser/Traits.php @@ -10,4 +10,4 @@ public function disableEmailVerification() { Config::set('devdojo.auth.settings.registration_require_email_verification', false); } -} +} \ No newline at end of file diff --git a/tests/Browser/TwoFactorAuthTest.php b/tests/Browser/TwoFactorAuthTest.php index bd61e69..8514f23 100644 --- a/tests/Browser/TwoFactorAuthTest.php +++ b/tests/Browser/TwoFactorAuthTest.php @@ -27,4 +27,4 @@ ->assertSee('Finish enabling two factor authentication'); }); $this->resetConfig(); -}); +}); \ No newline at end of file diff --git a/tests/Browser/TwoFactorChallengeTest.php b/tests/Browser/TwoFactorChallengeTest.php index 7ad9359..596f8a8 100644 --- a/tests/Browser/TwoFactorChallengeTest.php +++ b/tests/Browser/TwoFactorChallengeTest.php @@ -25,4 +25,4 @@ ->assertPathIs('/auth/two-factor-challenge'); }); $this->resetConfig(); -}); +}); \ No newline at end of file diff --git a/tests/Browser/VerifyEmailTest.php b/tests/Browser/VerifyEmailTest.php index 55f1f9d..52d9836 100644 --- a/tests/Browser/VerifyEmailTest.php +++ b/tests/Browser/VerifyEmailTest.php @@ -52,4 +52,4 @@ }); $this->resetConfig(); -}); +}); \ No newline at end of file diff --git a/tests/Datasets/Urls.php b/tests/Datasets/Urls.php index 9673208..a98f8b1 100644 --- a/tests/Datasets/Urls.php +++ b/tests/Datasets/Urls.php @@ -6,4 +6,4 @@ '/auth/verify', '/auth/password/reset', '/auth/password/SomeReallyLongtoken', -]); +]); \ No newline at end of file diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php index e2e8590..9bf19b8 100644 --- a/tests/DuskTestCase.php +++ b/tests/DuskTestCase.php @@ -6,6 +6,7 @@ use Facebook\WebDriver\Chrome\ChromeOptions; use Facebook\WebDriver\Remote\DesiredCapabilities; use Facebook\WebDriver\Remote\RemoteWebDriver; +use Illuminate\Support\Collection; use Laravel\Dusk\TestCase as BaseTestCase; use PHPUnit\Framework\Attributes\BeforeClass; @@ -13,12 +14,6 @@ abstract class DuskTestCase extends BaseTestCase { use UsesDuskApiConfig; - // protected function setUp(): void - // { - // // $this->resetConfig(); - // parent::setUp(); - // } - /** * Prepare for Dusk test execution. */ @@ -26,7 +21,7 @@ abstract class DuskTestCase extends BaseTestCase public static function prepare(): void { if (! static::runningInSail()) { - static::startChromeDriver(); + static::startChromeDriver(['--port=9515']); } } diff --git a/tests/Pest.php b/tests/Pest.php index 50e4fe7..2966726 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -5,8 +5,6 @@ // Illuminate\Foundation\Testing\DatabaseMigrations::class, )->in('Browser'); -use Illuminate\Foundation\Testing\RefreshDatabase; - /* |-------------------------------------------------------------------------- | Test Case @@ -14,14 +12,13 @@ | | The closure you provide to your test functions is always bound to a specific PHPUnit test | case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may -| need to change it using the "uses()" function to bind a different classes or traits. +| need to change it using the "pest()" function to bind a different classes or traits. | */ -uses( - Tests\TestCase::class, - RefreshDatabase::class, -)->in('Feature'); +pest()->extend(Tests\TestCase::class) + ->use(Illuminate\Foundation\Testing\RefreshDatabase::class) + ->in('Feature'); /* |-------------------------------------------------------------------------- @@ -72,4 +69,4 @@ function createUser($data) function withANewUser() { return test()->actingAs(User::factory()->create()); -} +} \ No newline at end of file diff --git a/tests/TestCase.php b/tests/TestCase.php index f1ac0a1..fe1ffc2 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,14 +3,8 @@ namespace Tests; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; -use Illuminate\Support\Facades\Artisan; abstract class TestCase extends BaseTestCase { - protected function setUp(): void - { - parent::setUp(); - Artisan::call('view:clear'); - - } + // }