Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Adding a check in click event listener to prevent undefined exception #57

Merged
merged 1 commit into from
Jul 18, 2017

Conversation

aniljca
Copy link

@aniljca aniljca commented Jul 18, 2017

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

Copy link
Member

@grawk grawk left a 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';
Copy link
Member

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.

Copy link
Author

@aniljca aniljca Jul 18, 2017

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.

Copy link
Member

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.

@gabrielcsapo gabrielcsapo self-requested a review July 18, 2017 18:48
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@gabrielcsapo
Copy link
Contributor

@aniljca LGTM! 👍

@gabrielcsapo gabrielcsapo merged commit 84e3c56 into paypal:develop Jul 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants