How to use LoadComponents WebDriver / Selenium 2 in PageObjects template?

It's hard for me to get used to the WebOriver PageObject pattern. Share your experiences and ways to use the PageObjects template and downloadable components.

Since the PageObject is usually a component or part of the functionality, it first occurred to me that I should use it to actually do some things in load () and see if it does what should be in isLoaded () .

Then I realized that it should be used only for "loading" objects (possibly initialization), as it happens in the case of moving around the site, each object with its own URL. And using isLoaded () to check if the object is READY for testing.

But if you have a complex JavaScript test client for verification, then this is an integral part of the JS file for downloading, the JS form is based on 2 independent parts, and there are three types of orders: you are not moving anywhere (relative to the URL), only the state changes elements.

Consider the get () method. You will be taken to a page with an interactive form. It loads when the form exists on the page. Then you have the form1 and form2 objects ... what their load () and isLoaded () methods look like, they are ready for action right away because they don't need to load just by checking their services.

This is a mess, no one knows if the isLoaded () method is used to check whether the object was loaded, or whether the object was loaded and configured correctly. But I assume that the previous path is correct and that during the tests the justification of its configuration should be guaranteed.

Scenario:

Testing first part of html form - test that field client side validation works
Testing the second one that depends on the first one
Testing the following file uploader - upload, canceling, clearing, order, fileIDs
Testing the overall html form submission - ServerSide validation errors, results

:

  • LoadableComponent
  • PageObjects

    • ,

      , , , ,

    • , , , UnitTests, PageObjects, , css PageObjects +, PageObjects /

    • PageObjects

      , . 4- . Form1, Form2 (Form1), Upload (Form2), Submit (Upload), . get() . , , , PageObject,

    • , , ,

+5
2

. load() , , , . isLoaded() - , .

- , , . . , .

0

. LoadableComponent WebDriver , . . Loadable Component, :

()

void isLoaded() throws java.lang.Error

, load() isLoaded(), , . , .

https://code.google.com/p/selenium/wiki/LoadableComponent

0

All Articles