Closed aryangupta701 closed 1 year ago
@psiinon Please guide me how can I test the behaviour of the newly added methods? I am not sure weather this will work or not.
Sure :) The way I would do it is to:
okay thank you.
Also worth looking at the codebase (e.g. ZestClientScreenshotUnitTest
) to add unit tests.
how can I run the script from the command line ?
Theres https://github.com/zaproxy/zest/wiki/Commandline but I havnt tried it in a while - give it a go and let us know if you have any problems...
I have tested it manually and it is working as expected. I am not able to understand what kind of unit test will it need to be written. Please guide me through it. I have seen ZestClientScreenshotUnitTest
but still not sure about what kind of tests are needed.
The tests you did manually do them automatically :) If that's not possible verify that at least the expected classes are called, other behaviour than the invoke
itself should be tested as well.
Edit: To be clear I do think that all 3 statements being added can be tested automatically.
Thankyou @thc202
@thc202 I have written test for scrolling as of now. Please check if I went into the right direction, then I will write for others as well.
@aryangupta701 - looking good so far, let us know when its ready to review again.
okay sure.
I do think that these methods along with already present methods will be sufficient to handle all the user interactions. If you think I am missing something please tell me.
https://github.com/zaproxy/zest/pull/244#issuecomment-1483879548
IMO a scroll to statement would be easier to use in most cases (though the scroll element might still be useful/needed in some cases).
https://github.com/zaproxy/zest/pull/244#issuecomment-1460839256
This one was not yet addressed, the invoke methods are not being tested.
ok will add a scrollTo statement also
I tried automating the test for invoke functionality using mockito but was encountering some problems. For eg: at one place I have used new keyword instantiate Actions
but it is not possible to mock new
using mockito for this I will have to use powerMockito. If there is any other solution please guide me.
You don't need to mock the Actions
, you have both the WebDriver
and the WebElement
to verify the interactions. If that's too much work you can run the actual statement (e.g. ZestClientLaunchUnitTest.testHtmlUnitLaunch()
) and verify the outcome.
okay thanks. Will I need to create a test website to test mouseover statement?
Yes, you can serve static data like done in the test mentioned earlier (e.g. check before
method and ServerBasedTest
).
okay.
@thc202 Could you please review and tell me if anything needs to be changed?
Thank you!
Fix #243
Added mouseover, resize and scroll methods to handle hovering, resizing window and scrolling.