Protractor Typescript Cucumber.
Protractor Framework Setup:
https://github.com/angular/protractor/blob/5.4.4/exampleTypescript/tsconfig.json
1- npm init
Will create a package.json in the project folder
package.json: All the dependencies.
2- npm install In package.json add all dependencies required for protractor, cucumber.
{
"name": "protractortypescriptcucumber",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "sudheer",
"license": "ISC",
"dependencies": {
"protractor": "^7.0.0",
"typescript": "~5.2.2",
"jasmine": "~5.1.0",
"@types/jasmine":"4.3.5",
"@types/jasminewd2": "2.0.10",
"ts-node": "10.9.1",
"@types/node": "20.5.8"
}
}
3- configuration.ts--> copy this file format from protractor js official site
import {Config} from 'protractor';
export let config: Config = {
//Protractor will connect directly to the browser Drivers
directConnect: true,
framework: 'jasmine',
//seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['testspec.ts'],
capabilities: {
browserName: 'chrome'
},
jasmineNodeOpts:{
showColors:true,
}
//protractor cannot understand typescript- compile and run typescript files
//converting js to ts.
//protractor compiler is designed for only JS.
}
4-npm install -g typescript
5-tsc --init (will reate a ts-config.json file)- convert typsescript to javascript
6-
Comments
Post a Comment