angelozerr / angularjs-eclipse

AngularJS Eclipse Plugin
https://angularjs.org/
Eclipse Public License 1.0
328 stars 90 forks source link

Run/Debug Protractor tests #178

Open angelozerr opened 8 years ago

angelozerr commented 8 years ago

It should be cool if weio could run/debug protractor test. To do that we could provide an extension point to create a launch for protractor. We could implement this extension point with several JavaScript Debugger like we have done for debugging tern plugins.

@piotrtomiak what do you think about that?

See discussions at:

piotrtomiak commented 8 years ago

@angelozerr sounds like a great plan. Can you tell me what kind of input would you expect from me? I have read your suggestions on the Genuitec forum regarding debugger and they are good. We are considering them for improvements in the near future. However, as far as I understood you want to create a dedicated launch config for protractor tests, like for JUnit?

angelozerr commented 8 years ago

@angelozerr sounds like a great plan.

Cool:)

Can you tell me what kind of input would you expect from me? I have read your suggestions on the Genuitec forum regarding debugger and they are good.

For the moment, nothing:) I would like just share you my plan.

We are considering them for improvements in the near future.

Cool

However, as far as I understood you want to create a dedicated launch config for protractor tests, like for JUnit?

No, I don't want to do that. I want to reuse your work on debugger. I have started to refactor your debugger work to support other thing to launch than tern and it starts working: I can select spec.js file and do run or debug and it debugs the protractor. I will commit soon and I need feedback because I'm not an user of protractor (but more people needs that).

angelozerr commented 8 years ago

However the only restriction is that protractor folder (getted with npm install protractor) must be inside the workspace, because debugger waits an IResource.

piotrtomiak commented 8 years ago

@angelozerr I will work on removing this limitation. One thing here is that usually the node modules would get installed into "node_modules" folder of the project itself. Then it would be in the workspace.

angelozerr commented 8 years ago

@angelozerr I will work on removing this limitation.

Cool!

One thing here is that usually the node modules would get installed into "node_modules" folder of the project itself. Then it would be in the workspace.

Yes I have started like this. User need to do npm install protractor inside her project. After that we could improve it when you will remove this limitation.

My other idea is that user could create a "protractor" project which hosts protractor cli.js etc to avoid doing npm install protractor in each project.

angelozerr commented 8 years ago

@piotrtomiak if you are interested you can play now with protractor to run/debug. See https://github.com/angelozerr/angularjs-eclipse/wiki/Protractor

To run/debug protractor, I use your tern debugger that I have a lot modified to start tern , protractor and other thing.

I have not created a specific protractor launch configuration type, because I use tern debugger which already uses a launch configuration type,. I don't know how to use a launch configuration type inside an other launch configuration type, have you an idea?

piotrtomiak commented 8 years ago

@piotrtomiak if you are interested you can play now with protractor to run/debug.

Great support! I think that customizable Protractor launch configs is the only thing missing.

To run/debug protractor, I use your tern debugger that I have a lot modified to start tern , protractor and other thing.

That was a good idea, that way you have a nice framework you can use to provide support for other specialized debug/run launches. However, generated launch configs were not intended to be visible to the users, so wrapping that up into a Protractor launch is the way to go.

I don't know how to use a launch configuration type inside an other launch configuration type, have you an idea?

There are several ways to do it. One is to define a new launch configuration type (Protractor) and from withing that launch configuration type delegate you create and call the dependent launch configuration delegate (debugger) passing appropriate launch configuration options.

So, basically you would create a protractor launch configuration delegate, which under the hood in its launch method would just make a call through "tern debugger" framework to appropriate debugger launcher. The options for the launch would be customizable through the Protractor launch interface and that way you can hide some stuff from the users or expose some important stuff in a prettier way. The protractor launch would be the one which is persisted and visible to the user, the debugger launch config would be temporary and not accessible to the user (as it is with Tern debug launches). This is a simple way to avoid any plugin dependency. It has just one drawback - the icon of the launch in the Debug view will not be easily customizable, though I think it should be possible.

Let me know if you have any questions!

angelozerr commented 8 years ago

So, basically you would create a protractor launch configuration delegate, which under the hood in its launch method would just make a call through "tern debugger" framework to appropriate debugger launcher.

I have tried to do that but it doesn't work -( There are no error, but eclipse console displays nothing.

I suppose that it's a problem with ILaunch/IProcess of protractor delegate that it is not used (because I call tern debugger).

piotrtomiak commented 8 years ago

We could collaborate on that code, I will help you to get it working. Can you create PR with the stuff you have written and I'll take it over from there?

angelozerr commented 8 years ago

We could collaborate on that code, I will help you to get it working.

That's cool:) but forget my last comments, I have found the problem, it works. I will commit soon my work.

After that I will update https://github.com/angelozerr/jsbuild-eclipse to use "tern debugger" and benefit with debug of Grunt/Gulp. I love so this idea with "tern debugger" :) Thank's @piotrtomiak for your contribution about "tern debugger"!

angelozerr commented 8 years ago

@piotrtomiak you can play with protractor support. Now it creates a Protractor launch that you can customize if you need (choose debugger, node install).

I'm waiting for feedback.

piotrtomiak commented 8 years ago

@angelozerr For me, I am not able to see and edit the launch configuration. Also, I think with experience of @Starsk44 the launch configuration is little confusing for users. When a launch config is created it should point to default value, not store it. That's how we did with JavaScript Debug Launch. You can choose to use a default installation (than the field is stored as null) or a particular one, which results in something stored in the launch config.

angelozerr commented 8 years ago

@piotrtomiak I have stored value inside launch config protractor, because user want sometimes change debugger, protractor cli file and more add args for protractor (not supported for the moment). So I think it's important to save the launch and user can edit it. No?

piotrtomiak commented 8 years ago

Yes, it is, but for me, I couldn't find a protractor launch config anywhere. Something is wrong here. So, maybe it is not good to remove the protractor launch, but rather fix it, so that it shows in run/debug launch configurations.

angelozerr commented 8 years ago

Yes, it is, but for me, I couldn't find a protractor launch config anywhere. Something is wrong here.

It is stored inside External Tools (liek Program) and not inside Run/Debug. If you don't like that I can remove the category https://github.com/angelozerr/angularjs-eclipse/blob/master/org.eclipse.angularjs.ui/plugin.xml#L459 to show the launch in the Run/Debug

See https://github.com/angelozerr/angularjs-eclipse/wiki/Protractor#launch-configuration

piotrtomiak commented 8 years ago

To be true, I haven't found it there either, but yes I think it is better to place it in the Run/Debug launch configs.