-
Notifications
You must be signed in to change notification settings - Fork 134
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
feat: use 'fill' for inputs #727
Conversation
Awesome, thank you! I am reviewing this now. We have a sandbox project we use for test pages. It should have all the inputs you need. https://github.com/qawolf/qawolf/tree/master/packages/sandbox You can run it locally with This is a script for generating fixtures. |
5933874
to
879e981
Compare
Great, thanks @jperl. I'll add a bunch of tests to verify and codify the special cases. |
I ran into a few issues while reviewing this PR that I fixed on master, and rebased this PR onto:
The main issue I have with the PR is the experience is slightly worse, since changes only show up after the change event instead of while the user is typing. |
@jperl I encountered 1 and was just restarting. Glad to know there's a fix. Selector fix makes sense. I agree the lack of generated code while typing is a worse experience than before. I'll take a look at that because it might not be too hard to generate a temporary |
b1414ae
to
5933874
Compare
5933874
to
7df567f
Compare
and generate fills while typing, updating them as you type
@jperl Fills are generated while you type now, and I added support for filling contenteditables. Haven't added the tests yet. |
@aldeed Just tested it out. Works very well! Let me know if you want help with the tests. |
@jperl I generated a bunch of fixtures and added many tests for But there are still a couple more tests failing locally for me, and I'm not as sure about those. Would you mind taking a look at those and see if it's OK to update snapshots or if I'm unintentionally breaking something? I also still need to add tests for |
I'll fix any broken tests now that were pre-existing before the PR. |
@jperl One more thing: |
@aldeed I went ahead and added it as a dev dependency. |
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.
After you feel like it has adequate test coverage, merge it 👍 🔥 🙏
|
- update login fixture to match previous fixture (starting at index page)
Resolves #702
Changes
To better handle input typing edge cases, the
create
command now generatesfill
actions for typing that happens in anyinput
ortextarea
with a few exceptions.Details
page.type
is no longer generatedpage.press
actions are generated in a different way. Modifier keys are no longer tracked for now.Implementing this as proposed in the issue didn't work. Checking whether the next event is the same target as the previous doesn't handle a bunch of cases where various other events that should be ignored are firing between, such as scrolling and clicking. I tried the
input
event instead, but it was difficult to figure out when the input changing was "done". Then I tried the "change" event, which is almost perfect because it lets the browser decide when the input change is committed. The only problem with "change" is that it always fires after the Enter, Tab, or click that caused it, which is the reverse of what we want to generate. To resolve this, I use "change" to figure out when editing an input's value is done, but then I use the most recent "input" event for that target as the actual event. In my tests this seems to work well.Special Cases
I had to add special handling for a number of cases.
value
is always "on" andpage.fill
isn't appropriate for those. I skip these fills and let the associated "click" event do the work instead.page.fill
on these. I skip these fills. File selection will need to be handled elsewhere.date
,datetime-local
,time
,month
,week
, etc. There are two special considerations for these.page.press
for Tab key if it doesn't result in the target focus changing.page.fill
commands generated for the same selector in a row. Only the last is kept.textarea
, so I do not trackEnter
press when the target is a text area. The generatedpage.fill
for a textarea selector includes all line breaks.Testing
I haven't yet added Jest tests. For manual testing, I created the following HTML file, which I serve on localhost: