Codeception: WebDriver make http call

Created on 19 Jan 2017  路  3Comments  路  Source: Codeception/Codeception

What are you trying to achieve?

I try to get the http response code and also the http header to make checks. I use gherkin in my tests.

class_name: AcceptanceTester
modules:
    enabled:
        - WebDriver:
            host: 127.0.0.1
            port: 8910
            url: 'https://localhost'
            browser: phantomjs

Problem

I can not use PHPBrowser and WebDriver together.

Idea

Initialize PHPBrowser or Guzzle in a helper method make the call and save the result temporary. To check with additional methods.

In behat you can use multiple driver and switch between them.

$mink = $this->getMink();
$goutteSession = $mink->getSession('http');
$goutteSession->visit($this->getMinkParameter('base_url') . $url);
$mink->setDefaultSessionName('http');

Do you have another/better idea?

Most helpful comment

You can achieve that with REST module.

class_name: AcceptanceTester
modules:
    enabled:
        - WebDriver:
            host: 127.0.0.1
            port: 8910
            url: 'https://localhost'
            browser: phantomjs
        - REST:
            depends: PhpBrowser
            url: 'http://...'

This way PhpBrowser is only used by REST and does not conflict with PhpBrowser and you get all HTTP helper methods provided by REST.

All 3 comments

You can achieve that with REST module.

class_name: AcceptanceTester
modules:
    enabled:
        - WebDriver:
            host: 127.0.0.1
            port: 8910
            url: 'https://localhost'
            browser: phantomjs
        - REST:
            depends: PhpBrowser
            url: 'http://...'

This way PhpBrowser is only used by REST and does not conflict with PhpBrowser and you get all HTTP helper methods provided by REST.

thanks exacly i was looking for.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

centerax picture centerax  路  4Comments

m4rcinkowski picture m4rcinkowski  路  4Comments

sebastianneubert picture sebastianneubert  路  3Comments

allen0817 picture allen0817  路  3Comments

simara-svatopluk picture simara-svatopluk  路  3Comments