HsacAcceptanceTests.SlimTests.BrowserTest.GridTests.GridInTableTest


This test ensures we can find elements inside tables representing a grid where each column indicates a property and each row contains the values for the properties of one item. When such a table is nested in another table.


variable defined: HTML= {{{ <!DOCTYPE html> <html lang="en"> <body> <table> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>1</td> <td> <table> <thead> <tr><th>Lastname</th><th>Firstname</th><th>Gender</th><th>Birth date</th><th></th></tr> </thead> <tbody> <tr><td>Smith</td><td>Joe</td><td>Male</td><td>10-01-1975</td><td><button>Edit</button><button>Delete</button></td></tr> <tr><td>Johnson</td><td>Pamela</td><td>Female</td><td>01-12-1978</td><td><button>Edit</button><button>Delete</button></td></tr> <tr><td><a>Rogers<img />-Smith</a></td><td>Jack</td><td>Male</td><td>10-01-1980</td><td><button>Edit</button><button>Delete</button></td></tr> </tbody> </table> </td> <td>3</td> <td>4</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> <td> <table> <thead> <tr><th>Kind</th><th>Name</th><th>Color</th><th><a><img /><strong>Owner</strong></a></th><th>Birth&nbsp;date</th><th>Buttons</th></tr> </thead> <tbody> <tr><td>Dog</td><td>Joey</td><td>Black</td><td>Unknown</td><td>11-01-1975</td><td><button>Edit</button><button>Delete</button></td></tr> <tr><td>Cat&nbsp;&nbsp; Food</td><td>Pamelasi</td><td>White</td><td>Jack</td><td>02-12-1978</td><td><button title="Edit Pam's data">Edit</button><button>Delete</button></td></tr> <tr><td>Cat</td><td>Pam</td><td>White</td><td>Jack</td><td>02-12-1978</td><td><button title="Edit Pam's data">Edit</button><button>Delete</button></td></tr> <tr><td>Chicken</td><td>Tweety</td><td>Brown</td><td>Jill</td><td>12-01-1980</td><td><input value="Delete This"><button>Edit</button></td></tr> <tr><td><input name="newKind"/></td><td><textarea name="newName" rows="4" cols="50"></textarea></td><td><input name="newColor" type="checkbox" checked="true"/></td><td>Owner name</td><td><select name="newBirthDate"><option value="volvo">Volvo</option><option value="mercedes" selected>Mercedes</option><option value="audi">Audi</option></select></td><td><button>Add</button></td></tr> </tbody> </table> </td> </tr> </table> </body> </html>}}}


script mock xml server setup
add response
<!DOCTYPE html>
<html lang="en">
<body>
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>
<table>
    <thead>
    <tr><th>Lastname</th><th>Firstname</th><th>Gender</th><th>Birth date</th><th></th></tr>
    </thead>
    <tbody>
    <tr><td>Smith</td><td>Joe</td><td>Male</td><td>10-01-1975</td><td><button>Edit</button><button>Delete</button></td></tr>
    <tr><td>Johnson</td><td>Pamela</td><td>Female</td><td>01-12-1978</td><td><button>Edit</button><button>Delete</button></td></tr>
    <tr><td><a>Rogers<img />-Smith</a></td><td>Jack</td><td>Male</td><td>10-01-1980</td><td><button>Edit</button><button>Delete</button></td></tr>
    </tbody>
</table>
</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>
<table>
    <thead>
    <tr><th>Kind</th><th>Name</th><th>Color</th><th><a><img /><strong>Owner</strong></a></th><th>Birth&nbsp;date</th><th>Buttons</th></tr>
    </thead>
    <tbody>
    <tr><td>Dog</td><td>Joey</td><td>Black</td><td>Unknown</td><td>11-01-1975</td><td><button>Edit</button><button>Delete</button></td></tr>
    <tr><td>Cat&nbsp;&nbsp; Food</td><td>Pamelasi</td><td>White</td><td>Jack</td><td>02-12-1978</td><td><button title="Edit Pam's data">Edit</button><button>Delete</button></td></tr>
    <tr><td>Cat</td><td>Pam</td><td>White</td><td>Jack</td><td>02-12-1978</td><td><button title="Edit Pam's data">Edit</button><button>Delete</button></td></tr>
    <tr><td>Chicken</td><td>Tweety</td><td>Brown</td><td>Jill</td><td>12-01-1980</td><td><input value="Delete This"><button>Edit</button></td></tr>
    <tr><td><input name="newKind"/></td><td><textarea name="newName" rows="4" cols="50"></textarea></td><td><input name="newColor" type="checkbox" checked="true"/></td><td>Owner name</td><td><select name="newBirthDate"><option value="volvo">Volvo</option><option value="mercedes" selected>Mercedes</option><option value="audi">Audi</option></select></td><td><button>Add</button></td></tr>
    </tbody>
</table>
</td>
</tr>
</table>
</body>
</html>
$url<-[http://127.0.0.1:8000/FitNesseMock] get mock server url

script browser test
seconds before timeout 1
open $url->[http://127.0.0.1:8000/FitNesseMock]
check value of column number 1 in row number 2 1
check value of Gender in row number 2 Female
check value of Kind in row number 3 Cat
row exists where Birth date is 02-12-1978
reject row exists where Birth date is 03-12-1978
check value of Kind in row where Name is Joey Dog
check value of Name in row where Kind is Cat Food Pamelasi
check value of Birth date in row where Name is Joey 11-01-1975
check value of Name in row where Birth date is 11-01-1975 Joey
check value of Firstname in row where Lastname is Rogers Jack
check value of Birth date in row where Lastname is Rogers 10-01-1980
click Edit in row number 2
click This in row where Owner is Jill
click Edit Pam's data in row where Name is Pam
enter Sheep as Kind in row where Owner is Owner name
enter John2 as Name in row where Owner is Owner name
check value of Kind in row where Owner is Owner name Sheep
check value of Name in row where Owner is Owner name John2
check value of Color in row where Owner is Owner name true
check value of Birth date in row where Owner is Owner name Mercedes
enter Volvo as Birth date in row where Owner is Owner name
check value of Birth date in row where Owner is Owner name Volvo


script mock xml server setup
stop