How to integrate Protractor test cases in Atom using Typescript?

后端 未结 3 1669
慢半拍i
慢半拍i 2020-12-18 15:45

I have installed typescript for atom for writing Protractor Scripts For automation.

My code is written in Jasmine Framework as protractor supports it nicely.

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-18 16:01

    You have to install jasmine and node typings so that typescript recognizes them. Now there is even a better approach, there is no need of typings folder and typings.json. we have @types dependencies for the same.

    so you can do that by following steps-

    go to your project folder and install the dependencies -

     npm install --save-dev @types/jasmine //this would install jasmine typings as a dev dependency in your package.json
     npm install --save-dev @types/node   //this would install node typings as a dev dependency in your package.json
    

    once you have installed try compiling it with tsc or tsc -w watch mode, now you shouldn't see those TS syntax errors!

    And you have to import browser from protractor/globals to use its methods, like this-

    import {browser} from 'protractor/globals';
    

    For more details you can check out my rep for initial setup of protractor with typescript it uses cucumber as well as you can check out the official protractor-typescript example

提交回复
热议问题