Galen allows automated testing of look and feel for your responsive websites.
Grunt plugin for Galen testing framework
Feel free to donate
Or donate Bitcoins:
Also via greenaddress
This module downloads the GalenFramework for you
Warning - Galen framework requires Java runtime environment to work. Java is not included in this module.
In the project directory run:
npm install --save-dev grunt-galenframework
Then add it to the Gruntfile:
Galen testing requires three components to run through your tests:
http://127.0.0.1/counts, of course)
.specfiles. (read more)
You might find these articles helpful during the preparations:
grunt-galenframework exposes a useful
gl.js module1, so you can spend more time improving your project, rather than writing the test files.
Test files' main role is to assign
.spec files to their target pages of the project. For example
example-test.test.js can look like this:
This test suite runs the
example-test.spec file against the main project page.
Remember that you are not bound to the
gl.js framework and, if you are familiar with vanilla Galen API, you are welcome to use it with
gl.js docs can be found along with task configuration reference at the bottom of this README.
Example configuration for a simple Galen task:
galen:local:// Check all test.js files in the test directorysrc: 'test/**/*.test.js'options:// Run test on the localhost:3000url: ''devices:// Run tests in firefox browser, scaled to basic desktop resolutiondesktop:deviceName: 'desktop'browser: 'firefox'size: '1280x800'// Also run them in firefox, but scaled to iPad screen sizetablet:deviceName: 'tablet'browser: 'firefox'size: '768x576'
Now just run the command
grunt galen:local and enjoy the show!
Combine all galen test files into one to speed up the testing process.
Warning - Do not enable this if you wish to know the number of passed/failed tests. If enabled, number of tests will always be 1.
Object containing basic information about the project.
URL of the project. This URL is prioritized over options.url.
Name of the project. Can be used in test files via getProjectName().
URL of the project.
Overriden by the options.project.url, if defined.
Project URL is not necessary, although it is passed to test files via configuration and can be easily read in every test suite via getProjectPage() and getProjectSubpage(subpage).
Object containing device definitions for tests. Each device has to have at least three parameters defined in Galen docs:
size. (read more)
Warning - All desired capabilities ought to be strings. Therefore tags' arrays, boolean values and numbers have to be cast to strings in the Gruntfile.
true, if you want to use a config file.
Set to desired config file.
true, if you wish Galen to generate HTML report for every test suite.
Set to desired HTML report directory.
true, if you wish Galen to generate JSON report for every test suite.
Set to desired JSON report directory.
true, if you wish Galen to generate testNG report for every test suite.
true, if you wish Galen to generate JUnit report for every test suite.
Set to desired JUnit report directory.
Set to desired testNG report directory.
Configuration object for a remote Selenium Grid.
URL address of your Selenium Grid.
Overrides options.seleniumGrid.username and options.seleniumGrid.accessKey. (Either is assumed to be contained in the url or not necessary to access the Selenium Grid)
(Only for SauceLabs) SauceLabs username.
(Only for SauceLabs) SauceLabs login. This most of the time should have the very same value as
username, unless you use separate accounts across your team.
(Only for SauceLabs SauceLabs access key.
trueto disable gl.js functionality for test suites.
Working directory. (if enabled, gl.js will be created in that directory)
gl.js in your test file, you have to load
gl.js is created on runtime in your
options.cwd directory, so, for example, if your tests are placed under
test/ and you haven't modified the
options.cwd, you should load
../gl.js in your test suite.
gl.js exposes its public interface to the test file in the global scope.
Main functional interface. Implements several useful functions to speed up your tests.
Open target page in the browser on a target device. If page times out, test will be failed.
If pageElements is defined, Galen will attemp to fetch these elements from the webpage.
device* - a device specification
url - a target webpage url (see also config.getProjectPage() and config.getProjectSubpage())
primaryFields - a collection of selectors for elements needed in tests (galen docs)
Run a test file on the target device, on the current webpage. This is what Galen is for, after all.
device* - a device specification
file - a path to the
tags - a collection of optional Galen tags for the test
Terminate all devices and finish testing immediately.
Remove all elements, fetched from the current webpage, from the cache storage.
Retrieve devices list for tests. Compatible with Galen #forAll().
Retrieve project name. ('Project', if undefined)
Return main project URL.
Return main project URL with appended subpage suffix.
Get Selenium Grid configuration. Exposes two values:
enabled- Selenium Grid enabled flag
url- Selenium Grid url.
Example projects are presented in the
example/ directory. It is sufficient you go into the directory and run
npm install && grunt to test any of the examples there.
Grunt galen has its testing script
npm test, which launches an example on a current version of the script (does not load a script from NPM, uses
Example includes both local and remote testing.
SauceLabs account for this project is open for everyone who wishes to test the module on a Selenium Grid. Account credentials are available both on SauceLabs page and here:
login: 'gruntgalen-sl'username: 'gruntgalen-sl'accessKey: '5fa3a9f6-a912-4294-b254-6041410702f5'