Run protractor tests in typescript using VSCode

In our previous post, we have seen how to install protractor and it’s prerequisites.

we will setup some more steps to run protractor tests

Create a new file conf.ts under C:\Protractor\Test\

refer configuration library for more options.

Create a spec file calculator.ts under C:\Protractor\Test\specs

Jasmine framework considers each test script as specs,

Describe represents test suite and accepts 2 parameters, description and function name (can pass empty function as well), describe can have any number of test cases ( it blocks)

beforeEach executes every time a it block encounters.

each it block defines one one test case [we should keep each it block independent].

Refer jasmine 2 for more information.

Folder structure should look like

Now key press ctrl + ` to open terminal and enter

webdriver-manager start

You should see a line

INFO - Selenium Server is up and running

Then click on + sign to create another terminal instance and enter

npm test

npm test performs following steps- [look for the scripts section of package.json]

tsc – All the *.ts files are transpiled to *.js files and then executes

protractor ConvertedJSfiles/conf.js

Console output –

2 specs as we have 2 it blocks in calculator.ts file

Complete code can be found under

Content posted is based on learning or working experience, please leave comments if anything needs to be added or updated, discuss your queries on our, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: