Skip to content
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

Add support for wide characters to fill functions #552

Merged
merged 10 commits into from
Apr 30, 2023

Conversation

tupini07
Copy link
Contributor

@tupini07 tupini07 commented Apr 28, 2023

Previously, when api/fill-human was asked to write text that contained emojis (or other "wide" characters) it would end up writing ?? to the input field instead of the actual emoji. The reason for this is that it was just iterating over every character in the string instead of over the codepoints.

This PR adds support for wide characters to api/fill-human by iterating over its codepoints.

Closes #551

wokring-codepoints.webm

Please complete and include the following checklist:

  • I have read CONTRIBUTING and the Etaoin Developer Guide.

  • This PR corresponds to an issue that the Etaoin maintainers have agreed to address.

  • This PR contains test(s) to protect against future regressions

  • I have updated CHANGELOG.adoc with a description of the addressed issue.

@lread
Copy link
Collaborator

lread commented Apr 28, 2023

For tests you could just update the user guide to include some emojis. The user guide code blocks are run through test-doc-blocks.

@lread
Copy link
Collaborator

lread commented Apr 28, 2023

Don't be too worried about CI failures, especially on Windows. That platform is still flakey on CI. Just rerun failed jobs.

@tupini07
Copy link
Contributor Author

For tests you could just update the user guide to include some emojis. The user guide code blocks are run through test-doc-blocks.

Thanks @lread ! I've added some emojis to the examples as suggested, but is it enough? As far as I'm aware there is no check that the "text" was actually typed correctly (or is there?)

@lread
Copy link
Collaborator

lread commented Apr 28, 2023

Thanks @lread ! I've added some emojis to the examples as suggested, but is it enough? As far as I'm aware there is no check that the "text" was actually typed correctly (or is there?)

Ah yeah, good point! Could add in a fetch for the element value.

Also: thanks for fixing various typos as you notice them. I am the king of typos.

@lread
Copy link
Collaborator

lread commented Apr 28, 2023

Windows CI is horribly flakey, as a Window guy, if you have any insights let us know.
My guess is that we might just need to increase timeouts for CI+Windows+GitHubActions.
But I dunno. (We have a separate issue for this #465)

@tupini07 tupini07 marked this pull request as ready for review April 28, 2023 20:16
@tupini07
Copy link
Contributor Author

@lread I've just uploaded a new test that follows the same pattern as fill human multiple inputs but works with emojis :) let me know what you think!

Also: thanks for fixing various typos as you notice them. I am the king of typos.

my pleasure :)

Windows CI is horribly flakey, as a Window guy, if you have any insights let us know.

I can take a look, but I don't promise anything 😅 I'm using etaoin mainly from within WSL, but for the little I've used it in Windows I can't say I noticed any special delays or timeout errors 🤔 I wonder if the issue could instead be the CI environment you're using (browser or webdriver version could be out of date for instance).

Anyway, I'll try to run the "windows" tests on my local PC and see if there are any failures.

@lread
Copy link
Collaborator

lread commented Apr 28, 2023

@lread I've just uploaded a new test that follows the same pattern as fill human multiple inputs but works with emojis :) let me know what you think!

Interesting! If you have trouble getting these to pass, an alternative might be to try updating user guide and add something like so:

(e/get-element-value driver :uname)
;; => "my fancy expected emojis"

Would that work? (this would become an assertion that test-doc-blocks runs)

I can take a look, but I don't promise anything sweat_smile I'm using etaoin mainly from within WSL, but for the little I've used it in Windows I can't say I noticed any special delays or timeout errors thinking I wonder if the issue could instead be the CI environment you're using (browser or webdriver version could be out of date for instance).

Anyway, I'll try to run the "windows" tests on my local PC and see if there are any failures.

Ya I suspect it is GitHub Actions (it stays up to date with browsers and drivers), I've not had much failure when running in my Windows VM. But if you take a peek, thanks in advance.

@tupini07
Copy link
Contributor Author

Interesting! If you have trouble getting these to pass, an alternative might be to try updating user guide and add something like so:

oh yes that's much nicer (and easier) than what I had done :) updated as suggested

@lread
Copy link
Collaborator

lread commented Apr 28, 2023

Hmmm... I am trying this out in my REPL.
Emoji chars seem to fill nicely in Firefox but I get ?? in Chrome.
How about you @tupini07?

@lread
Copy link
Collaborator

lread commented Apr 28, 2023

Ah we seem to maybe have the same codepoint issue for make-input*, I'll take a peek.

@lread
Copy link
Collaborator

lread commented Apr 28, 2023

Ah, maybe sending emoji chars with ChromeDriver does not work?:
https://bugs.chromium.org/p/chromedriver/issues/detail?id=2269

@lread
Copy link
Collaborator

lread commented Apr 28, 2023

I think chrome only currently supports Unicode in the Basic Multilingual Plane.

So, maybe ok. Different drivers/browsers have different limitations.

Could run this test under Firefox only.
Could add a note to user guide.

I expect Microsoft Edge would be the same as it is based on the same code as Chrome.
And Safari, we'd have to test.

@tupini07, I can take a peek at this if you like, I have all the necessary VMs setup to poke around.

@tupini07
Copy link
Contributor Author

tupini07 commented Apr 29, 2023

@tupini07, I can take a peek at this if you like, I have all the necessary VMs setup to poke around.

@lread thanks for the investigation! Yeah it does sound like chromedriver has a limitation, interesting. I'm not home now so I can't test on my end wether this happen on my chrome as well.

And yes sure! If you want to look into it that would be great! As I said I'm not homj right now, and probably won't be able to work on this until tomorrow night :)

@lread
Copy link
Collaborator

lread commented Apr 29, 2023

Ya, there is really no big rush. I can take a peek maybe tomorrow.

@lread
Copy link
Collaborator

lread commented Apr 29, 2023

Thank goodness for VMs and remote REPLs!

My findings across OSes are:

  • Safari works
  • Firefox works
  • Chrome works for BMP only
  • Edge works for BMP only

I'll likely follow up tomorrow.

Apply codepoint handling fix to input fill fns in general.
Update user guide to talk about limitations.
Add some unit tests to for fuller browser coverage.
@lread
Copy link
Collaborator

lread commented Apr 29, 2023

Ok @tupini07, what do you think of my small tweaks to your fine effort?

@lread lread changed the title Add support for wide characters to fill-human Add support for wide characters to fill functions Apr 29, 2023
@tupini07
Copy link
Contributor Author

@lread wonderful! Thanks a lot for your help 🤗 it would have taken me ages to work out how to properly test this and all the other changes you did. Also, great catch with this needing to be added to make-input* as well!

This PR has my name but basically you were the one who implemented everything 😅

@lread
Copy link
Collaborator

lread commented Apr 30, 2023

Thanks for reviewing @tupini07, I shall merge.
Don't sell yourself short, you did good work here, let's call it a collaboration then, eh?
Thanks for your contribution here, much appreciated!

@lread lread merged commit 27c8fa3 into clj-commons:master Apr 30, 2023
lread added a commit that referenced this pull request Mar 17, 2024
Addendum for #552

Add jdk variants for CI.
Default to jdk 21 but also sanity test on jdks 8, 11 and 17.
@lread lread mentioned this pull request Mar 17, 2024
4 tasks
lread added a commit that referenced this pull request Mar 17, 2024
Addendum for #552

Add jdk variants for CI.
Default to jdk 21 but also sanity test on jdks 8, 11 and 17.

Fixes #560
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emojis in input to fill-human appear as ?? in the target input element
2 participants