Skip to content

Commit 804b971

Browse files
improve README
1 parent dffd9a8 commit 804b971

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

README.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ npm install testingbot-tunnel-launcher
1414
## Usage
1515

1616

17-
### Simple Usage
17+
### Simple Usage (Callback)
1818

1919
```javascript
2020
const testingbotTunnel = require('testingbot-tunnel-launcher');
@@ -36,10 +36,36 @@ testingbotTunnel({
3636
});
3737
```
3838

39-
### Advanced Usage
39+
### Simple Usage (Async/Await)
4040

4141
```javascript
42+
const testingbotTunnel = require('testingbot-tunnel-launcher');
43+
44+
async function runTests() {
45+
try {
46+
const tunnel = await testingbotTunnel.downloadAndRunAsync({
47+
apiKey: process.env.TB_KEY,
48+
apiSecret: process.env.TB_SECRET,
49+
verbose: true
50+
});
51+
console.log("Tunnel ready");
52+
53+
// Run your tests here...
54+
55+
// Close the tunnel when done
56+
await testingbotTunnel.killAsync();
57+
console.log("Tunnel closed completely");
58+
} catch (err) {
59+
console.error(err.message);
60+
}
61+
}
4262

63+
runTests();
64+
```
65+
66+
### Options
67+
68+
```javascript
4369
const testingbotTunnel = require('testingbot-tunnel-launcher')
4470
const options = {
4571
// The TestingBot API key which you can get for free, listed in the TestingBot member area
@@ -53,15 +79,15 @@ const options = {
5379

5480
// Port on which the tunnel Selenium relay will listen for
5581
// requests. Default 4445. (optional)
56-
se-port: null,
82+
'se-port': 4445,
5783

5884
// Proxy host and port the tunnel can use to connect to an upstream proxy
5985
// e.g. "localhost:1234" (optional)
6086
proxy: null,
6187

62-
// a comma-separated list of domains that
88+
// A comma-separated list of domains that
6389
// will not go through the tunnel. (optional)
64-
fast-fail-regexps: null,
90+
'fast-fail-regexps': null,
6591

6692
// Write logging output to this logfile (optional)
6793
logfile: null,
@@ -73,7 +99,16 @@ const options = {
7399
tunnelIdentifier: "myIdentifier",
74100

75101
// Share this tunnel with other team members on TestingBot
76-
shared: true
102+
shared: true,
103+
104+
// Timeout in seconds for the tunnel to start (default: 90)
105+
timeout: 120,
106+
107+
// Disable SSL bumping/rewriting
108+
noBump: false,
109+
110+
// Disable caching
111+
noCache: false
77112
};
78113

79114
testingbotTunnel(options, function(err, tunnel) {
@@ -82,7 +117,6 @@ testingbotTunnel(options, function(err, tunnel) {
82117
console.log("Closed tunnel");
83118
});
84119
});
85-
86120
```
87121

88122
### Credentials

0 commit comments

Comments
 (0)