!1 Website testing using ''scenario'' and !-BrowserTest-!


On this page we test retrieving record details using [[!-AllMusic-!][https://www.allmusic.com]].
It uses a [[Slim scenario][.FitNesse.UserGuide.WritingAcceptanceTests.SliM.ScenarioTable]] to define a parameterized script.
This is then invoked multiple times from a [[Decision table][.FitNesse.UserGuide.WritingAcceptanceTests.SliM.DecisionTable]], once for each row.


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.

First we go to the Discography page for Van Morrison.

|script                |browser test            |
|seconds before timeout|60                      |
|open                  |https://www.allmusic.com|
|enter                 |Van Morrison|as|Search  |
|press                 |enter                   |
|click                 |Van Morrison            |
|click                 |Discography             |

Then we check some entries.

|scenario |album details _|album, year, label                  |
|scroll to|@{album}                                            |
|$year=   |value of       |Year |in row where|Album|is|@{album}|
|$label=  |value of       |Label|in row where|Album|is|@{album}|


|album details                          |
|album       |year?|label?              |
|Astral Weeks|1968 |Warner Bros.        |
|Moondance   |1970 |Rhino / Warner Bros.|

Writing the scenario like this can become a bit cumbersome when many parameters are needed. They are repeated in: the scenario's first row, the scenario rows where they are used and the table headers where the scenario is invoked.
Repeating the parameters in the first row of the scenario definition can be omitted using a custom extension to Slim. This is shown in TableTemplateTest.