mardi 1 mars 2016

Set user agent in codeception cept

I have some features / limitations in project for search bot crawlers and I would like to test them using codeception and I found there is an option to set headers using setHeader method. In my case it doesn't work though. I'm getting [RuntimeException] Call to undefined method FunctionalTester::setHeader error.

Code bellow:

<?php
/** @var \Codeception\Scenario $scenario */
$I = new FunctionalTester($scenario);

$I->setHeader('User-Agent', 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://ift.tt/eSXNch)');

FileDetailPage::of($I)->amOnFileDetail(96972088, 'raped.zip');

According to Authorization header not making it through in Codeception API testing I wonder if I have to set user agent header for every request. Isn't there method or configuration option to change User-Agent permanently?

Aucun commentaire:

Enregistrer un commentaire