-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Coffeescript preprocessor #38
Comments
I'm trying to keep the project as lightweight on dependencies as possible, so this would be perfect for a plugin. I know little about coffeescript but would be happy to discuss design or make any changes to protractor that would be necessary for the plugin to work! |
Also @karlgoldstein who was also interested in this. |
Thanks Julie - I've added plugin support to protractor (5147106) and built a coffeescript preprocessor (https://github.com/lebek/protractor-coffee-preprocessor). The plugin support is loosely based on what they did with Karma. Some caveats I need to work out before submitting a pull request:
We're going to trial protractor for new E2E tests on a large angular project, I'll let you know how it goes. |
Indeed, the lack of transparent coffeescript preprocessing is a serious barrier to adoption for our team. Karma made it trivial, without even the need to modify a config file. |
👍 - to teams that write CoffeeScript everywhere else this is a pretty major hindrance. |
+1 |
@lebek does the coffee preprocesor work? I'm having trouble understanding how to get it running without any example code. I realize it may not be stable yet - but it would be great to be able to use coffeescript with protractor. Thanks. |
Protractor's internals have changed a bit since I added plugin support. I'll look at merging the upstream changes this weekend and if possible I'll make a pull request. |
I found a very simple way to enable basic CoffeeScript support for specs. Simply put Another thing; |
Thanks @bjorne . I also had to run a |
You can alias |
@alexurdea could you please provide an example? |
I'm answering myself...something like: exports.config = {
onPrepare: function() {
global.findBy = protractor.By;
}
} |
@matteosister I have: exports.config = {
onPrepare: function() {
global.select = global.by;
}
}; And then I use it like this: |
Alternative workaround for "by" is to use JS escaping with backticks: myButton = element `by`.name 'foo' |
Is there any reason the project has to use |
Adding |
yeah, they made a breaking change in 1.7 that I haven't looked at how to integrate yet. This is from CS changelog:
Not sure why they did that or what needs to happen to make that work. Not sure if a fix for 1.7 will break previous versions. Will do some testing. |
Interesting. Just tried adding |
Seems to do it for me and works on 1.7 and 1.6.3 |
CoffeeScript now requires a register call to be made. Ref #38
Same as @JakeBecker, the only way to use CS with protractor > 0.17 is to include And it requires upgrading to coffee-script 1.7 :( |
@flegall you can't do CoffeeScript.register() unless you do |
Yes, but for some odd reason, I can't use CS anymore on protractor > 0.17, the only fix that works is to upgrade to CS >= 1.7 and to |
- remove hardcoded *specs* paths - template hardcoded *`port.test`* - change *CoffeeScript* require from `coffee-script` to `coffee-script/register` -- v.1.7.0 no longer autoregisters `*.coffee` extensions[^1] [^1] See: <angular/protractor#38>
@flegall is correct, I also had to write |
hmm ill take a look. maybe the 0.17 refactor has the references wrong now |
@lebek , Is this plugin still working? I dont see 'plugins' config property in sample protractor config. |
@aleks-sidorenko seems that no plugin is needed, just run |
now you just have to include coffee-script in your npm modules and it will work atuomatically |
+1 @eddiemonge. If your using something like coffeify in the rest of your project it wont work and will not throw an error. Because:
|
Is this within the scope of the project or would you rather see it as a plugin?
The text was updated successfully, but these errors were encountered: