Perhaps you can identify it by looking at user agent string. For example, we're using Chrome headless (+WebDriver
) and it's nicely introducing itself:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/63.0.3239.84 HeadlessChrome/63.0.3239.84 Safari/537.36
...but you can't be 100% sure it's you because, in theory, someone else could be running it against your website as well.
Alternatively, you can override amOnPage()
method in your acceptance tester to set a header before calling parent::amOnPage()
:
public function amOnPage($page)
{
$this->haveHttpHeader('x-codeception', '1');
parent::amOnPage($page);
}
Just don't forget overriding amOnUrl()
too, because it will hit the page in the same way as amOnPage()
, while amOnSubdomain()
only switches the subdomain without visiting it.