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 method $.shouldBe(condition, timeout) #1136
Comments
I think we should have these methods. Also, |
@dstekanov There is a nuance :) That's why I suggest to have "waiting" methods with only one condition. As a rule, you want to use big timeout to wait for a single condition. |
Hmm why not sometihng like that element.shouldBe(visible, enabled).after(timeout); ? |
@SeleniumTestAB Good idea, but...
|
hmm, why not not do |
I agree, the unit is almost always
|
yes thus i mentioned Duration class from java so that we can use : Thats much readable but problem is to how Selenide can check if its in Minutes or Seconds... hmm i think for starter we could set it for Seconds and maybe later see feedback from community? |
@asolntsev there is one issue thought with Condition.in(timeout) method. The conditions such as exist or visible are a static variables and adding in() to them wouldnt make it change timeout for not one occurance but all occurances in the code? |
No, it's not a problem. |
So the finall thing should be: |
I hope there isn't a rule against necroing a thread. My 2 cents go in favour of using Duration objects as well. int, temporalunit parameters almost feel like a hack next to it. The users still retain the ability to input the integer in whatever unit they wish through Java's Duration class. Using Duration for timeouts in Selenide might promote proper time unit usage throughout the users' test code as well. |
@raidora Sure, any help is appreciated. |
... as a replacement for $.waitUntil(condition, timeout)
@raidora Please take a look at #1340 I added methods The only thing that I am in doubt about: we don't have alternative for method |
... as a replacement for $.waitUntil(condition, timeout)
... as a replacement for $.waitUntil(condition, timeout)
implemented in #1340 |
... as a replacement for $.waitUntil(condition, timeout)
….waitUntil/$.waitWhile methods
The problem
Selenide has method for waiting for a condition with custom timeout:
$.waitUntil(visible, 8888);
$.waitWhile(visible, 9999);
But it's not always readable. See
$.waitUntil(attribute("href", "blah"), 8888);
.Solution
It would be better readable if method name was
should
/shouldBe
/shouldHave
instead ofwaitUntil
(but with timeout parameter):$.shouldBe(visible, 8888);
$.shouldHave(attribute("href", "blah"), 9999);
P.S. Selenide already uses this pattern for collections:
$$("tr").shouldHave(size(42));
$$("tr").shouldHave(size(42), 9999);
Tell us about your environment
The text was updated successfully, but these errors were encountered: