dillingham / nova-assertions

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

novaEdit method have error after Nova 3.11.0 #10

Closed bolechen closed 3 years ago

bolechen commented 4 years ago

My testcase looks like this:

$this->novaEdit('users', $user->id)->assertSee(json_encode($user->nickname), false);

At Nova 3.10.0 is run success, when i upgrade to 3.1.1 the result is 404 not found error.

I'm trying to find out why, at this commit

https://github.com/laravel/nova/commit/d38616b2afa760f4475a046d5d1c3efa9f839650

when i comment out this line

app()->instance(NovaRequest::class, $request);

every thing is ok, but i dont know how to fix it. Can you help me to look this.

thx so much for this package.

bolechen commented 4 years ago

UPDATE:

this case when i call novaEdit after novaIndex will fail, otherwise will pass.

// will fail
$this->novaIndex('users')->assertOK();
$this->novaEdit('users', $admin->id)->assertOK();
// pass
// $this->novaIndex('users')->assertOK();
$this->novaEdit('users', $admin->id)->assertOK();
dillingham commented 3 years ago

@bolechen Its performing multiple requests in 1 test which can sometimes have odd outcomes in my experience. Im not really sure what to do to "fix" this as all Im doing is calling getJson twice. Maybe just keep to 1 request per test