Laravel Dusk: How to change config values before each test for the browser?

。_饼干妹妹 提交于 2019-12-11 04:14:05

问题


I'm trying to alter some config values before each test. However, the browser does not apply them.

In my DuskTestCase file:

abstract class DuskTestCase extends BaseTestCase
{
    use CreatesApplication;

    protected function setUp()
    {
        parent::setUp();

        config()->set('cookie-consent.enabled', false);
        config()->set('app.recaptcha', false);
        config()->set('localization.acceptLanguage', false);
    }

    /**
     * Prepare for Dusk test execution.
     *
     * @beforeClass
     * @return void
     */
    public static function prepare()
    {
        static::startChromeDriver();
    }

    ...

The config values are correctly set in each test, but not for the browser. When I remove the '--disable-gpu' I clearly see that the browser is still using the old config values.

How can this be changed as well?

来源:https://stackoverflow.com/questions/54407784/laravel-dusk-how-to-change-config-values-before-each-test-for-the-browser

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!