Skip to content

Commit

Permalink
test both pipe and WebSocket connections
Browse files Browse the repository at this point in the history
  • Loading branch information
ZekeLu committed Jun 26, 2021
1 parent a71350f commit 609bd13
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Expand Up @@ -17,4 +17,5 @@ jobs:
- name: Test
run: |
TMPDIR=$RUNNER_TEMP go test -v ./...
TMPDIR=$RUNNER_TEMP CHROMEDP_WS=1 go test -v ./...
./contrib/docker-test.sh
5 changes: 5 additions & 0 deletions chromedp_test.go
Expand Up @@ -72,6 +72,11 @@ func init() {
if noSandbox := os.Getenv("CHROMEDP_NO_SANDBOX"); noSandbox != "false" {
allocOpts = append(allocOpts, NoSandbox)
}

// To test WebSocket connection.
if useWS := os.Getenv("CHROMEDP_WS"); useWS != "" && useWS != "false" {
allocOpts = append(allocOpts, DebuggingPort(0))
}
}

var browserOpts []ContextOption
Expand Down
12 changes: 12 additions & 0 deletions contrib/docker-test.sh
Expand Up @@ -21,4 +21,16 @@ set -e
chromedp/headless-shell:latest -test.v
)

(set -x;
docker run \
--rm \
--volume=$PWD:/chromedp \
--entrypoint=/chromedp/chromedp.test \
--workdir=/chromedp \
--env=PATH=/headless-shell \
--env=HEADLESS_SHELL=1 \
--env=CHROMEDP_WS=1 \
chromedp/headless-shell:latest -test.v
)

popd &> /dev/null

0 comments on commit 609bd13

Please sign in to comment.