Key takeaway
- Galen Framework tests responsive layouts with Selenium and Galen Specs. See how it works, a first check, best practices and how to check its status first.
Galen Framework is an open-source layout and functional testing framework for websites that checks the look and feel of responsive pages by testing where page objects sit relative to each other at different screen sizes. It is written in Java, uses Selenium, and describes layouts in its own readable specification language called Galen Specs.
This guide is for QA engineers and front-end teams who want to automate responsive layout checks. It explains how Galen works, how specs are written, how to run a first check, and what to weigh before adopting it today.
What is Galen Framework?
The Galen Framework site describes it as "Automated testing of look and feel for your responsive websites". Its approach is to "test location of objects relatively to each other on page". A test opens a page, resizes the browser to a stated size, and checks each rule in a spec file. It is released under the Apache License 2.
Galen runs on Selenium Grid, including cloud services, so the same specs can be run across browsers and in parallel. You can write tests in three ways: the Galen test suite syntax for running checks across devices and browsers, JavaScript for custom logic, and a Java API for JUnit or TestNG style tests.
Why does layout and responsive testing matter?
A responsive site changes shape between a phone and a desktop. A menu collapses behind a symbol on a small screen and lists every link on a large one. Layouts can break when a user turns a phone from portrait to landscape, or when a browser renders a drop-down or an upload control differently. Functional tests rarely catch these faults, because the page still works but looks wrong.
Automation does the repetitive detection, and people make the final judgement on the flagged screenshots. That matches the wider practice of system testing, where automated checks reduce manual flipping through screens.
How does Galen Framework work?
For each test, Galen opens a page in a browser, resizes the window to a given size, and validates the layout against the spec. If the page is not directly reachable, you can first perform actions such as typing or clicking, because Selenium is underneath. You can also inject client-side JavaScript.
A first check can be run from the command line with a spec file:
galen check loginPage.gspec --url http://examples.com --size 1024x768 --include desktop --htmlreport reports
This opens the URL, sets the window to 1024 by 768 pixels, runs the validations in the spec and writes an HTML report. The command-line tool can be installed with npm install -g galenframework-cli, or from the archive on the download page.
How do Galen Specs describe a layout?
A spec file starts by naming page objects and how to find them, then states rules for each object.
| Part of a spec | What it does | Example idea |
|---|---|---|
Object definition (@objects) | Gives names to elements and a locator: id, CSS or XPath | Name the header and find it with a CSS selector |
| Object specs | Rules for each object, such as width, height, inside, near, above, below, aligned, text, colour scheme and image | Search button sits inside the menu |
| Sections | Group rules with = markers to keep the file readable | A header section and a footer section |
Tags (@on) | Apply rules only to some devices | Different button width on mobile and desktop |
| Ranges | Express limits for a value | Width 375 to 400 px, or approximately 100 px |
| Absent | Checks an element is missing or hidden | The menu icon is hidden on desktop |
A short example shows the idea:
= Header section =
header:
height 50px
width 375px
search-button:
inside menu 20 to 50px left, 0 to 10px top
@on mobile
search-button:
width 100px
@on desktop
search-button:
width 150px
Galen also supports conditional statements and loops, parameterised tests that run against different browsers or devices from a data table, and a way to disable a test with an annotation. The Galen spec language guide is the full reference.
What reports does Galen produce?
The site lists HTML reports that highlight misaligned elements, image comparison, and colour scheme checks. Reports can be used in a CI tool such as Jenkins; see setting up continuous delivery with Jenkins and building an automated testing pipeline with GitLab CI. Teams that practise test driven development can treat the spec as a requirements document for the front end, which is how the Galen site describes it.
What are the best practices for responsive layout testing?
- Use your own analytics to list the devices and browsers that matter most, and test those first.
- Check both portrait and landscape on phones and tablets, and shrink and expand the window on desktop.
- Test the visibility and usability of elements at small sizes, including menus, hover states, padding and text that touches a border.
- Show a loading indicator for asynchronous requests so users do not think the page has stopped.
- Use real devices or a cloud device service when emulation is not enough, and Chrome's device mode for quick debugging.
- Plan for run time: tests across many browsers are slow, so size your Selenium Grid to finish in a reasonable time.
Should you adopt Galen Framework today?
Check its status first. The project site shows version 2.4.4 and a copyright range of 2013 to 2017, and the GitHub page lists no releases, so confirm recent activity and browser driver compatibility before you build on it. The ideas, relative layout rules and per-device tags, remain useful whatever tool you choose. For wider test coverage, see our end-to-end testing solutions or talk to our technology specialists.
How do AI agents change responsive design testing?
An agent can read a design change, update the matching spec rules, run the checks at each breakpoint, and attach the flagged screenshots to a review request. A person still decides whether a flagged difference is a defect. The agent removes the repetitive set-up and triage, while the layout rules stay explicit and reviewable. ElixirClaw, the AI agents computing platform, is the place to build and run such agent workflows.
What should you do first?
- Pick one important page and the three screen sizes your analytics show matter most.
- Write a short spec for the header and main navigation using tags per device.
- Run the check from the command line and read the HTML report.
- Add the check to your pipeline and decide who reviews failures.
- Review the project's maintenance status and decide whether to keep Galen or move the rules elsewhere.
To map one decision your agents make, and the data and policy it depends on, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
What is Galen Framework used for?
It is used to test the layout and responsive design of websites by checking the position and size of page objects relative to each other at different screen sizes.
Does Galen Framework use Selenium?
Yes. Galen runs on Selenium and Selenium Grid, so tests can run across browsers, in parallel and on cloud services.
What language are Galen specs written in?
Galen Specs is its own readable specification language. Tests can also be written in the test suite syntax, JavaScript or the Java API.
Which locators does Galen support?
Object definitions can find elements by id, CSS selector or XPath expression.
Is Galen Framework still maintained?
The project site shows version 2.4.4 and a copyright range ending in 2017, so check recent activity before adopting it.
Ready to put AI agents to work? See an ElixirClaw demo: the agentic OS to build, orchestrate and govern AI agents across your enterprise systems.
Explore the XenonStack platform family: ElixirData · ElixirClaw · ElixirHub · NexaStack · MetaSecure · Neural AI · AgentGRC · AgentSRE · AgentAnalyst · AgentInstruct · AgentRAI · AgentScrum · AgentSearch · AgentForce · AI Aviator · SAIF Aviator · CohortIQ · XenonStack AI · XenonStack UAE