Files
coolify/tests/Browser/LoginTest.php
ALsJourney cddd4b59f9 Added a basic login test and also added 2 small variables to dev .env file
Small test just to see if you wish to continue this way of me writing tests in this shape and form. you can run them locally with php artisan dusk:chrome-driver --detect, run it with ./vendor/laravel/dusk/bin/chromedriver-mac-arm --port=9515  then run tests with php artisan dusk
2024-09-06 14:16:40 +02:00

31 lines
773 B
PHP

<?php
namespace Tests\Browser;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;
use Throwable;
class LoginTest extends DuskTestCase
{
/**
* A basic test for the login page.
* Login with the test user and assert that the user is redirected to the dashboard.
*
* @return void
* @throws Throwable
*/
public function testLogin()
{
$email = config('testing.dusk_test_email');
$password = config('testing.dusk_test_password');
$this->browse(function (Browser $browser) use ($password, $email) {
$browser->visit('/login')
->type('email', $email)
->type('password', $password)
->press('Login')
->assertPathIs('/');
});
}
}