Skip to content

Commit

Permalink
wip: debug FrameSession nil panic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Mirić committed Mar 10, 2022
1 parent 7c332cb commit 2c62667
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
strategy:
matrix:
go: [stable, tip]
platform: [ubuntu-latest, windows-latest, macos-latest]
# platform: [ubuntu-latest, windows-latest, macos-latest]
platform: [windows-latest]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -64,10 +65,11 @@ jobs:
- name: Run E2E tests
run: |
set -x
export XK6_HEADLESS=true
for f in examples/*.js; do
./k6ext run "$f"
done
export XK6_HEADLESS=true XK6_BROWSER_LOG=trace
./k6ext run -q examples/browser_on.js
# for f in examples/*.js; do
# ./k6ext run "$f"
# done
- name: Check screenshot
# TODO: Do something more sophisticated?
run: test -s screenshot.png
12 changes: 8 additions & 4 deletions common/frame_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,6 @@ func (fs *FrameSession) initFrameTree() error {
return fmt.Errorf("unable to get page frame tree: %w", err)
}

// FIXME: frameTree is sometimes nil on Windows
// https://github.com/grafana/xk6-browser/runs/4036384507

if fs.isMainFrame() {
fs.handleFrameTree(frameTree)
fs.initRendererEvents()
Expand Down Expand Up @@ -478,8 +475,15 @@ func (fs *FrameSession) isMainFrame() bool {

func (fs *FrameSession) handleFrameTree(frameTree *cdppage.FrameTree) {
fs.logger.Debugf("FrameSession:handleFrameTree",
"sid:%v tid:%v", fs.session.ID(), fs.targetID)
"sid:%v tid:%v ft:%v", fs.session.ID(), fs.targetID, frameTree)

if frameTree == nil {
// Sometimes on very quick scripts we might not have time to initialize
// and frameTree will be nil.
return
}

fmt.Printf(">>> fs.ctx.Err: %#+v, frameTree: %#+v\n", fs.ctx.Err(), frameTree)
if frameTree.Frame.ParentID != "" {
fs.onFrameAttached(frameTree.Frame.ID, frameTree.Frame.ParentID)
}
Expand Down

0 comments on commit 2c62667

Please sign in to comment.