-
-
Notifications
You must be signed in to change notification settings - Fork 763
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
Cache session details to avoid making unnecessary queries #765
Conversation
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.
👍
Works great! reduced a test from 2hs to 25minutes. |
Wow, that's a great time difference ..... |
@vrunoa was this tested on parallel sessions ? if not I can take it ... |
@saikrishna321 no, just a test on a cloud service. I havent test parallel sessions, if you cant take it it would be great. |
done I will do it today |
*/ | ||
@SuppressWarnings("unchecked") | ||
@Override | ||
public synchronized Map<String, Object> getSessionDetails() { |
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 am against this change. Session details data is not immutable. It may change when driver is switched to another context (NATIVE APP or WEB VIEW).
I think the right way is to find places where it is invoked frequently.
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.
If full copy is used, shouldn't there at least be an 'expiry time' or a method to force the details to be refreshed?
When I ran into this issue I decided to use an expiry time, based on the time it took to retrieve the information, in my (not so nice) workaround in https://github.com/fhoeben/hsac-fitnesse-appium.
The approach I currently use there is to have some cache at the element level, and using my own 'json to element' converter.
My custom elements require less retrieval of session details (for me the 'foundBy' information does not require session details, which is currently required for the driver's toString()
, and they 'cache' information retrieved from the driver about an element for a short while (so my test code does not need to worry too much about for instance checking isDisplayed()
twice)).
@vrunoa There are some question to make it clear:
|
@TikhomirovSergey the test I'm running is not calling to getSessionDetails. Not sure about page object, can you help me figure out if it is used. |
@vrunoa as my tests are running locally, i don't see much time difference its 2mins difference in total |
@saikrishna321 yeah, the big difference it's when running on a cloud service since those getSessionDetails calls take like 5 seconds or more between commands but locally you just lose a few milliseconds. |
@vrunoa I suppose we don't all the actions which can change session parameters.
We know only one place in java_client where |
@TikhomirovSergey yes, it does use those decorators. Sorry but I cannot share the source code of this particular test. |
@vrunoa ok. So it seems I was right. Working on improvements. |
thanks @TikhomirovSergey. Let me know if there's something I can help with. |
@TikhomirovSergey Sorry to bother, but do you have any updates on this fix? |
Closed in favour of #769 |
Change list
Addresses #764
Types of changes