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 150 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 15+ iOS 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 itextfield and press Tab.
public TextField FirstNumber => Element.CreateById<TextField>("IntegerA");
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.
API Usability- Locate Elements
Additional methods and ability to add a custom locator.
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.
public TextField NumberOne => Element.CreateById<TextField>("IntegerA");
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 button = App.ElementCreateService.CreateByName<Button>("button").ToBeClickable().ToBeVisible(); button.Click();
BELLATRIX comes with 7 default ToBe methods.
Moreover, it is relatively easy to add your custom ToBe methods if needed.
150+ Additional Elements Actions
BELLATRIX saves you a lot of effort and code with extended elements and services APIs.
BELLATRIX exposes 15+ iOS controls. Each of them includes only the actions that you should be able to do with the specific control and nothing more.
var button = App.ElementCreateService.CreateByName<Button>("button"); button.Click(); var seekBar = App.ElementCreateService.CreateByName<SeekBar>("seekBar); Assert.AreEqual(false, seekBar.IsDisabled); var checkBox = App.ElementCreateService.CreateByName<CheckBox>("checkBox"); checkBox.Check(); Assert.IsTrue(checkBox.IsChecked); var password = App.ElementCreateService.CreateById<Password>("passwordBox"); password.SetPassword("topsecret");
Or we bring new useful methods to default controls such as ScrollToVisible.
var textField = App.ElementCreateService.CreateById<TextField>("IntegerA"); textField .ScrollToVisible(ScrollDirection.Down);
The most important attributes of each iOS control are included, as well as their assertion alternatives.
var label = App.ElementCreateService.CreateByName<Label>("AnswerLabel"); Assert.IsTrue(label.IsPresent); Assert.AreEqual("Meissa Is Beautiful!", textField.GetText());