ProtractorWrap
A Nodejs library to simplify the ui test automation for AngularJs application. It is a wrapper over protractor in-built functions, that helps to structure the ui test automation.
Installation
npm install protractorwrap
Usage
var pWrap = ;
-
To click an element.
Syntax:pWrap;1 Locate by xpathExample:pWrap;2 Locate by nameExample:pWrap;so on and so forth with other methods to locate an element and click it -
To get an element.
Syntax:pWrap;1 Locate by xpathExample:var contactLabel = pWrap;;2 Locate by nameExample:var dogName = pWrap;;so on and so forth with other methods to locate the element and get it -
To input text in a textbox.
Syntax:pWrap;Example:pWrap -
To navigate to a page.
Syntax:pWrap;Example:pWrap -
To get value of a key from json file.
Syntax:pWrap;Let us assume you have a config file.
config.jsonIn your test if you want to read profile object, you can do that as below:
Example:var config = ;profile = pWrap; -
To set cookie.
Syntax:pWrap;Example:pWrap; -
To check if element is visible and displayed.
Syntax:pWrap;Example:pWrap; -
To get cookie.
Syntax:pWrap;Example:pWrap -
To compare current url.
Syntax:pWrap;Example:Let us assume you have navigated to https://cimpress.com/ and you want to verify if the current url and expected url are same.pWrap; -
If you have use-case where in you have a browser specific authentication pop-up and you want to bypass the pop-up you can do it as below:
Let us assume you have the config, service account credentials and application url in different json files.
Syntax:pWrap;Config.jsonCredentails.jsonApplicationUrl.jsonvar config = ;var credentials = ;var urlFile = pWrap;profile = pWrap;auth0 = pWrap;connection = pWrap;pWrap;pWrap;......The method is specific to auth0 that is the method generates auth0 and stores the profile and auth0 token in the browser resulting in bypass of authentication pop-up.
-
To refresh page.
Syntax:pWrap;Example:pWrap;If your page takes a long time to load and you want to wait then you combine refresh with sleep as below:pWrap;pWrap;
Contributing
We appreciate contributions. Fork the repository and come up with a pull request. Thank you! We will focus on development of ProtractorWrap and make the UI test automation easy by using a proper structure under a single hood.