Closed thburghout closed 5 years ago
@thburghout have you tried 'configure-laravel' without modifying file permissions yourself?
I see, there seems to be something else going on.
Tests which previously succeeded now fail because of "invalid domain" errors when setting cookies.
1) Tests\Browser\AdminProductTest::test_user_sees_no_products_until_added
Facebook\WebDriver\Exception\UnrecognizedExceptionException: invalid argument: invalid 'domain'
(Session info: headless chrome=77.0.3865.90)
(Driver info: chromedriver=77.0.3865.40 (f484704e052e0b556f8030b65b953dce96503217-refs/branch-heads/3865@{#442}),platform=Linux 4.19.23-coreos-r1 x86_64)
/builds/project/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:158
/builds/project/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:326
/builds/project/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:547
/builds/project/vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php:40
/builds/project/vendor/facebook/webdriver/lib/WebDriverOptions.php:55
/builds/project/vendor/laravel/dusk/src/Concerns/InteractsWithCookies.php:70
...
Which is weird, as those tests would previously succeed. I'm going to investigate this further.
@thburghout please check your .env settings and are you sure you are running all your tests locally in gitlab-runner not hitting remote systems?
I did not change the env settings w.r.t. the previous runs. My .env file looks like this;
APP_ENV=testing
APP_DEBUG=true
APP_KEY=base64:iPNqnlA8ga5QaFJZ5lr+xMIoyGFHBCbLvypGZkNmWUk=
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
QUEUE_DRIVER=sync
BROADCAST_DRIVER=pusher
SESSION_DRIVER=file
SESSION_SECURE_COOKIE=false
MIX_PUSHER_KEY=xxxxxxxxxx
PUSHER_SECRET=xxxxxxxxxxxx
PUSHER_APP_ID=999999
MAIL_DRIVER=log
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM=x@xx.xx
MAIL_SENDER="xx xx xx"
MOLLIE_TEST_MODE=true
MOLLIE_KEY_TEST=test_xxxxxxxxx
GOOGLE_MAPS_API_KEY=xxxxxxxx
TELEGRAM_BOT_TOKEN=999999999:aaaaaaaaa-aaaaaaaaaa-aaaaaaaaaaaaaa
TELEGRAM_BOT_NAME=xxxxxx
DEBUGBAR_ENABLED=true
Printing the browser's url before setting the cookie yields http://localhost/_dusk/login/1
in the following snippet;
$second->loginAs($admin);
$url = $second->driver->getCurrentURL();
Log::info($url);
echo $url . "\n";
$second->addCookie('device_token', $token)
->visit('/')
@thburghout did you check withCookie
?
What Laravel version are you on?
Please post your new errors...
Still running into the same issue as https://github.com/chilio/laravel-dusk-ci/issues/52#issuecomment-536753911
I'm using Laravel v5.7.3 and Dusk v4.0.3.
Please also note this output during execution;
System Chrome version: 77
System Chromedriver version: 77.0
Laravel Chromedriver version: 2.35
Chromedriver shipped with your Laravel installation is NOT compatible with current system chrome version!
Don't worry, we are fixing this right now, and you will be able, to test your app anyway.
Read more, about running tests with system inbuilt chromedriver in laravel-dusk-ci docs.
Starting inbuilt Chromedriver (77.0).
Waiting for inbuilt Chromedriver to launch on port 9515...
Starting ChromeDriver 77.0.3865.40 (f484704e052e0b556f8030b65b953dce96503217-refs/branch-heads/3865@{#442}) on port 9515
Why does it only behave this way when using configure-laravel
? Is the chosen Chromedriver version correct?
@thburghout yes the version is correct. Due to problems with chrome <-> chromedriver matching different updates, this package has it's own ability to actually run correct chromedriver on 9515 port.
The procedure is only included in configure-laravel command, therefore it is important to run this command. This approach is transparent and should not interfere with any of your workflows. After running this command you may issue any other commands specific to your project.
I assume the problem arises when you are trying to set cookie inside dusk test procedure, which I think could not work this way. Please check https://stackoverflow.com/questions/37441736/how-to-set-cookie-before-test-in-laravel
The link you're providing only considers phpunit and its fake HTTP requests. The same goes for your withCookie
suggestion; this is part of local testing, not browser testing with chromedriver.
Today I've further investigated the issue. Unfortunately using configure-laravel
causes issues with my dusk + facebook/webdriver version; which does not seem to be aware of cookie domains. I would like to say that the note Don't worry, we are fixing this right now, and you will be able, to test your app anyway.
is therefore not correct.
On the other hand, I've successfully updated my Dusk + webdriver to the latest version. Which is a good thing anyway. This resolved the Cookie domain issue with this docker image. However, now I'm back at my original issue regarding file permissions of log files.
So the issue remains exactly the same as it is in my initial comment. The screenshot below shows the browser output during this tests. Logging still shows directories created as root
user.
Can you tell me more about which user runs the php-fpm process? It should be www-data
right?
It was the php artisan dusk
process, running as root, invoking procedures which utilize the cache. The cache was set to file, I needed to change this to array
in .env
.
Hi,
First, thank you for the great work. Setting up Dusk with this docker container was a breeze.
However, I'm running into some issues with file permissions. The following (last part of) the build shows an error occuring in one of the tests. This error occurs because the webserver is unable to create a cache file.
Given the following gitlab yml:
I'm confused, because the build output shows files created as root. I was under the impression that the php process would be running as www-data.
Any input is appreciated.