Codeception / Codeception/Codeception

Code Coverage doesn't work with Chrome via Selenium

Open
#5,695 0 comments 0 reactions 0 assignees View on GitHub
Coverage
Dominant language
PHP
Stars
4.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

#### What are you trying to achieve?
Coverage for functional tests.

#### What do you get instead?
0% coverage.

### Details

* Codeception version: 3.1.1
* PHP Version: 7.3.9
* Operating System: Docker alpine based
* Installation type: Composer
* List of installed packages (`composer show`)
* Suite configuration:

```yml
coverage:
enabled: true
c3_url: 'http://www.schoolm.local/index.php?key=ffewfwe'
include:
- src/*
```

docker-compose
```
chrome:
restart: unless-stopped
image: selenium/standalone-chrome-debug:3.141.59-vanadium
ports:
- 5900
- 4444
```

The problem is that the cookie that codeception send at the beginning is missing in php
[Cookie Jar] ["CODECEPTION_CODECOVERAGE=%7B%22CodeCoverage%22%3A%22create%22%2C%22CodeCoverage_Suite%22%3A%22functional%22%2C%22CodeCoverage_Config%22%3Anull%7D; domain=www.mydomain.local; path=/; httponly"]

The domain is correct, also session cookies are working.
```
error_log(var_export($_COOKIE, 1));
error_log(var_export(getallheaders(), 1));
```

A workaround is to set the server vars manually in c3.php
```
$_SERVER["HTTP_X_CODECEPTION_CODECOVERAGE"] = "create";
$_SERVER["HTTP_X_CODECEPTION_CODECOVERAGE_SUITE"] = "functional";
$_SERVER["HTTP_X_CODECEPTION_CODECOVERAGE_CONFIG"] = null;
```

Then i get the coverage as accepted.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.