Posts

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": "1...

Type Script

 is a additiondal feature for java script typescrip= additional +typescript /* ES5- our current browser cannot understand es6 typescript also cannot understand. **-typescript convert script to javascript,es5-browser and protractor will understand-. **-scan the existing intenstiosn , symantics 1- npm install -g typescript 2-create a class bascis.ts 3-tsc basics.ts 4-it will create the js file -basics.js 5-run node basics.js */ basics.ts for ( var i = 0 ; i < 5 ; i ++ ){ setTimeout ( function (){ console . log ( i );}, 100 * i ); } basics.js for ( var i = 0 ; i < 5 ; i ++ ) { setTimeout ( function () { console . log ( i ); }, 100 * i ); } Export -- export class classDemo { // variable is called in class as property //Class consists of properties,methods,constructor //This - refere to current class property username : string ; password : string ; ssn : number ; //default constructor constructor ( ssn : number ){ this . ssn = ssn ...
 Selenium Grid
 Cucumber Notes What is Cucumber in selenium? Cucumber Framework in Selenium is an open-source testing framework that supports Behavior Driven Development for automation testing of web applications. The tests are first written in a simple scenario form that describes the expected behavior of the system from the user’s perspective. What is a feature file? A standalone unit or a single functionality (such as a login) for a project can be called a Feature. Each of these features will have scenarios that must be tested using Selenium integrated with Cucumber. A file that stores data about features, their descriptions, and the scenarios to be tested is called a Feature File Keywords such as GIVEN, WHEN, and THEN used to write the test in Cucumber are called Annotations. GIVEN user navigates to the login page by opening Firefox WHEN user enters correct <username> AND <password> values THEN user is directed to the homepage What is step Definition? A Steps Definitions file stor...

Synczation-js

  const { protractor , element } = require ( "protractor" ); describe ( '' , function (){ it ( '' , function (){ browser . waitForAngularEnabled ( false ); browser . get ( 'https://demos.telerik.com/aspnet-ajax/ajaxmanager/functionality/validation/defaultcs.aspx?product=ajaxpanel' ); element ( by . id ( 'ctl00_ContentPlaceholder1_tbName' )). sendKeys ( 'sudheer' ); element ( by . id ( 'ctl00_ContentPlaceholder1_tbEmail' )). sendKeys ( 'sudheer@qa.com' ); element ( by . name ( 'ctl00$ContentPlaceholder1$RegisterButton' )). click (); //Synczation-js var EC = protractor . ExpectedConditions ; // Waits for the element with id 'abc' to be visible on the dom. browser . wait ( EC . visibilityOf ( element ( by . id ( 'ctl00_ContentPlaceholder1_Label3' ))), 5000 ); browser . element ( by . id ( 'ctl00_ContentPlaceholder1_...

Frames-JS

describe ( '' , function (){ it ( '' , function (){ browser . waitForAngularEnabled ( false ); browser . get ( 'https://rahulshettyacademy.com/AutomationPractice/' ); browser . driver . manage (). window (). maximize (); browser . switchTo (). frame ( 'iframe-name' ); element ( by . css ( "a[href*='sign_in']" )). getText (). then ( function ( text ){ console . log ( text ); }) }); });

Alerts- Accept() Dismiss()

  const { func } = require ( "assert-plus" ); const { element } = require ( "protractor" ); describe ( '' , function (){ it ( 'Non angulat website Alets' , function (){ browser . waitForAngularEnabled ( false ); browser . get ( 'https://rahulshettyacademy.com/AutomationPractice/' ); element ( by . id ( 'confirmbtn' )). click (). then ( function (){ browser . sleep ( '5000' ); }); // browser.switchTo().alert().accept() browser . switchTo (). alert (). dismiss (). then ( function (){ browser . sleep ( '5000' ); }) }) })