dillingham / nova-assertions

Laravel Nova assertions for your tests
MIT License
79 stars 16 forks source link

Basic Laravel 8 installation + Nova 3 allways 403 #22

Closed Chema-TM closed 3 years ago

Chema-TM commented 3 years ago

Hello,

I have a problem with a simple test. It always returns a 403 status instead of the expected 200. What am I doing wrong?

The first assertion works as expected, but the second one always returns the same result, 403.

<?php

namespace Tests\Feature;

use NovaTesting\NovaAssertions;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
use App\Models\User;

class UserHasUiAccessTest extends TestCase
{
    use NovaAssertions;

    /** @test */
    function user_has_ui_access()
    {
        $user = User::factory()->create();
        $this->be($user);
        $this->assertAuthenticatedAs($user);

        $response = $this->novaIndex('users');

        $response->assertStatus(200);
    }
}

I am running the test on a clean project where I have only installed Laravel 8 and Laravel Nova 3.

Thanks a lot

Chema-TM commented 3 years ago

Sorry,

The problem has nothing to do with the package. The problem was in the configuration of the environment.

Being testing, the Nova access gate is returning false, so I never had access.