You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We don't test that the webchat has successfully been initialised. When the user clicks on the 'start webchat' button, the following code determines whether the webchat should open in a popup window, or redirect the current page to the webchat (the popup is the default action).
We should be able to test this by using a jasmine spyOn the window object, but this doesn't appear to work (a limitation of jasmine or the uniqueness of the window object, perhaps). Instead, we could abstract the calls that do this into separate functions, something like this:
...and then spying on these two new functions in the test. Spying automatically blocks the function from executing, so we'd test that the correct thing had happened (either redirecting or opening a popup) in the right context, but not actually do anything.
Unfortunately this won't work because the webchat code isn't structured as a module, so we can't do spyOn(module, 'changeWindowHref'). In order to write this test we would need to rewrite the webchat code as a structured module where this is possible.
The text was updated successfully, but these errors were encountered:
The webchat tests could be more comprehensive (discovered while removing the jQuery from webchat).
We don't test that the webchat has successfully been initialised. When the user clicks on the 'start webchat' button, the following code determines whether the webchat should open in a popup window, or redirect the current page to the webchat (the popup is the default action).
We should be able to test this by using a jasmine
spyOn
thewindow
object, but this doesn't appear to work (a limitation of jasmine or the uniqueness of the window object, perhaps). Instead, we could abstract the calls that do this into separate functions, something like this:...and then spying on these two new functions in the test. Spying automatically blocks the function from executing, so we'd test that the correct thing had happened (either redirecting or opening a popup) in the right context, but not actually do anything.
Unfortunately this won't work because the webchat code isn't structured as a module, so we can't do
spyOn(module, 'changeWindowHref')
. In order to write this test we would need to rewrite the webchat code as a structured module where this is possible.The text was updated successfully, but these errors were encountered: