fhoeben/hsac-fitnesse-fixtures

"close tab" does not close window

Closed this issue · 4 comments

Documentation for "close tab" (http://localhost:9090/HsacExamples.SlimTests.BrowserTests) states:

Closes the current tab and switches the browser's window back to the previous one, if the browser has multiple tabs

When there is only a single tab, the tab is not closed, and the window remains open.

According to the documentation, shouldn't the single tab be closed along with its window?

For a simple test program:

`|script |
|open |http://localhost:9090/|
|wait seconds|5 |
|show |take screenshot |mama |

|script |
|close tab|

|script |
|pause|eind van script|
`

No if there is only a single tab nothing is done (as closing the last window would prohibit further testing). When the 'if' is false the previous sentence does not apply.
Or am I overlooking something and should closing the last tab be possible?

If you find this confusing please submit a PR making the behaviour for a single tab explicit

I need to test a web application that shows a different user interface to different users, dependent on the username/password used when logging in.
I've been provided, by a colleague, with a list of username/password data, and want to test if those username/password are valid; i.e. for each username/password:

on the login page of the web application, enter the username/password, wait a couple of seconds, take a screenshot, and then logout.

Then afterwards, I can inspect the run log, and see what username/password were succesful.
The way to logout may vary depending on the username/password used when logging in. Rather than figure out how to logout, I want simply to close the window, thereby ending the session.

Sorry. Closing the last tab is not supported by BrowserTest. Starting a new browser session is quite slow, so this is not recommended. (And will likely not work, since logging in is often done via cookies)

Why do you need screenshots to see whether login is successful can't you check fully automated (either whether an error is shown, of whether a logged-in page is shown)? It is counter-intuitive to me to make an automated test that doesn't just gives green/red but requires manual verification of a set of screenshots.

What I would recommend in your situation (if finding out how to log out is hard/impossible) after each login attempt:

  • clear cookies
  • clear local storage
  • open the login url again

This should be equivalent to closing the tab and reopening a new as clearing cookies and local storage should remove all state.

Thanks Fried,

|scenario |afmelden |
|delete all cookies |
|clear local storage|

appears to do exactly what I need (for the domain of the current open page in the browser) .