Wednesday 18 March 2020

protractor framework ..POM+Cucumber+Typescript

POM+Cucumber+Typescript

1. Package.json need below dependancies
"@types/cucumber": "^6.0.1",
    "@types/jasmine": "^3.5.9",
    "@types/jasminewd2": "^2.0.8",
    "@types/node": "^13.9.0",
    "chai": "^4.2.0",
    "chai-as-promised": "^7.1.1",
    "cucumber": "^6.0.5",
    "cucumber-html-reporter": "^5.1.0",
    "jasmine": "~3.5.0",
    "protractor": "^5.4.3",
    "protractor-cucumber-framework": "^6.2.1",
    "ts-node": "7.0.1",
    "typescript": "~3.8.2"
2. Need Step Definition and feature file folder
3. Conf.js contain path of step2..
  Also it contain report creation format ie json
  and "onComplete" input for report in html
4. Step Definition contain hook (same like testng in selenium)file..
  Which use for failure screenshot
5. Page Object folder will contain page related objects which will use in step definition
6. All files will be written in TS and command "TSC" will convert them to JS and then "protractor conf.js" we have to execute
7. reports will be created using cucumber-html-reporter
8.hooks file connect with tags of feature file and you can add extra code with any tags(scenarios) of feature file using hook, use tag after, check failure and then screen shot code in hook, its behave same like listener


for running jenkins.war, use below command from file path thru cmd
java -jar jenkins.war -httpPort=3333
Below is Jenkins config

1. add ur project path in jenkin config
2. add command to run conf file
3. schedule ur script