Running dusk tests on Homestead for Windows - windows

I'm using homestead on windows 10 and installed laravel 5.4 when I'm trying to run dusk tests I get the following error:
1) Tests\Feature\ViewProductListingTest::user_can_view_product_listing
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY"}}
Failed to connect to localhost port 9515: Connection refused
Has anybody had any luck getting around this?
Thanx.

I encountered this very problem today. I spent like 2 hours researching and finally resolved it by following the steps posted on this comment.
I ran the original basic test and it passed. I'll try to run more complex test and hopefully the solution still works.
It seems to me that the Homestead lacks some necessary software(Chrome, xvfb etc.) to run browser tests with Laravel Dusk. That's what that comment is trying to install.
Hope this helps!

I ran into this issue before and was not able to completely resolve it.
The connection refused error occured for me because the execution scripts for dusk in /vendor/laravel/dusk/bin were not set executable inside Homestead.
So i used a chmod 777 on those scripts.
After that it complained that if couldn't find an executable chrome binary, so i installed google-chrome in Homestead.
After I installed google chrome, the tests ran, but timed out before they could finish which i am researching now.

I ran into the same issue (but I'm on macOS Sierra). If you can, instead of running Dusk from the Homestead VM, run it from your host machine. Just make sure the DB_HOST value in your .env file is set to the hostname you use to access the site in your browser.
So for example, if you configured the Homestead site to be accessible at mycoolsite.app, use that as your DB_HOST value.
I know this is more of a workaround for situations where your host machine might be able to run it OK, but it's working for me at the moment if you can give it a try.

Related

Kyma restart issue in local

I have installed Kyma version 1.13.0 on Windows, it's working fine if I don't restart my machine or minikube. But when I restart minikube by following steps provided in the below link. Kyma is not working.
https://kyma-project.io/docs/latest/root/kyma#installation-install-kyma-locally-stop-and-restart-kyma-without-reinstalling
I need to reinstall kyma again to make it work.
Any help would be appreciated
This sounds similar to what I get on my Windows machine.
This is the error that I get after restarting minikube.
stderr:
error execution phase addon/coredns: unable to patch the CoreDNS deployment: Timeout: request did not complete within requested timeout 30s
To see the stack trace of this error execute with --v=5 or higher
If you get same error, this has been reported as a bug.
https://github.com/kyma-project/cli/issues/455
My solution to this issue is to get the kyma working by issuing provision command twice, so give it a try.

Homestead server times out when route not found

Accessing any invalid/non existing route on fresh laravel app returns halts & timeout after 60 seconds.
Error: The process "git status -s" exceeded the timeout of 60 seconds.
Same code works fine fine locally on xampp and returns method/controller not found within a couple of seconds. Please guide.
P.S: Seems like git status takes a lot of time inside vagrant ssh, but it works fine on host machine. What also bothers me is why git status command is being run when accessing route?
Host: Windows 10
Box: v9.2.0.
Virtualbox v6.1.2
Vagrant: v2.2.6
Ok, so turns out the laravel error page package ignition is causing all the problems.
There is an ongoing issue on there github page and multiple solution including the git status issue.

Angular cli stopped live recompiling when saving changes

I tried few solutions on my Mac for solving DNS_PROBE_FINISHED_NXDOMAIN error, and since that my Angular projects are running, but when I save changes, it is not auto recompiling(looks like the watch is not responding).
The steps that I did before it started were:
- renew DHCP lease in the TCP/IP of network settings tab.
- adding DNS server address.
- running this command in the terminal: dscacheutil -flushcache.
EDIT - When I run ng serve --watch the recompiling works, but without the --watch it is not working.
Problem solved!
after running once the ng serve -- watch running only the ng-serve started to work again!
Hope I manage to help someone with this issue and solution...

Can start ChromeDriver within CLI tool but won't allow connections

I'm using Laravel homestead and I'm writing a little artisan command line tool that I need to browse my site with javascript execution.
I run dusk test regularly with no difficulty, so I thought I would use Laravel's tools for this script.
I started out by running this early in my script:
\Laravel\Dusk\TestCase::startChromeDriver();
This started the driver fine running on port 9515 running as user vagrant (default homestead user)
But when I tried to access it (also from within the script) I would get an error:
Failed to connect to localhost port 9515: Connection refused
If I instead started it manually on the command line:
$ ./vendor/laravel/dusk/bin/chromedriver-linux --port=9515
The driver started fine again running on port 9515 as user vagrant, but this time my tool runs fine.
But I really want to be able to start the ChromeDriver from within the tool. So I also tried:
$process = new \Symfony\Component\Process\Process('./vendor/laravel/dusk/bin/chromedriver-linux --port=9515');
$process->start();
Connection was refused again.
Any idea why this works when I start it from the command line but not within my artisan command?
I can't explain why this makes a difference but it has. If I launch the driver with the full path:
/home/vagrant/Code/mysite/vendor/laravel/dusk/bin/chromedriver-linux --port=8888
all works fine now.

"https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Operation timed out

This morning, I ran this command
composer create-project laravel/laravel laravel-4.2 4.2 --prefer-dist
I kept getting
The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Operation timed out
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Anyone know how to avoid this ?
For me, this wasn't an issue with my internet connection speed, but it was a issue with IPv6 resolution of "repo.packagist.org". I got around this issue by adding the IPv4 address to my hosts file. It's a hack, but it works.
# dig +short repo.packagist.org
142.44.164.255
# echo "142.44.164.255 repo.packagist.org" >> /etc/hosts
More details here!
try this solution worked for me!
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
and run composer:update once again. If not then run composer self-update
I got the answer here and it works like voodoo...
For me it was ipv6, I disabled it using: networksetup -setv6off Wi-Fi on macOS. Worked like a charm.
Solution found here: https://getcomposer.org/doc/articles/troubleshooting.md#operation-timed-out-ipv6-issues-
The problem is most likely with your internet connect. Just try with another (or a more reliable) source of internet.
If problem persists, and you are sure of your internet connection, then checkout suggestions here.
I have heard this problem can occur if you live in an area behind a government firewall, you might want to test if it works when behind a VPN.
This question is similar to this: Installing laravel suddenly some json file cannot be downloaded
This is the answer that worked for me:
This worked on Linux. It prioritizes ipv4 over ipv6
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
This problem occurs for your low speed or bad connection. It failed to access internet and download repository.
Check your internet connection and try again to connect your console to the internet.
Mostly it happens when you did not get the response from the server.
1. check internet connection.
2. check any proxy block your response from the server.
3. if block proxy. When installing the composer that time you set proper proxy configuration on your installation process.
4. You should check your admin user privilege.
5. If you guest or limited account. You can not download any file from the outside server.
The problem is due to slow internet connection or no internet. If there is no internet then The packages are unable to download from the server. that's why it gives this error i had face many time.
Switch to a mirror according to your location :
https://packagist.org/mirrors
Especially if you're in China.
On linux, it seems that running this command helps to make ipv4 traffic have a higher prio than ipv6, which is a better alternative than disabling ipv6 entirely:
Workaround Linux:
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"enter image description here
export no_proxy=.github.com,.getcomposer.org
You can just add this code in your composer directory and hit enter. Then try again. While I was working on Magento 2 sample data deployment, I got the same error. This code did help me to continue the process.
Forcing the use of https with composer fix this. For anyone else who sees this, run the following to force composer to use https.
composer config -g repo.packagist composer https://packagist.org
Clearing the DNS cache fixed this for me.
In the terminal execute:
dscacheutil -flushcache
sudo killall -HUP mDNSResponder

Resources