Skip to content

Commit

Permalink
fixup! Update mapping to avoid mapping nil elementHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur22 committed Nov 16, 2023
1 parent 54a09ae commit a2dc258
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions browser/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ func mapElementHandle(vu moduleVU, eh *common.ElementHandle) mapping {
if err != nil {
return nil, err //nolint:wrapcheck
}
// ElementHandle can be null when the selector does not match any elements.
// We do not want to map nil elementHandles since the expectation is a
// null result in the test script for this case.
if eh == nil {
return nil, nil //nolint:nilnil
}
Expand Down Expand Up @@ -399,6 +402,9 @@ func mapFrame(vu moduleVU, f *common.Frame) mapping {
if err != nil {
return nil, err //nolint:wrapcheck
}
// ElementHandle can be null when the selector does not match any elements.
// We do not want to map nil elementHandles since the expectation is a
// null result in the test script for this case.
if eh == nil {
return nil, nil //nolint:nilnil
}
Expand Down Expand Up @@ -600,6 +606,9 @@ func mapPage(vu moduleVU, p *common.Page) mapping {
if err != nil {
return nil, err //nolint:wrapcheck
}
// ElementHandle can be null when the selector does not match any elements.
// We do not want to map nil elementHandles since the expectation is a
// null result in the test script for this case.
if eh == nil {
return nil, nil //nolint:nilnil
}
Expand Down

0 comments on commit a2dc258

Please sign in to comment.