There were a lot of new features introduced in version 1.4.1 as well as bugfixes. The major features are css property verification and custom JavaScript functions in specs
CSS Properties Verification
From this moment you can now check the value of a specific CSS property of a test element on page. Check this example:
login-button
css font-size is: 18px
css font-family starts: Helvetica
css font-family ends: sans-serif
css font-family contains: Arial
css font-family matches: .*Arial.*
JavaScript Functions in Page Specs
Sometimes you might need some functionality which is not in Galen. For instance be able to parameterize your checks only for odd or even items in list. Or anything else you might have stuck with already. Use JavaScript custom functions for that. Here is an example. A file allEven.js
:
this.allEven = function (pattern) {
var size = count(pattern);
var parameters = "2";
if (size > 1) {
for (var i = 4; i <= size; i+=2) {
parameters = parameters + "," + i;
}
}
return parameters;
};
Now you can use it in your page spec. Just import the script like this:
@@ import allEven.js
[ ${allEven("menu-item-*")} ]
menu-item-@
height: 100px
Text Operations
Also when validating a text of an element on page you can now apply lowercase
or uppercase
text operations. This is needed when you don’t want to compare text case sensitive.
greeting
text lowercase is: welcome [email protected] to our cool website!
text uppercase starts: WELCOME
text lowercase ends: website!
text lowercase contains: to our cool
text lowercase matches: welcome .* to our cool website!
Hover Function in GalenPages
When you need to emulate a hovered state of a page element in GalenPages framework you can now do it with hover
function:
this.LoginPage = function (driver) {
GalenPages.extendPage(this, driver, {
emailTextfield: "input.email", // css locator
passwordTextfield: "xpath: //input[@class='password']", // xpath locator
submitButton: "id: submit" // id locator
});
};
var loginPage = new LoginPage(driver);
loginPage.loginButton.hover();
Resize Function in JavaScript API
If you need to resize the window of a browser just call resize
function and pass it a driver and new size like this:
resize(driver, "1024x768");
Simple String in checkLayout Function for Tags
There is no need to pass an array of tags in case you need only one tag in checkLayout
function. Example:
checkLayout(driver, "homepage.spec", "mobile");
BugFixes:
- Same scripts were loading multiple times
- Full page screenshots were not properly waiting for page to be scrolled
- Conditional statements conflicted with parameterized checks
- Unclear error message when missing 'px' in ranges
- Incorrect imported spec path resolution
You can download a new version here
Comments
We have moved all the discussions to Google Groups. From this moment, if you have problems with your test code or some issues with installation, please ask your questions in https://groups.google.com/forum/#!forum/galen-framework.