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.

Cerca
Categorie
Leggi tutto
Altre informazioni
IPTV USA
IPTV USA is one associated with the best options for you if a person are looking for the diverse...
By Douglas Maynard 2021-09-18 13:12:35 0 0
Altre informazioni
Roof structure Tips You Can Put In Practice Nowadays
Of the various areas of your property, few are much more vital than your roof. A highly-created...
By Fields Chen 2021-09-20 07:21:42 0 0
Altre informazioni
Meilleur IPTV: Unlocking the Best IPTV Services for Endless Entertainment
In an era where streaming is king, meilleur IPTV services are taking the world by storm,...
By Jason Hardy 2024-12-19 08:54:32 0 0
Health
Benefits and price of Unity Keto.
  Unity Keto The amazing BHB ketones here gives you the moment fat consuming outcomes in a...
By Kerin Len 2021-08-06 09:47:33 0 0
Altre informazioni
Sensors Market Size, Share, Industry Growth Analysis 2030
The global sensors market size was valued at USD 182.8 billion in 2023 and is poised to grow at a...
By Naveen Pandey 2024-12-06 12:25:38 0 0