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.

Поиск
Категории
Больше
Другое
Remote Sensing Technology Market 2021 Growth, Trends, Leading Players and Business Insights Forecast to 2027
The remote sensing technology is used for military and police as it can identify, measure or...
От Animesh Rao 2021-09-15 11:13:05 0 0
Networking
Logistics Market Revenue, Opportunity, Business Segment Overview and Key Trends 2032
The  logistics market is a vital component of the economy, serving as the...
От Sahil Salokhe 2024-11-26 04:12:28 0 0
Игры
Automotive Air Flow Meter Market Size, Share, Growth Strategies, Trend Forecast To 2027
Automotive Air Flow Meter Market Highlights: Increasing need for integrated electronics systems...
От Ajit Ben 2021-05-25 10:44:16 0 0
Другое
https://karas-orchards.wixsite.com/karasorchards-cbd
  Kara's Orchards CBD Gummies Please think about making a contribution to Vox right now,...
От Somkal Jika 2021-05-13 11:29:05 0 0
Другое
The best approach to the use of gogo anime
The media industry has continuing to move in one degree of company to another in their severe...
От McDermott Mortensen 2021-09-20 08:17:24 0 0