Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Handle null arguments arriving as empty strings #53

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

Merged
merged 2 commits into from
Sep 24, 2020
Merged

Conversation

psaikkonen
Copy link
Contributor

Null values arrive as empty strings due to the jrobotremoteserver conversion between java and python. This caused the ClassCastException in issue #46 where the result of the first find is null and that is given as a root parameter for the next find. Instead of null the keyword receives an empty string and the runKeyword call fails since it can't be cast as a Parent object.

Now there's an additional check for null values in useMappedObject which replaces empty string arguments with null. This means you won't be able to provide an empty string as an argument for the library, but there should be no keywords where this would be necessary.

I also want to point out that the usage of combined find keywords described in the issue #46 still won't behave as expected there. When the first find now returns null and that is given as a root argument for the next execution of find keyword, the library will use the default value (since root argument is null) and instead look for matches everywhere. In this case the first call to find should have failIfNotFound set as true so the test execution would already fail when the first node can't be found, or use chained queries (see Locator syntax in the keyword documentation).

Also added tests for invalid root arguments and a more descriptive exception message when the java.lang.RuntimeException: java.lang.IllegalArgumentException: java.lang.ClassCastException@111abcde is thrown. Closes #46.

@psaikkonen psaikkonen requested a review from sampeson September 24, 2020 11:03
@sampeson
Copy link
Contributor

looks good to me

@sampeson sampeson closed this Sep 24, 2020
@sampeson sampeson reopened this Sep 24, 2020
@sampeson sampeson merged commit dbce1c8 into development Sep 24, 2020
@psaikkonen psaikkonen deleted the null-args branch September 28, 2020 06:01
sampeson added a commit that referenced this pull request Nov 2, 2020
* Set empty string args as nulls, add message for IllegalArgumentException (#53)

* wrap runKeyword to asyncFx so that JavaFX operations are done FX thread

* more asyncfx fixes, went through whole code base

* new wrapping to asyncfx thread

* additional rewrite to have all needed kw's wrapped in FX thread, output and error handling improvements

* handle null object properly, timeout to be generic kw timeout, handle separately wait until kws, kw output improvements

* fix hover related kw's

* waitUntilExists and waitUntilDoesNotExist improvements

* wait until keywords to have overall timeout value, improved printout

* fix text prefix to check for quotation marks

* fix text prefix to have support for apostrophe (') also

* cleanup

* fix verifiers hoverable kw's, add test

* fix push many times kw

* fix osx tests

* screenshots to asyncfx thread also in kw failure, fix hover kw's once more

* fix osx part and go throught documentation

* fix osx part and go throught documentation

* fix RunOnFailure to not store screenshot as mapObject to save memory

* remove comments

Co-authored-by: Pasi Saikkonen <[email protected]>
sampeson added a commit that referenced this pull request Nov 11, 2020
* Experimental java agent support

JavaFXLibrary can now be attached to process as java agent.

* Fix docker-compose up

Building the docker demo failed because of missing package versions for
the newer Ubuntu image. Base image of the demo is now fixed to bionic
tag since Ubuntu updates have broken the build earlier as well.
Related Launchpad ticket:
https://bugs.launchpad.net/ubuntu/+source/openjfx/+bug/1799946

* Updated documentation (java agent)

* Add possibility to configure different directory for log.html in Set Screenshotdir, fixes #17

* java agent documentation fix

* Set Classpath failure as warnings and add failIfNotFound argument

* Use asyncFx for helperfunctions methods, remove waitForFxEvents usage, failure printout improvements

* remove deprecated keywords and methods (enhancement #11)

* Set empty string args as nulls, add message for IllegalArgumentException (#53)

looks good to me

* Development kw asyncfx wrap (#55)

* wrap runKeyword to asyncFx so that JavaFX operations are done FX thread

* more asyncfx fixes, went through whole code base

* new wrapping to asyncfx thread

* additional rewrite to have all needed kw's wrapped in FX thread, output and error handling improvements

* handle null object properlty, timeout to be generic kw timeout, handle separately wait until kws, kw output improvements

* fix hover related kw's

* waitUntilExists and waitUntilDoesNotExist improvements

* wait until keywords to have overall timeout value, improved printout

* fix text prefix to check for quotation marks

* fix text prefix to have support for apostrophe (') also

* cleanup

* fix verifiers hoverable kw's, add test

* fix push many times kw

* fix osx tests

* screenshots to asyncfx thread also in kw failure, fix hover kw's once more

* fix osx part and go throught documentation

* fix osx part and go throught documentation

* fix RunOnFailure to not store screenshot as mapObject to save memory

* remove comments

* fix moveTo keyword to use asyncFx thread, fixes #57

* fix scroll keywords to do one tick at time from main thread, fix related tests

* fix moveTo in osx also

Co-authored-by: Turo Soisenniemi <[email protected]>
Co-authored-by: Pasi Saikkonen <[email protected]>
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.

2 participants