!1 Page Layout Testing using !-LayoutTest-!

On this page we check whether a page, opened using !-BrowserTest-!, meets the look and feel criteria described in a 'spec file'.
This is done by using !-LayoutTest-! (so not by !-BrowserTest-! itself) which enables the use of the [[Galen Framework][http://galenframework.com]].
A 'spec file' is a file containing a specification, written in [[Galen Spec Language][http://galenframework.com/docs/reference-galen-spec-language-guide/]], which allows the location of objects relatively to each other on a page to be checked.
This file is loaded from the wiki's [[files section][.FitNesse.FullReferenceGuide.UserGuide.FitNesseWiki.FilesSection]].

Since two different fixtures are used this test page uses two separate script tables: one to open the right page, and another to perform the layout check.
Depending on the focus of the test script one could consider whether it makes sense to use either !-BrowserTest-! (when the focus is no layout checking) or !-LayoutTest-! (when the focus of the script is browser actions) as a [[library][.FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.SliM.LibraryTable]]. This removes the need to explicitly switch between the two fixtures.
One can then just have a single script (using methods from both fixtures) manipuating the browser and checking the resulting pages' layout.

!note The configuration of Selenium (i.e. which browser to use) and starting the browser session is done in the SuiteSetup. Which allows this configuration to be shared between tests. Closing the browser is done in SuiteTearDown, which happens after all tests are completed.

We start by opening the page to be checked.

|script|browser test                     |
|open  |http://testapp.galenframework.com|

Then we trigger layout verification, and check its results. Note that the full (HTML) report generated by Galen will be made available as part of the test result.
That full report will contain all details on any issues found. In the wiki test we just check: that the spec file used contained specs to be used, and how many specs caused errors/warnings.
(This test is a bit strange in that it expects errors, which you normally would not.)

|script               |layout test                                                       |
|set included tags    |usual,hovered                                                     |
|show                 |verify layout using|http://files/galenExamples/menuHighlight.gspec|
|check                |verified spec count|>0                                            |
|check                |passed spec count  |0                                             |
|check                |spec error count   |2                                             |
|check                |spec warning count |0                                             |
|show                 |layout check messages                                             |
|set included tags    |usual                                                             |
|set layout check name|Menu with usual highlight                                         |
|show                 |verify layout using|http://files/galenExamples/menuHighlight.gspec|
|check                |spec error count   |1                                             |
|check                |spec warning count |0                                             |

