[QA] Test_page env variable and url visited

Željko Filipin zfilipin at wikimedia.org
Thu Oct 10 09:18:28 UTC 2013


Hi Tomislav,

comments are inline.

On Tue, Oct 8, 2013 at 1:05 AM, Tomislav Plavcic <tplavcic at gmail.com> wrote:

> #1
> TEST_PAGE environment variable - running tests with RandomPage is good
> but when I debug a single test which I edit locally I want to first
> run the test on a fixed page (which data I can prepare if necessary).
> I know I can make a change in the code for RandomPage to point always
> to the same page, but maybe the env. variable would be better. The
> effected tests would be only ones using RandomPage and not others that
> already have some fixed page associated.
>

Sounds interesting. We already use KEEP_BROWSER_OPEN environment variable
to help with debugging on a local machine. Make the change and push it to
Gerrit and we can discuss the details there.


> #2
> When a test fails maybe it would be good that it prints a url visited
> so I can check a tested page manually - this is also because of
> RandomPage. I know tests are recorded on sauce labs, but I'm talking
> for local debugging and I have tried to use verbose parametar for
> cucumber but it doesn't print this info.
> Maybe there's some other parameter but i don't know it...


We use PageFactory#visit_page[1] to explicitly go to pages. I do not see in
the documentation or in the source an easy way to output page URL when
visiting a page. (We could always patch the method, or ask for the
functionality to be implemented, of course.)

If you are interested only in the last URL, we could add an explicit "p
@browser.url" just before "@browser.close"[2].

Maybe we could replace a few environment variables (KEEP_BROWSER_OPEN,
TEST_PAGE...) with one (DEBUG) that would turn on debug mode and keep the
browser opened, output all URLS, always go to the same page...

Željko
--
1:
http://rubydoc.info/github/cheezy/page-object/master/PageObject/PageFactory#visit_page-instance_method
2:
https://github.com/zeljkofilipin/mediawiki-selenium/blob/master/lib/mediawiki/selenium/hooks.rb#L39
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/qa/attachments/20131010/63525b56/attachment.html>


More information about the QA mailing list