Codeception / Codeception/Codeception

Code Coverage doesn't work with Chrome via Selenium

オープン
#5,695 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Coverage
主要言語
PHP
スター
4.9k
フォーク
1.3k
PR マージ指標
30日以内にマージされた PR はありません

説明

#### 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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。