I think you are trying to achieve this?
it('redirect to a 404 error page', function () {
$not_found = 'page/which/not/exsist';
$this->get($not_found)
->assertStatus(404)
->assertSee('hello world');
});
If open up the dev tools, if a page is not found, the status code will be 404, the response body has the view, so if you want to check if your custom error page is being rendered, you can assert that you see a header or an string :)
Above I am testing my custom error page resources/views/errors/404.blade.php, which contains hello world and the test is passing as expected.
I swapped test with it as I feel it is more coinvent and readable, and you can see the docs is using that keyword as well