-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error for evaluate
APIs
#1233
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inancgumus
previously approved these changes
Mar 5, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Some suggestions.
There is also a linter error:
TestPageEvaluateMapping should call t.Parallel on the top level as well as its subtests (parallel)
ankur22
added a commit
that referenced
this pull request
Mar 5, 2024
When the browser module receives the error with code -32000, this indicates a server error. From looking at the chromium code it seems to be related to issues that originate not from chromium but from the caller. There are many error messages that use this error code, so we cannot assume that it is due to a navigation. The user and we will benefit from knowing what chrome/chromium is not happy about Resolves: #1233 (comment)
ankur22
added a commit
that referenced
this pull request
Mar 5, 2024
When the browser module receives the error with code -32000, this indicates a server error. From looking at the chromium code it seems to be related to issues that originate not from chromium but from the caller. There are many error messages that use this error code, so we cannot assume that it is due to a navigation. The user and we will benefit from knowing what chrome/chromium is not happy about Resolves: #1233 (comment)
ankur22
force-pushed
the
add/not-func-error
branch
from
March 5, 2024 12:05
9277d60
to
9ef80b3
Compare
ankur22
added a commit
that referenced
this pull request
Mar 5, 2024
When the browser module receives the error with code -32000, this indicates a server error. From looking at the chromium code it seems to be related to issues that originate not from chromium but from the caller. There are many error messages that use this error code, so we cannot assume that it is due to a navigation. The user and we will benefit from knowing what chrome/chromium is not happy about Resolves: #1233 (comment)
ankur22
force-pushed
the
add/not-func-error
branch
from
March 5, 2024 12:07
9ef80b3
to
f927336
Compare
The error message otherwise is confusing if no navigations occurred during the test. Taking a look at the actual error it was due to the script not being a function/callable.
This integration test is for sanity checking that it does indeed work as we expect when we pass it the correct function.
When the browser module receives the error with code -32000, this indicates a server error. From looking at the chromium code it seems to be related to issues that originate not from chromium but from the caller. There are many error messages that use this error code, so we cannot assume that it is due to a navigation. The user and we will benefit from knowing what chrome/chromium is not happy about Resolves: #1233 (comment)
ankur22
force-pushed
the
add/not-func-error
branch
from
March 5, 2024 14:25
f927336
to
0b50d16
Compare
inancgumus
approved these changes
Mar 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This fixes the error that is returned when a user works with the
evaluate
APIs when a navigation isn't occurring:This used to return
GoError: evaluating JS: execution context changed; most likely because of a navigation
, but now it returnsgiven expression does not evaluate to a function
.Why?
The new error better represents what the user can do to fix the problem instead of being left confused when no navigation has occurred. In the example above and with the new error, they should be able to work out that
evaluate
only works with callable functions.Checklist
Related PR(s)/Issue(s)
/~https://github.com/grafana/k6-cloud/issues/2066