0

I have a Symfony2 project, but I cannot get WebDriver configured properly. I have installed facebook webdriver and codeception with composer:

facebook/webdriver: versions : * 1.1.3

codeception/codeception: versions : * 2.2.5

I followed these instructions (and when autoload failed, many other sources without success): http://codeception.com/11-20-2013/webdriver-tests-with-codeception.html

codeception.yml in project root:

actor: Tester
paths:
    tests: tests
    log: tests/_output
    data: tests/_data
    support: tests/_support
    envs: tests/_envs
settings:
    bootstrap: _bootstrap.php
    colors: true
    memory_limit: 1024M
extensions:
    enabled:
        - Codeception\Extension\RunFailed
        - WebDriver
    config:
        WebDriver:
            url: 'http://localhost/'
            browser: firefox
            port: 4444
modules:
    config:
        Db:
            dsn: ''
            user: ''
            password: ''
            dump: tests/_data/dump.sql

I have acceptance tests generated, and when I run codeception, following error occurs:

[Codeception\Exception\ConfigurationException]
Class `WebDriver` is not defined. Autoload it or include into '_bootstrap.php' file of 'tests' directory

I've tried adding this into tests/_bootstrap.php: require_once __DIR__.'/../vendor/codeception/codeception/src/Codeception/Module/WebDriver.php';

The path above is correct, the php file is found, but the problem persist. Exactly how the autoloading or bootstrap including should be done?

EDIT: I made the WebDriver enabling and configuration into tests/acceptance.suite.yml instead of root folder codeception.yml, and got over the problem.

Remains unclear why this happens?

1
  • Did you run vendor/bin/codecept build command after configuring Webdriver in codeception.yml? Commented Oct 10, 2016 at 8:25

1 Answer 1

2

WebDriver is not an extension, but a module.

You have to enable it in the modules section of acceptance.suite.yml file.

modules:
    enabled:
      - WebDriver
      - \Helper\Acceptance

https://github.com/Codeception/Codeception/blob/2.2/tests/web.suite.yml

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.