-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix fill method in injection script #4809
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
Conversation
Is this something that can be tested? Like, with a unit test, I mean 🤔 |
I did try, and i wasn't able to get it to not work before the fix! Very strange. I'll give it another go though 👍 |
@joanlopez I've added an integration test in 9a35675. It fails without the fix and passes with the fix. Turned out to be an issue due how react works. |
9a35675
to
8700afc
Compare
<script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script> | ||
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script> |
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.
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.
I guess a "quick-win" could be copy-pasting these files locally, right? 🤔 So, this way we don't rely on an external server, to be available. Reproducing the issue (if React-specific) with a subset of the library might more challenging, tho.
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.
Yeah, that makes sense. I tried to isolate the changes from the react dependency files, but the work that needs to go into doing that outweighs the benefits IMO. I've just added the files that are needed as static files. The commit is 16a4550
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.
Instead of saving these scripts in the repository and bloating it, why don't we download them only once, right before the test starts, if the files don't exist?
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.
That would still depend on a network connection, i guess we want to avoid that where possible. We're already vendoring our Go dependency, so i feel like this is good enough for now. Preferably it would be nice to only include the areas of the code that the test actually uses from the react library -- i tried manually (and using AI) to do this but it was taking too long so i abandoned it.
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.
I wouldn't worry much about the network connection for one-time-download assets, especially if we put it onto one of our servers, like S3 or jslib.k6.io. Getting Go modules always involves a network anyway. That said, I'm fine with the current solution as well 🤗
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, but it will be nice if we do not have to import 2 react dependancies from a third party to test this.
16a4550
to
b0f443e
Compare
This fill function was failing to fill the input text field. It would seem that it was returning to early, when it should have continued onto the end of the function and returned "needsinput".
It relies on a react based website.
network issues.
3c30e1f
to
a58835e
Compare
* Base release notes for v1.1.0 * Add release notes for dependabot PRs * Add #4809 and #4831 into the v1.1.0 release note * Add #4845 to the v1.1.0 release notes * Add example for locator.count * Remove await on expect in count example * Add section for nth, first and count in v1.1.0... ... release notes. * Update examples to work with latest test library This also updates the nth, first and last example. * Add some PRs from the beginning of the cycle into release notes * Add external PRs, among others, to release notes * Clean up stuff from release notes template * Add remaining PRs into release notes * Add #4862 to the v1.1.0 release note * Apply suggestions from code review Co-authored-by: Mihail Stoykov <312246+mstoykov@users.noreply.github.com> * Add #4864 to v1.1.0 release notes * Remove #4862 from v1.1.0 * Apply suggestions from code review Co-authored-by: İnanç Gümüş <inanc.gumus@grafana.com> * web/crypto updates * Update release notes/v1.1.0.md Co-authored-by: Mihail Stoykov <312246+mstoykov@users.noreply.github.com> * docs: document v1.1.0 forward roadmap * Refine experimental modules notes --------- Co-authored-by: ankur22 <ankur.agarwal@grafana.com> Co-authored-by: Mihail Stoykov <312246+mstoykov@users.noreply.github.com> Co-authored-by: İnanç Gümüş <inanc.gumus@grafana.com> Co-authored-by: oleiade <theo@crevon.me> Co-authored-by: Ivan <2103732+codebien@users.noreply.github.com>
What?
Preventing an early exit in the fill method in the injection script to actually allow the keyboard to enter the value into the input element.
Why?
This fill function was failing to fill the input text field. It would seem that it was returning to early, when it should have continued onto the end of the function and returned "needsinput".
Test script
Without the fix this script was unable to enter the username in the input element. After the fix it does:
Checklist
make check
) and all pass.Checklist: Documentation (only for k6 maintainers and if relevant)
Please do not merge this PR until the following items are filled out.
Related PR(s)/Issue(s)