Skip to content

Fixes to alerts#935

Merged
aaltat merged 12 commits intorobotframework:masterfrom
pekkaklarck:alerts
Oct 5, 2017
Merged

Fixes to alerts#935
aaltat merged 12 commits intorobotframework:masterfrom
pekkaklarck:alerts

Conversation

@pekkaklarck
Copy link
Member

@pekkaklarck pekkaklarck commented Sep 28, 2017

This PR is contains following changes to alerts and to some other (un)related functionality:

This PR is now ready for final review.

This is same behavior as in 1.8.

Also added a FIXME about totally stupid tests inside suite setup
(which did actually reveal this small regression...).
1. Introduce new keywords:
Alert Should Not Be Present
Handle Alert
Input Text Into Alert

2. Add new `action` argument to Alert Should Be Present.

3. Silently depracate all other existing alert related keywords.

4. Change alert polling logic to use WebDriverWait only. Timeout will
   be made configurable later.

5. Documentation cleanup.
Copy link
Contributor

@aaltat aaltat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did read the code but didn't have time to read the test when commuting. Also would like to take a look from the bigger screen.

But generally looks OK.

"'%s' but was '%s'"
% (text, alert_text))
try:
alert = self._wait_alert(timeout=0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the timeout is zero? It would make the tests more stable if we allow small polling.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We expect that there's no alert so in the common case any polling would slow down execution unnecessarily. Very small timeout could be considered, but at least using the global timeout that's 5 seconds by default would be a very bad idea. I'd leave the default timeout here to be zero and just make the timeout configurable with an optional argument.

versions the alert was always accepted.
"""
message = self.handle_alert(action)
if text and text != message:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the text is exact match, but I was thinking could if text and text not in message: be also useful. Just a random thought, without a real use case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, if I had designed this I'd probably supported glob-style patterns (e.g. foo *) similarly as Run Keyword And Expect Error does. Don't think changing existing logic is a good idea, though. Could add pattern=False, but that's a topic for a separate issue. It's anyway already possible to do, for example:

${text} =    Alert Should Be Present
Should Match    ${text}    foo *

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. And alerts are pretty simple in any case.

@aaltat
Copy link
Contributor

aaltat commented Oct 4, 2017

Again I did read the code but didn't have time to read the test when commuting. Will read rest of the PR later.

@aaltat aaltat merged commit 65d9957 into robotframework:master Oct 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants