Comments (15)
As @ptmkenny expanded elsewhere in another issue:
The relevant part is this:
extensions:
Behat\MinkExtension:
base_url: 'http://YOUR_MACHINE_IP:LANDO_APPSERVER_PORT_NUMBER'
You will need to use the IP address of the machine on the local network. You can get this from ipconfig /all run from cmd.exe as an Admin. Make sure to use the ip4 address for your local network, not for DockerNAT (the correct IP should be like 192.168...).
Also, you need to substitute the lando appserver port number, which you can get from lando info and then looking for the http port number for appserver.
I found that ipconfig did not give me a good IP address. To get the real one beginning 192.168 I needed to look in settings a detailed here: https://www.windowscentral.com/4-easy-ways-find-your-pc-ip-address-windows-10-s#ip_address_settings
from docs.
to run lando behat
you'd need to define a tooling entry that used the appserver:
tooling:
behat:
service: appserver
from docs.
@dustinleblanc Thanks, I added that to my lando.yml
and then ran lando rebuild
.
Then I tried running lando behat
, but I'm getting:
/bin/sh: 1: behat: not found
Windows 10 Pro, running from powershell.
from docs.
Ok, more info.
So far, I have been able to get lando behat
running like this by specifying, in .lando.yml
:
tooling:
behat:
service: appserver
description: Run behat tests locally.
cmd:
- /app/vendor/bin/behat
Tests can be run using this .behat.yml
:
default:
suites:
default:
contexts:
- FeatureContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
extensions:
Behat\MinkExtension:
goutte: ~
selenium2: ~
base_url: http://mysite.lndo.site
Drupal\DrupalExtension:
blackbox: ~
api_driver: 'drupal'
drupal:
drupal_root: '/app/web'
drush:
root: '/app/web'
The command I am using is:
lando behat --config=tests/behat.yml
But, this results in an error when attempting to connect to localhost:
And I am logged in as a user with the "administrator" role # Drupal\DrupalExtension\Context\DrupalContext::assertAuthenticatedByRole()
cURL error 7: Failed to connect to localhost port 80: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) (GuzzleHttp\Exception\ConnectException)
│
╳ Unable to access the response before visiting a page (Behat\Mink\Exception\DriverException)
│
So, the problem is that the behat drush extension is trying to connect to mysite.lndo.site on port 80. How do I fix this?
from docs.
Ok, so here is a solution. On Windows, apparently you need to give behat the IP address of the host (ipconfig /all
) when running behat through docker like this:
base_url: http://192.168.x.x:32888
I can run the tests this way using lando behat
.
from docs.
from docs.
@ptmkenny you might be able to get around this by hacking the windows hosts file as well.
Also would love to see this knowledge added to some of our behat docs if you've got the time for a PR!
from docs.
@pirog I've kept notes that I will clean up and turn into documentation later. Still trying to fix some issues; when I get it all working reliably, I'll add the doc.
from docs.
I have on behat-pantheon.yml
local:
suites:
default:
contexts:
- FeatureContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
extensions:
Behat\MinkExtension:
goutte: ~
selenium2: ~
base_url: 'http://nginx:80'
Drupal\DrupalExtension:
blackbox: ~
api_driver: 'drupal'
drupal:
drupal_root: '/app/web'
drush:
root: '/app/web'
and run
lando behat --config=/app/tests/behat-pantheon.yml --profile local
and works for me.
from docs.
The IP address changes sometimes, perhaps when you move to a different wifi. So hardcoding an IP into behat.yml is a HORRIBLE workaround. I believe behat.yml does allow you to pick up environment variables, so maybe there's a way we could put the current ip into an environment variable and then put that variable into behat's base_url.
from docs.
So far, I have seen absolutely no issues on any platform with using the service hostname as the host for Behat. You should never have to make Behat look outside of docker's network to run any of these tests. Docker provides a private network for each app so that all services can find each other at unique hostnames defined by their service name. Just use http://nginx
and move on with life. You don't need the internet or a proxy for this to work. I've done this with behat's defaults, I've done it with PhantomJS, I've done it with Chromedriver, just use the private network and life is easy no matter where the app ends up (local dev, CI, your buddy's laptop where they use a different proxy domain).
from docs.
from docs.
Ok, if I switch to via:nginx in my lando.yml then "http://nginx" works. However previously if I left the drupal8 recipe at its default, then "http://apache" didn't work. Thanks guys!
from docs.
👍 There will be some name for the service, lando info
probably would show you 'appserver' or 'web' or something
from docs.
For anyone else finding in the future, the required host for the Drupal 8 recipe has now changed: it's http://appserver_nginx
from docs.
Related Issues (20)
- Document that SQLite is included? HOT 6
- installation from source docs out of date? HOT 1
- What to do next when URLs are red, but nslookup passes HOT 1
- WSL Guide unclear HOT 2
- 'learn more' button links to main page HOT 1
- Broken Link to Tooling Docs Page HOT 1
- Using Let's Encrypt SSL certificate
- Hello World example broken in Windows Powershell 7?
- export XDEBUG_SESSION="PHPSTORM" doesn't initiate listening in PhpStorm
- CLI value types HOT 1
- set docker-ce as a hard dependency for our packages?
- "myriad examples" link broken
- Add documentation how to use the YAML merge key (example supplied)
- How to do string concatenation in lando yml file? HOT 1
- Automate Sitemap Index Creation
- post vitepress tasks
- How to keep anonymous volumes when running 'lando rebuild'?
- Lando recipe for SonarQube
- What is the correct way to install on Windows/WSL2? HOT 5
- Better lando.yml Documentation HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docs.