Skip to content

Commit

Permalink
Fix GitHub actions
Browse files Browse the repository at this point in the history
Fixes github actions (rebase from ZekeLu's PR).
  • Loading branch information
ZekeLu authored and kenshaw committed Mar 24, 2021
1 parent ac448d2 commit 5d53c66
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: go test -v ./...
run: TMPDIR=$RUNNER_TEMP go test -v ./...
test-headless-shell:
runs-on: ubuntu-latest
steps:
Expand All @@ -32,4 +32,4 @@ jobs:
- name: Build
run: go test -c -vet=off
- name: Test
run: docker run --rm --volume=$PWD:/chromedp --entrypoint=/chromedp/chromedp.test --workdir=/chromedp --env=PATH=/headless-shell chromedp/headless-shell:latest -test.v
run: docker run --rm --volume=$PWD:/chromedp --entrypoint=/chromedp/chromedp.test --workdir=/chromedp --env=PATH=/headless-shell --env=HEADLESS_SHELL=1 chromedp/headless-shell:latest -test.v
5 changes: 4 additions & 1 deletion allocate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ func TestExecAllocatorMissingWebsocketAddr(t *testing.T) {
ctx, cancel := NewContext(allocCtx)
defer cancel()

want := regexp.MustCompile(`failed to start:\n.*Invalid devtools`)
// set the "s" flag to let "." match "\n"
// in Github Actions, the error text could be:
// "chrome failed to start:\n/bin/bash: /etc/profile.d/env_vars.sh: Permission denied\nmkdir: cannot create directory ‘/run/user/1001’: Permission denied\n[0321/081807.491906:ERROR:headless_shell.cc(720)] Invalid devtools server address\n"
want := regexp.MustCompile(`(?s)failed to start:\n.*Invalid devtools`)
got := fmt.Sprintf("%v", Run(ctx))
if !want.MatchString(got) {
t.Fatalf("want error to match %q, got %q", want, got)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ require (
github.com/gobwas/pool v0.2.1 // indirect
github.com/gobwas/ws v1.0.4
github.com/mailru/easyjson v0.7.7
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 // indirect
golang.org/x/sys v0.0.0-20210324051608-47abb6519492 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210324051608-47abb6519492 h1:Paq34FxTluEPvVyayQqMPgHm+vTOrIifmcYxFBx9TLg=
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
13 changes: 13 additions & 0 deletions input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package chromedp

import (
"fmt"
"os"
"strconv"
"testing"

Expand Down Expand Up @@ -173,6 +174,10 @@ func TestMouseClickOffscreenNode(t *testing.T) {
}

func TestKeyEvent(t *testing.T) {
if os.Getenv("HEADLESS_SHELL") != "" {
t.Skip(`Skip in headless-shell due to "Check failed: IsSupportedClipboardBuffer(buffer)"`)
}

t.Parallel()

tests := []struct {
Expand Down Expand Up @@ -207,6 +212,8 @@ func TestKeyEvent(t *testing.T) {
if err := Run(ctx,
Focus(test.sel, test.by),
KeyEvent(kb.Home),
// "KeyEvent(kb.End, KeyModifiers(input.ModifierShift))" crash headless-shell with this error:
// [...:FATAL:headless_clipboard.cc(296)] Check failed: IsSupportedClipboardBuffer(buffer)
KeyEvent(kb.End, KeyModifiers(input.ModifierShift)),
KeyEvent(test.exp),
); err != nil {
Expand All @@ -226,6 +233,10 @@ func TestKeyEvent(t *testing.T) {
}

func TestKeyEventNode(t *testing.T) {
if os.Getenv("HEADLESS_SHELL") != "" {
t.Skip(`Skip in headless-shell due to "Check failed: IsSupportedClipboardBuffer(buffer)"`)
}

t.Parallel()

tests := []struct {
Expand Down Expand Up @@ -260,6 +271,8 @@ func TestKeyEventNode(t *testing.T) {
var value string
if err := Run(ctx,
KeyEventNode(nodes[0], kb.Home),
// "KeyEventNode(nodes[0], kb.End, KeyModifiers(input.ModifierShift))" crash headless-shell with this error:
// [...:FATAL:headless_clipboard.cc(296)] Check failed: IsSupportedClipboardBuffer(buffer)
KeyEventNode(nodes[0], kb.End, KeyModifiers(input.ModifierShift)),
KeyEventNode(nodes[0], test.exp),
Value(test.sel, &value, test.by),
Expand Down

0 comments on commit 5d53c66

Please sign in to comment.