Skip to content

Handle errors other than Timeout in keyword 'Handle Alert' #1501

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 7 commits into from
Nov 2, 2019

Conversation

Zeckie
Copy link
Contributor

@Zeckie Zeckie commented Oct 28, 2019

Handle TimeoutException separately in AlertKeywords._wait_alert
Raise the current exception only for TimeoutException and add new except block for WebDriverException.
#1500

Raise the current exception only for TimeoutException and add new except block for WebDriverException.
robotframework#1500
@aaltat
Copy link
Contributor

aaltat commented Oct 29, 2019

I understand what you have done and I can see the reasoning behind. Only thing to do is to write some test for the chance. What you think, is this easy to test in the unit or in the acceptance tests

% secs_to_timestr(timeout))
except WebDriverException as e:
raise AssertionError('An exception occurred waiting for alert: %s'
% str(e))
Copy link
Member

@pekkaklarck pekkaklarck Oct 29, 2019

Choose a reason for hiding this comment

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

str(e) fails if the error contains non-ASCII characters on Python 2. Good news is that str() can just be removed and it ought to work fine.

e alone perhaps looks a bit odd and could be renamed to err at the same time. I think that's used more in SL code base.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made those changes in commit d61a803

@aaltat
Copy link
Contributor

aaltat commented Oct 30, 2019

It looks like something broken in the alert handling and test in CI fails. Could you take a look and fix the issue.

Acceptance test "Handle Alert when popup window closes" switched window to a popup window, but that window is closed by javascript. Switch back so future tests don't fail.
@aaltat
Copy link
Contributor

aaltat commented Oct 30, 2019

In some of the environments there are constant failures:

FAIL: Acceptance.Keywords.Alerts.Handle Alert when popup window closes
Expected error 'STARTS:An exception occurred waiting for alert' but got 'Alert not found in 1 second

Unfortunately the log.html is not saved anywhere from the Travis runs.

I wonder is this a timing issue and would this be easier to test in the unit level.

@Zeckie
Copy link
Contributor Author

Zeckie commented Oct 30, 2019

Unfortunately the log.html is not saved anywhere from the Travis runs.

I wonder is this a timing issue and would this be easier to test in the unit level.

Yes, it would be much easier to troubleshoot if we could see the log.html
I agree that it looks like a timing issue - will try increasing the timeout & put a teardown so the new test failing won't cause other tests to fail.

@Zeckie Zeckie closed this Oct 30, 2019
@Zeckie
Copy link
Contributor Author

Zeckie commented Oct 30, 2019

oops, didn't mean to close

@Zeckie Zeckie reopened this Oct 30, 2019
@aaltat
Copy link
Contributor

aaltat commented Nov 2, 2019

Fixed one minor thing and then this ready to go. Thank you for the contribution.

@aaltat aaltat merged commit ac49c0a into robotframework:master Nov 2, 2019
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.

3 participants