-
Notifications
You must be signed in to change notification settings - Fork 26
Adding a check in click event listener to prevent undefined exception #57
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.
Depending on whether the added test actually verifies the fix, may need a change to the test.
@@ -0,0 +1,57 @@ | |||
'use strict'; |
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.
@aniljca does this test fail without your change? I notice there are no "click" events, so not sure it would actually encounter the problem.
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.
@grawk Yes, it does fail without my change. Please see line #12 where I've configured Click events as one of the arguments. The code does reach line #198 with this configuration and fails (without my change) when driver.getSession() returns undefined value, in cases where we have multiple test cases in the suite.
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.
Great! Thanks for the clarification.
@@ -1,5 +1,9 @@ | |||
# nemo-screenshot changelog | |||
|
|||
## v2.2.3 | |||
|
|||
* added a check in click event listener to prevent exception when driver.getSession() returns undefined value. See https://github.com/paypal/nemo-screenshot/pull/57 |
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.
👍
@aniljca LGTM! 👍 |
Adding a check for driver.getSession() value in Click event listener to fix undefined error in certain cases. We were getting the following error without this check when Click capture is configured and test is configured to quit driver after each iteration when more than one test cases were present in the test suite.
TypeError: Cannot read property 'then' of undefined
at index.js:198:36