2

I'm running the latest version of Codeception on a vagrant box and I can't get either the acceptance or functional testing working.

Here's acceptance.suite.yml:

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser
        - AcceptanceHelper
    config:
        PhpBrowser:
            url: 'http://test.dev'

and my acceptance test:

$I = new AcceptanceTester($scenario);
$I->wantTo('check Codeception');

$I->amOnPage('/');

$I->see('hello');

The index page is a simple html output with 'hello world'

The error I'm getting is as follows:

1) Failed to check codeception in testTestCept (/vagrant/test/tests/acceptance/testTestCept.php)
Sorry, I couldn't am on page "http://test.dev/":
GuzzleHttp\Exception\RequestException: cURL error 6: Couldn't resolve host 'test.dev'

Scenario Steps:
1. I am on page "http://test.dev/"

#1  /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Adapter/Curl/CurlAdapter.php:91
#2  /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Adapter/StreamingProxyAdapter.php:34
#3  /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Client.php:186
#4  /vagrant/fmx/vendor/symfony/browser-kit/Symfony/Component/BrowserKit/Client.php:332
#5  /vagrant/fmx/tests/acceptance/AcceptanceTester.php:128
#6  /vagrant/fmx/tests/acceptance/testTestCept.php:5
#1  /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Adapter/Curl/CurlAdapter.php:91
#2  /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Adapter/StreamingProxyAdapter.php:34
#3  /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Client.php:186
#4  /vagrant/fmx/vendor/symfony/browser-kit/Symfony/Component/BrowserKit/Client.php:332
#5  /vagrant/fmx/tests/acceptance/AcceptanceTester.php:128
#6  /vagrant/fmx/tests/acceptance/testTestCept.php:5

My functional test is just as simple:

$I = new FunctionalTester($scenario);
$I->wantTo('check Codeception');

$I->amOnPage('/');

$I->see('hello');

With this one I get the following error:

There was 1 error:

---------
1) Failed to check codeception in testTestCept (/vagrant/test/tests/functional/testTestCept.php)
#1  /vagrant/test/tests/functional/testTestCept.php:5
#2  /vagrant/test/tests/functional/testTestCept.php:5

Line 5 is specifically: $I->amOnPage('/');

I'm new to vagrant so I'm not sure if I've missed something in the setup or if I've done something else wrong. I'm running codeception through vagrant ssh.

UPDATE:

We've got the Acceptance testing working. Now just focusing on the Functional testing. As requested, below is the complete functional.suite.yml content. As I'm setting up in stages, I've not actually modified this:

# Codeception Test Suite Configuration

# suite for functional (integration) tests.
# emulate web requests and make application process them.
# Include one of framework modules (Symfony2, Yii2, Laravel4) to use it.

class_name: FunctionalTester
modules:
    enabled: [Filesystem, FunctionalHelper]
TH1981
  • 3,105
  • 7
  • 42
  • 78
  • I think `amOnPage()` method cannot accept full url. Try `amOnPage('/')` for your acceptance test (functional is another case so there is another problem). – Phantom Jun 27 '14 at 08:59
  • Sorry Phantom: I did actually try it both ways I missed the edit on the output to show it correctly I used `amOnPage('/')` and it still didn't work. – TH1981 Jun 27 '14 at 16:53
  • Try `url: 'http://test.dev:80'` – Laurence Jun 28 '14 at 05:29
  • tried that @The Shift Exchange and it didn't work. same result :/ – TH1981 Jul 01 '14 at 20:10
  • because you are running codeception within vagrant - perhaps it needs to be "localhost" or "http://192.168.0.1" or something like that. check your settings within vagrant for the website address – Laurence Jul 02 '14 at 05:39

1 Answers1

2

I had the same problem and this helped me:

unable to run codeception in virtual machine -Mink could not be found and loaded

I needed to add an entry in my /etc/hosts file for my site inside of my vm.

Community
  • 1
  • 1
JLeslie
  • 56
  • 6
  • woot! that's worked with my acceptance test, but my functional test is still failing. Could there be somewhere else in codeception that i have to update a path? :/ – TH1981 Jul 03 '14 at 20:04
  • I doubt it, since the functional tests don't use a webserver. Can you post your functional.suite.yml file? – JLeslie Jul 07 '14 at 15:15
  • added, but it's all the same as from the initial install. I've not changed anything here yet. It's still the same `amOnPage()` that's causing the error as it was in the acceptance testing which is why i hoped they were related :/ – TH1981 Jul 07 '14 at 20:39
  • I could be wrong, but it doesn't look like there is a framework set in your modules. Have you walked through the documentaiton found here: [Functional Test Documentation](http://codeception.com/docs/05-FunctionalTests) ? It will walk you through setting up your functional.suite.yml file. – JLeslie Jul 07 '14 at 21:32