Accelerate Test Creation
To speed up the CI process, we developed a group of features that support every phаse of the process, from test creation to execution. Let’s take a look how BELLATRIX can speed up your test creation by providing element snippets, handy elements locators, smart wait for the elements, more than 200 additional elements actions, ready-to-go templates and much more.
Speed Test Writing with Element Snippets
By giving you a corresponding snippet for more than 30 web elements out of the box, BELLATRIX will dramatically speed up your test writing.
Code snippets are small blocks of reusable code that can be inserted in a code file using a context menu command or a combination of hotkeys. In Visual Studio there are expansion snippets, which are added at a specified insertion point and may replace a snippet shortcut. For example, to generate a TextField property, you need to type somewhere in you class wtextfield and press Tab.
public TextField CouponCode => Element.CreateById<TextField>("coupon_code");
On the first press of tab, the above code is generated. The first placeholder that is selected is the name of the property. Once you change it, you can press Tab. Then, the second placeholder is chosen- the By locator’s type, by default, it is set to Id, press Tab again and change the actual locator.
15+ Handy Elements Locator
7 element locators on top of the vanilla WebDriver and an easy way to add new locators will make element location much easier.
For example, in vanilla WebDriver, you have 8 default By locators (Id, TagName, XPath) and you cannot add your own. However, in many cases, especially if your website uses a CMS system, the IDs of the elements are generated automatically. Meaning they can get quite hard to use- sf_colsOut-sf_1col_1_100-promotions. You might use locator- ID ending with.
BELLATRIX comes with the default WebDriver locators and brings 7 more. Such as:
- ID ending with
- ID containing
- value ending with
- Class containing
- inner text containing
- Name ending with
- Attributes containing
API Usability- Locate Elements
Additional methods and ability to add custom locators.
For example, in WebDriver to find an element, we use the FindElement method while specifying the locator through By class.
IWebElement agreeCheckBox = driver.FindElement(By.Id("agreeChB")); agreeCheckBox.Click();
However, this syntax requires additional effort. It is not fluent since you had to begin a new “chain” using the By static class. Also, it is not extendable if you want to add custom locators.
CheckBox agreeCheckBox = App.ElementCreateService.CreateById<CheckBox>("agreeChB"); agreeCheckBox.Check();
BELLATRIX provides you with a CreateBy method for each locator. Everything follows the natural writing flow, leveraging to the maximal degree on IntelliSense. If you add your custom locator, your method will appear as well.
One of the coolest things that the BELLATRIX element includes, is the By property (knowing how it was located).
API Usability- Wait for Elements
Smart wait for elements that will solve 80% of all use cases.
All elements are internally waited to exist before usage. This solves 80% of all use cases. After that as part of the CreateBy API, we added additional ToBe methods which you can chain. Which means you can specify an unlimited number of conditions for each element that needs to be fulfilled before the element is returned.
var promotionsLink = App.ElementCreateService.CreateByLinkText<Button>("Promotions").ToBeVisible().ToBeClickable().ToExists(); promotionsLink.Click();
BELLATRIX comes with 8 default ToBe methods.
Moreover, it is relatively easy to add your custom ToBe methods if needed.
200+ Additional Elements Actions
BELLATRIX saves you a lot of effort and code with extended elements and services APIs.
For example, there are 15+ HTML5 web controls that cannot be automated out of the box with vanilla WebDriver.
Phone billingPhone = App.ElementCreateService.CreateById<Phone>("billing_phone"); billingPhone.SetPhone("+00359894646464"); Color carColor = App.ElementCreateService.CreateById<Color>("car_color"); carColor.SetColor("#f00030"); Time timeElement = App.ElementCreateService.CreateById<Time>("time"); timeElement.SetTime(12, 12);
Also, instead of using other 3rd party libraries we ease the usage of default web controls as well.
Select billingCountry = App.ElementCreateService.CreateById<Select>("billing_country"); billingCountry.SelectByText("Bulgaria");
Or we bring new useful methods to default controls such as Focus and Hover.
var confirmBtn = App.ElementCreateService.CreateById<Button>("confirm"); confirmBtn.Hover(); confirmBtn.Focus();
Most the important attributes of each web control are included, as well as their assertion alternatives.
var confirmBtn = App.ElementCreateService.CreateById<Button>("confirm"); confirmBtn.EnsureAccessKeyIs(5); var productQuantity = App.ElementCreateService.CreateById<Number>("qt_number"); productQuantity.EnsureMaxIs(5);
HTTP Traffic Capturing and Validations
Control each request and response made by the browser and have the option to modify it or make assertions against it.
You just need to set the shouldCaptureHttpTraffic to true in the Browser attribute.
[Browser(BrowserType.Chrome, BrowserBehavior.RestartEveryTime, shouldCaptureHttpTraffic: true)]
You can access the proxy through the BELLATRIX App service. The proxy service includes several useful assert methods.
Assert that no error codes are present in the requests.
Assert that a specific request was made.
Beyond validations, you can even modify the HTTP traffic.
You can set various URLs to be redirected. This is useful if you do not have access to production code and want to use a mock service instead.
App.ProxyService.SetUrlToBeRedirectedTo( "http://demos.bellatrix.solutions/favicon.ico", "http://demos.bellatrix.solutions/logo.svg");
To make web pages load faster, you can block some not required services- for example, analytics scripts, and you do not need them in test environments.
Ready-To-Go Project Templates
BELLATRIX comes with preconfigured (ready-to-go) project templates.
You can directly start to write automated tests without bothering with tedious project configurations, installing packages, etc.