You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 16, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+61-2Lines changed: 61 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,12 +10,14 @@
10
10
11
11
The [Codeception](http://codeception.com/) module for [BrowserMob Proxy](http://bmp.lightbody.net/)
12
12
13
-
:bangbang:**THIS MODULE IS UNDER DEVELOPMENT**
13
+
## Roadmap
14
+
-[x]**0.1**: Initial version based on library [PHPBrowserMobProxy by chartjes](https://github.com/chartjes/PHPBrowserMobProxy/) with imited support of BrowserMob Proxy legacy API and no Littleproxy support
15
+
-[ ] 0.2: New PHP BrowserMob Proxy with full REST API support (Jetty and Littleproxy) and [proxy auto-configuration](https://en.wikipedia.org/wiki/Proxy_auto-config) feature.
14
16
15
17
## Minimum Requirements
16
18
- Codeception 2.2
17
19
- PHP 5.5
18
-
- BrowserMob Proxy
20
+
- BrowserMob Proxy 2.0
19
21
20
22
## Installation
21
23
The module can be installed using [Composer](https://getcomposer.org)
@@ -34,4 +36,61 @@ Enabling **BrowserMob** is done in your configuration file `.yml`.
34
36
module:
35
37
enabled:
36
38
- Codeception\Extension\BrowserMob
39
+
host: 'localhost'
40
+
port: 8080
37
41
```
42
+
43
+
### Parameters
44
+
**BrowserMob** support following configuration parameters:
45
+
46
+
| Parameter | Type | Description |
47
+
|-----------|------|-------------|
48
+
| `host` | **string** | BrowserMob Proxy host |
49
+
| `port` | **integer** | BrowserMob Proxy port |
50
+
| `autostart` | **boolean** | Start a new proxy instance automatically [*default = false*] |
51
+
| `whitelist` | **array** | <p>URLs whitelisting</p><p>`code`: HTTP status code for URLs that do not match patterns</p><p>`patterns`: array of whitelisted URLs patterns<p> |
52
+
| `blacklist` | **array** | <p>URLs blacklisting</p><p>`code`: HTTP status code for URLs that match patterns</p><p>`patterns`: array of blacklisted URLs patterns<p> |
53
+
| `limits` | **array** | Bandwidth limits through the proxy (see [BrowserMob Proxy REST API](https://github.com/lightbody/browsermob-proxy#rest-api))|
| `basicAuth` | **array** | <p>Sets automatic basic authentication a list of domains</p><p>`domain`: domain name</p><p>`options`:HTTP authentication parameters using format *`name: value`* (see [BrowserMob Proxy REST API](https://github.com/lightbody/browsermob-proxy#rest-api))</p> |
56
+
| `dns` | **array** | <p>Internal proxy DNS using pairs of domain/IP to map</p><p>`domain`: domain name</p><p>`ip`: matching IP</p> |
57
+
| `retry` | **integer** | Number of times a method will be retried [*default = 0*] |
58
+
59
+
***Example***
60
+
```yaml
61
+
modules:
62
+
config:
63
+
Codeception\Extension\BrowserMob:
64
+
host: 'localhost'
65
+
port: 9090
66
+
autostart: true
67
+
whitelist:
68
+
code: 404
69
+
patterns:
70
+
- 'http://codeception.com/'
71
+
limits:
72
+
downstreamKbps: 12
73
+
upstreamKbps: 12
74
+
latency: 1
75
+
timeouts:
76
+
request: 10
77
+
read: 10
78
+
connection: 10
79
+
dns: 10
80
+
basicAuth:
81
+
- domain: example.local
82
+
options:
83
+
username: myUsername
84
+
password: myPassword
85
+
dns:
86
+
- domain: example.local
87
+
ip: 127.0.0.1
88
+
- domain: wikipedia.org
89
+
ip: 192.168.1.1
90
+
retry: 3
91
+
```
92
+
93
+
## Documentation
94
+
The module documentation is available in the [wiki](https://github.com/edno/codeception-browsermob/wiki/Codeception-BrowserMob-Proxy-extension-Documentation).
95
+
96
+
For more information on how to use BrowserMob proxy, refer to [BrowserMob Proxy REST API documentation](https://github.com/lightbody/browsermob-proxy#rest-api).
* @method void _open() Open a new proxy using the PHPBrowserMobProxy_Client method
13
+
* @method void _close() Close current proxy using the PHPBrowserMobProxy_Client method
14
+
* @method \Requests_Response _newHar(string $label='') Start new HAR using the PHPBrowserMobProxy_Client method
15
+
* @method \Requests_Response _newPage(string $label='') Start new HAR page using the PHPBrowserMobProxy_Client method
16
+
* @method \Requests_Response _blacklist(string $regexp, integer $status_code) Blacklist URLs using the PHPBrowserMobProxy_Client method
17
+
* @method \Requests_Response _whitelist(string $regexp, integer $status_code) Whitelist URLs using the PHPBrowserMobProxy_Client method
18
+
* @method \Requests_Response _basicAuth(string $domain, string[] $options) Set HTTP authentication headers using the PHPBrowserMobProxy_Client method
19
+
* @method \Requests_Response _headers(string[] $options) Override requests HTTP headers using the PHPBrowserMobProxy_Client method
20
+
* @method \Requests_Response _responseInterceptor(string $js) Intercept HTTP responses using the PHPBrowserMobProxy_Client method
21
+
* @method \Requests_Response _requestInterceptor(string $js) Intercept HTTP requests using the PHPBrowserMobProxy_Client method
22
+
* @method \Requests_Response _limits(string[] $options) Set proxy limits using the PHPBrowserMobProxy_Client method
23
+
* @method \Requests_Response _timeouts(string[] $options) Set proxy timeouts using the PHPBrowserMobProxy_Client method
24
+
* @method \Requests_Response _remapHosts(string $address, string $ip_address) Map hosts to IP using the PHPBrowserMobProxy_Client method
25
+
* @method \Requests_Response _waitForTrafficToStop(integer $quiet_period, integer $timeout) Wait for traffic before stopping proxy using the PHPBrowserMobProxy_Client method
26
+
* @method string _clearDnsCache() Flux proxy DNS cache using the PHPBrowserMobProxy_Client method
27
+
* @method \Requests_Response _rewriteUrl(string $match, string $replace) Rewrite URLs using the PHPBrowserMobProxy_Client method
28
+
* @method \Requests_Response _retry(integer $retry_count) Set proxy retries using the PHPBrowserMobProxy_Client method
0 commit comments