问题
First of all, I am very beginner in using node.js / angualar.js /protractor.js and jasmine.js stuff and I am not from web dev corner at all. But for now, I just want to create some protractor test for an angular app and this is actually working quite fine. But I am wondering if it's possible to get VS2013 intellisense working? I would really appreciate if VS would suggest functions of objects like 'browser.xxx'. I am really stuck with that, looking forward for some hints!
thx Florian
回答1:
Ill just give an answer to myself! To get Visual Studio 2013 intellisense and debugging working for angular protractor tests, follow these steps:
- Install node.js
- Install protractor (global) („npm install -g protractor“; „webdriver-manager update“)
- Install Visual Studio 2013 node.js Tools
- Install Visual Studio 2013 TypeScript Tools
- Create a new project „Typescript\Node.js\Blank Node.js Console Application“
- Add your „conf.ts“ and „spec.ts“ files to the project
- Right click on „conf.ts“ and select „Set as node.js startup file“
- In „Project properties“ set your „Node.exe path“ to your protractor executeable file, eg. „C:\Users\myUser\AppData\Roaming\npm\protractor.cmd“
- Download typescript DefinitelyTyped definitions from git hub:
- https://github.com/borisyankov/DefinitelyTyped
- In your VS2013 project folder „Scripts\Typing“ create the subfolders „jasmine“, „protractor“ and „selenium-webdriver“
- Add the typing definition files "angular-protractor\angular-protractor.d.ts", "jasmine\jasmine.d.ts" and "selenium-webdriver\selenium-webdriver.d.ts" into the appropriate project folders you created in the step above.
- Write your protractor test and enjoy code highlighting
- Start webdriver-manger „webdriver-manager start“
- Hit „F5“ to start debugging
Enjoy! Florian
来源:https://stackoverflow.com/questions/28748967/visual-studio-2013-protractor-intellisense