joshuafranks's avatar

[Dusk] Test passes when ran individually but fails when ran as part of a suite.

I've got two tests that, when ran individually, pass. If I run the entire dusk test suite, I get a failure on my second test:

Error:

ReflectionException: Class env does not exist

/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Container/Container.php:779
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Container/Container.php:658
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Container/Container.php:609
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:733
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Container/Container.php:1222
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:497
/home/vagrant/code/portfoliyo/app/Providers/TelescopeServiceProvider.php:22
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php:60
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php:60
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Support/Collection.php:455
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php:61
/home/vagrant/code/portfoliyo/vendor/laravel/telescope/src/Telescope.php:222
/home/vagrant/code/portfoliyo/vendor/laravel/telescope/src/Telescope.php:195
/home/vagrant/code/portfoliyo/vendor/laravel/telescope/src/Telescope.php:225
/home/vagrant/code/portfoliyo/vendor/laravel/telescope/src/Telescope.php:249
/home/vagrant/code/portfoliyo/vendor/laravel/telescope/src/Watchers/CacheWatcher.php:63
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:360
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:209
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Cache/Repository.php:497
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Cache/Repository.php:103
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php:323
/home/vagrant/code/portfoliyo/vendor/laravel/telescope/src/Watchers/DumpWatcher.php:43
/home/vagrant/code/portfoliyo/vendor/laravel/telescope/src/RegistersWatchers.php:48
/home/vagrant/code/portfoliyo/vendor/laravel/telescope/src/Telescope.php:110
/home/vagrant/code/portfoliyo/vendor/laravel/telescope/src/TelescopeServiceProvider.php:27
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Container/Container.php:572
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:793
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:776
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:777
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:206
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:297
/home/vagrant/code/portfoliyo/tests/CreatesApplication.php:18
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:91
/home/vagrant/code/portfoliyo/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:68
/home/vagrant/code/portfoliyo/vendor/laravel/dusk/src/TestCase.php:23

Test:

    function the_editor_preview_updates_when_inputs_are_altered()
    {
        $template = factory(Template::class)->create([
            'content' => '{{ heading }} {{ subheading }} {{ body }}',
        ]);

        $portfolio = factory(Portfolio::class)->create([
            'template_id' => $template->id,
            'content' => null,
        ]);

        $contentVariables = $template->content_variables;

        $this->browse(function (Browser $browser) use ($portfolio, $contentVariables)
        {
            $browser->visit(route('portfolios.content.create', $portfolio->id))
                ->assertSee('Design Portfolio')
                ->assertSee('{{ heading }}')
                ->assertSee('{{ subheading }}')
                ->assertSee('{{ body }}')
                ->type('template_content[heading]', 'My Heading')
                ->assertSee('My Heading')
                ->type('template_content[subheading]', 'My Subheading')
                ->assertSee('My Subheading')
                ->type('template_content[body]', 'My Body')
                ->assertSee('My Body');
        });
    }
0 likes
1 reply

Please or to participate in this conversation.