atecarlos / protractor-http-mock

A library designed to work alongside Protractor for setting up mocks for your HTTP ajax requests.
MIT License
173 stars 70 forks source link

misidentifying protractor config file #6

Closed peterh32 closed 9 years ago

peterh32 commented 9 years ago

Somewhat of a protractor newbie so forgive me if this is user error. My protractor conf filename is "protractor-conf.js". When I run tests with protractor-http-mock, it looks for the filename "protractor.conf". I can work around it by hardcoding the filename in line 34 in getMocksConfig() in init-data.js, but that's not viable long-term.

Here's how I run protractor tests: protractor --specs [path to spec js file] protractor-conf.js Note that the conf filename is the last argument. Maybe http-mock can pick up the filename from there?

Love the functionality though.

atecarlos commented 9 years ago

Hi @peterh32. Check out this section of the readme:

https://github.com/atecarlos/protractor-http-mock#directories-and-file-names

It explains how to configure the plugin with the specific name of your protractor config file.

So your particular case would be:

onPrepare: function(){ require('protractor-http-mock').config = { protractorConfig: 'protractor-conf.js' }; }

Please let me know how this goes.

jdgblinq commented 9 years ago

This seems to break pretty epically with the new protractor 1.5

TypeError: Object # has no method 'getInstance' at module.exports (/node_modules/protractor-http-mock/lib/init-data.js:47:21)

nielssj commented 9 years ago

getInstance has been deprecated for quite some time in favor of the global "browser".

And it was indeed phased out completely in the 1.5 release: https://github.com/angular/protractor/blob/master/CHANGELOG.md#breaking-changes

This should be a fairly easy fix. If I have time later today, I will implement it on my fork and make a pull request.

nielssj commented 9 years ago

I won't be making a fix because @davidduffett already made one on a different fork: https://github.com/AlliterativeAnimals/protractor-http-mock/pull/1

atecarlos commented 9 years ago

Hi @jdgblinq and @nielssj . Sorry for the delay. I just published a fix for the "getInstance" problem. Please let me know if anything else comes up. I will be more responsive from now on.

jdgblinq commented 9 years ago

Hey, thanks, btw. This is working great now. Sorry I didn't have a chance to take a look earlier.

atecarlos commented 9 years ago

No problem! Very glad to know its all working now @jdgblinq