Skip to content

Commit

Permalink
Adding updates to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tnylea committed Sep 16, 2024
1 parent 9545687 commit 1536fe0
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 37 deletions.
2 changes: 1 addition & 1 deletion tests/Browser/ConfirmPasswordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
->clickAndWaitForReload('@submit-button')
->assertSee('Test Confirmed');
});
});
});
2 changes: 1 addition & 1 deletion tests/Browser/ForgotPasswordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
->waitFor('@auth-login')
->assertPathIs('/auth/login');
});
});
});
Empty file removed tests/Browser/LogoutTest.php
Empty file.
2 changes: 1 addition & 1 deletion tests/Browser/Pages/ConfirmPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public function url(): string
{
return '/auth/password/confirm';
}
}
}
2 changes: 1 addition & 1 deletion tests/Browser/Pages/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public function formLoginAsJohnDoe(Browser $browser)

return $this;
}
}
}
2 changes: 1 addition & 1 deletion tests/Browser/Pages/PasswordResetRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public function url(): string
{
return '/auth/password/reset';
}
}
}
2 changes: 1 addition & 1 deletion tests/Browser/Pages/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ public function assertUserReceivedEmail()
return $mail->hasTo($user->email);
});
}
}
}
2 changes: 1 addition & 1 deletion tests/Browser/Pages/TwoFactorAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public function url(): string
{
return '/user/two-factor-authentication';
}
}
}
2 changes: 1 addition & 1 deletion tests/Browser/Pages/TwoFactorChallenge.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public function url(): string
{
return '/auth/two-factor-challenge';
}
}
}
2 changes: 1 addition & 1 deletion tests/Browser/Pages/VerifyEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public function url(): string
{
return '/auth/verify';
}
}
}
2 changes: 1 addition & 1 deletion tests/Browser/RegisterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/Browser/Traits.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public function disableEmailVerification()
{
Config::set('devdojo.auth.settings.registration_require_email_verification', false);
}
}
}
2 changes: 1 addition & 1 deletion tests/Browser/TwoFactorAuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
->assertSee('Finish enabling two factor authentication');
});
$this->resetConfig();
});
});
2 changes: 1 addition & 1 deletion tests/Browser/TwoFactorChallengeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
->assertPathIs('/auth/two-factor-challenge');
});
$this->resetConfig();
});
});
2 changes: 1 addition & 1 deletion tests/Browser/VerifyEmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
});
$this->resetConfig();

});
});
2 changes: 1 addition & 1 deletion tests/Datasets/Urls.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
'/auth/verify',
'/auth/password/reset',
'/auth/password/SomeReallyLongtoken',
]);
]);
9 changes: 2 additions & 7 deletions tests/DuskTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,22 @@
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;

abstract class DuskTestCase extends BaseTestCase
{
use UsesDuskApiConfig;

// protected function setUp(): void
// {
// // $this->resetConfig();
// parent::setUp();
// }

/**
* Prepare for Dusk test execution.
*/
#[BeforeClass]
public static function prepare(): void
{
if (! static::runningInSail()) {
static::startChromeDriver();
static::startChromeDriver(['--port=9515']);
}
}

Expand Down
13 changes: 5 additions & 8 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@
// Illuminate\Foundation\Testing\DatabaseMigrations::class,
)->in('Browser');

use Illuminate\Foundation\Testing\RefreshDatabase;

/*
|--------------------------------------------------------------------------
| Test Case
|--------------------------------------------------------------------------
|
| 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');

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -72,4 +69,4 @@ function createUser($data)
function withANewUser()
{
return test()->actingAs(User::factory()->create());
}
}
8 changes: 1 addition & 7 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

}
//
}

0 comments on commit 1536fe0

Please sign in to comment.