-
Notifications
You must be signed in to change notification settings - Fork 99
3. BrowserTest Examples
Fried Hoeben edited this page Nov 5, 2020
·
5 revisions
This page shows two some wiki page content and the output it produces.
A sample Slim script using BrowserTest to look at places for sale.
|script |browser test |
|open |http://www.funda.nl |
|enter |Maliebaan, Utrecht|as |Locatie |
|select |€ 1.000.000 |for |Prijsklasse |
|select |€ 1.500.000 |for |tot |
|click |Zoeken |
|click |Maliebaan 50 A |
|check |page title |Huis te koop: Maliebaan 50 A 3581 CS Utrecht [funda]|
|click |Kenmerken |
|check |value of |Oorspronkelijke vraagprijs |€ 1.395.000 k.k. |
|check |value of |woonoppervlakte |300 m² |
|click |Foto's |
|note |Check whether the page title matches the supplied regular expression |
|check |page title |=~/.*Foto's.*/ |
|show |take screenshot |Foto_1 |
|click |Volgende foto |
|note |Wait for the loading of the next photo to complete |
|wait seconds|1 |
|show |take screenshot |Foto_2 |
|click |Volgende foto |
|wait seconds|1 |
|show |take screenshot |Foto_3 |
|click |Vergroten |
|wait seconds|1 |
|show |take screenshot |Foto_3_groot |
Partial screenshot of what we see in browser after running the test containing the script.
Up-to-date output of a similar test can be seen in the example test report.
Sample showing the usage of ‘table template’ (a custom subclass of Slim’s scenario) to run a script multiple times with different parameters.
|table template|check original price | |open |http://www.funda.nl | |enter |@{address}, @{city}|as |Locatie | |click |Zoeken | |click |@{address} | |click |Kenmerken | |check |value of |Vraagprijs |@{price} | |check |value of |Oorspronkelijke vraagprijs|@{originalPrice} | |check |value of |Inhoud |@{volume} | |check |value of |woonoppervlakte |@{squareMeters} m²| |check |value of |Bouwjaar |@{yearBuilt} |
|script|browser test|
|check original price | |address |city |price |original price |square meters|year built|volume | |Maliebaan 50 A |Utrecht|€ 1.295.000 k.k.|€ 1.395.000 k.k.|300 |1930 |900 m³ | |Wilhelminapark 7|Utrecht|€ 1.500.000 k.k.|null |335 |1907 |1.200 m³|
Partial screenshot of what we see in the browser after running the test containing this code.
Once again the example test report contains an up-to-date version.