What is Protractor? How to write a test using Protractor Framework?

0
0

What is Protractor?

Protractor is an open-source automation testing framework it is written using NodeJS. It can offer combined end-to-end testing for web applications built using AngularJS. It can support both Non-Angular and Angular applications. It is used to test advanced HTML attributes, Protractor is widely preferred for testing AngualrJS. 

It leveraged the power of various technologies such as Selenium Webdriver, NodeJS, Jasmine, Cucumber, Mocha, etc. It offers a strong automation test it suite the capability of performing Cross Browser Testing for Web applications.   

How to write a test using Protractor Framework?

The Protractor is set up, to perform the test, one needs a spec file and a configuration file. The spec file is the actual test script, the configuration file specifies the details of the test such as to find the test file which the browser and framework to be used for running them along with other configurations. The configuration is not defined in the configuration file Protractor uses the defaults. 

The Scenario to be automated: 

Enter the search query "BrowserStack" in the search box.

Launch Google.com on the browser

Check out whether the title of the resulting page is "BrowserStack-Google Search" 

Config file for the Test

Specs file for this test scenario is saved as conf.js

exports.config = {

framework: 'jasmine',

capabilities: {

browserName: 'chrome',

},

specs: ['ProtractorTestScript.js']

};

Specs file for the Test

Specs file for this test scenario is saved as ProtractorTestScript.js

describe('Google\'s Search Functionality', function() {

it('can find search results', function() {

browser.driver.get('https://google.com/');

element(by.name('q')).sendKeys('BrowserStack');

element(by.name('btnG')).click();

//title of the launched webpage is expected to be BrowserStack - Google Search

expect(browser.getTitle()).toEqual('BrowserStack - Google Search');

});

});

Protractor is a well-known open-source end-to-end testing framework for Angular and AngularJS applications. It was developed by a team in Google on the top of WebDriver. Are you looking for a Protractor Online Course? Walk into FITA Academy is one of the best educational institutions to learn Protractor Online Training.

Search
Categories
Read More
Games
Some Easy Way for Farming POE Currency
PoE Exalted Orb is often a POE Currency item that may be utilized to enhance a piece of...
By igvault poecurrency 2020-06-23 01:30:44 0 0
Other
Veja 6 Dicas Que Infalíveis Para Perder Halter Em Grau Superior Rápido
Pimentas e mais condimentos, como o gengibre e também a salsa, salubre energéticos...
By Farley Laugesen 2021-09-18 07:35:24 0 0
Other
SPRZEDAJE BROŃ - Ważne Doświadczenia Z Świata I Zagranicy - Wyborcza.pl
Także niepełnosprawni korzystają od 7. miesiąca stosunku książki ze innej ochrony przed...
By Faktury Rachunki 2021-09-19 18:22:40 0 0
Other
Mayur Vihar Escorts provides you Lusty Escorts - 9871368411
Visit to give your body and mind satisfaction In case you are a financial specialist willing to...
By Riya Singh 2021-08-26 09:14:08 0 0
Other
Make a Far better Romantic relationship Together With Your Consumers With Aussie Freight Firm
Move of merchandise and products by air flow, sea or property is actually a sophisticated process...
By Halsey Holm 2021-09-21 09:54:10 0 0