I have an Angular web app that continuously listens for notifications from the backend via long-poll:

scope.notification = $resource('/notification').get();


This request never completes in the test environment. This is a problem for Protractor, because it wants to wait for all outstanding HTTP requests to finish.

I see a number of potential solutions, but have some issues with all of them.

I do not see a way to tell Protractor to ignore this request. Issuing it from $interval (which itself is ignored) is not a solution. Protractor will not wait for the request to be sent, but once it's sent, it will still wait for it to complete.

So I'm trying not to send this request when running the tests. But how do I know I'm in a test?


I could add a flag to the URL (?protractor=true). But my web app modifies the URL all the time, so it would get cleared quickly.
I tried setting a variable: browser.executeScript('window.runningProtractorTests = true;'); But it seems Protractor will wait for the page to sync first before running executeScript. And I'm sending the request right away when the page loads.
I could set a cookie. But it's fairly cumbersome, e.g. I'd have to load the page twice. (See issue 341 for more difficulties.)
I could set a user agent. It's not easy either. I would need to set browser flags for each browser in the config file. I do not want to completely override the user agent (to Protractor, for example) out of fear that my libraries may rely on interpreting the user agent string, so I'd have to figure out the right string.
I could check if the server is running on a specific port. But then a year from now someone will try to run the production server on the same port and not understand why the notifications don't work.
Making the test backend complete the request immediately does not help, because it's immediately sent again whenever it completes. But I guess I could introduce a special "you are in a test" notification and stop the polling when this is received. This would mean a (small) change to our protocol, so I'd rather avoid it if possible.


Is there no straightforward way to do this?


Question: Who to involve when making user tasks/scenarios for a usability test?
Answer: I've always asked the product manager (hopefully a single person, not a committee), whom I understand to be the person who decides which qualities (like performance, usability, security, and what @ripu1581 mentions) are important to the product and who decides which features are developed. If that responsibility lies with somebody titled "Architect" or "Developer", that's fine as well. You need to synch with this person to ensure results from the test are implemented and thus, will become visible. 

If you have knowledge in the business area and with previous version of the product, they are usually happy to consider proposals for tasks from you. If you are new to the team, you probably cannot press your own agenda of what should be changed, but need to follow their ideas of what is important. (That's not bad, since it's usually taken me a single usability test to surprise the team what users find intuitive and what not - so after the test results are out, your opinion will be appreciated much more.)

I would not extend the scope of the test across what is feasible to tackle in the near future. Preparing and conducting the test is effort for everybody, and the closer the connection between this effort and immediate changes, the clearer the value of a usability test becomes. 

In addition to the tasks, you most likely also need a screener: A document describing your target group, which allows you to sort out people who your product is not addressing. Be careful when preparing this with the product manager! If anybody wants to question your results, a marginal fit between target group and test participants is their best argument. 

To ensure everyone is informend, invite everyone from developer to manager to tester to watch the sessions - stories about users being stuck stay with the team and help you in subsequent priority settings.