1 year ago

Laravel 5.7 dusk login testing fails with wrong credentials

Posted 1 year ago by ThePoet444

I am writing code to transition users from our current php crypt(), to bcrypt. Which according to other tests i've written, seems to work. So now I'm checking the front end and started to write tests for Dusk finally. Following the example in the (Laravel Docs)[] it keeps failing and giving me a screenshot with the error of "These credentials do not match our records". Which makes sense since the DB is empty... but when using DB Migrations and a user factory set to create.. you would think it should pass then. Anyone know where I goofed? the User factory is the same from the docs.



namespace Tests\Browser;

use App\User;
use Illuminate\Support\Facades\Hash;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;

class LoginTest extends DuskTestCase
    use DatabaseMigrations;

     * A basic browser test example.
     * @return void

    /** @test */
    public function a_users_pass_will_convert_from_current_rs_hash_to_new_hash()
        $user = factory(User::class)->create();

        $this->browse(function ($browser) use ($user) {
                ->type('email', $user->email)
                ->type('password', 'secret')

        $this->assertTrue(Hash::check('secret', $user->password));

Please sign in or create an account to participate in this conversation.