Skip to content

Commit

Permalink
cmd/screentest: remove special case for same URL
Browse files Browse the repository at this point in the history
The special case added in a previous CL is not the problem.
In general, waiting for components to render is a better solution.

Change-Id: Iadecccea7862db0cbfcfc525392b8859b78dda6d
Reviewed-on: https://go-review.googlesource.com/c/website/+/628055
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
jba committed Nov 22, 2024
1 parent ea85ca2 commit 1e9999a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
3 changes: 3 additions & 0 deletions cmd/golangorg/testdata/screentest/relnotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ capture fullscreen
{{range ints 1 22}}
test rl{{.}}
path /doc/go1.{{.}}
# dd.indent is added by one of the last bits of JS to run on the page:
# generateTOC in https://go.dev/js/godocs.js.
wait dd.indent
capture fullscreen
{{end}}
12 changes: 0 additions & 12 deletions cmd/screentest/screentest.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package main
import (
"bufio"
"bytes"
"cmp"
"context"
"errors"
"fmt"
Expand Down Expand Up @@ -485,17 +484,6 @@ func (tc *testcase) run(ctx context.Context, update bool) (err error) {
fmt.Fprintf(&tc.output, "test %s ", tc.name)
var testScreen, wantScreen image.Image
g, ctx := errgroup.WithContext(ctx)
// If the hosts are the same, chrome (or chromedp) does not handle concurrent requests well.
// This wouldn't make sense in an actual test, but it does happen in this package's tests.
urla, erra := url.Parse(tc.testURL)
urlb, errb := url.Parse(tc.wantURL)
if err := cmp.Or(erra, errb); err != nil {
return err
}
if urla.Host == urlb.Host {
g.SetLimit(1)
}

g.Go(func() error {
testScreen, err = tc.screenshot(ctx, tc.testURL, tc.testPath, tc.testImageReader)
return err
Expand Down

0 comments on commit 1e9999a

Please sign in to comment.