Child pages
  • Setting Up Selenium for Web Client UI Testing

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This chapter provides information on how to set up Selenium for visual testing the Servoy solutions in Web Client.

Stoc

Setup Selenium

  • Install the Selenium IDE plugin for Firefox from http://seleniumhq.org/download/
  • Create a folder 'folder wicketPathLocatorBuilder' in your the local drive with the file 'file user-extension.js.wicketPathLocatorBuilder' inside. Paste the following snippet into this file.

    Code Block
    LocatorBuilders.add('wicketpath', function(e) {
      var path = '';
      var current = e;
      while (current != null) {
        if (current.parentNode != null) {
          path = this.relativeXPathFromParent(current) + path;
          if (1 == current.parentNode.nodeType && // ELEMENT_NODE
              current.parentNode.getAttribute("wicketpath")) {
            return this.preciseXPath("//" + this.xpathHtmlElement(current.parentNode.nodeName.toLowerCase()) +
                "[@wicketpath=" + this.attributeValue(current.parentNode.getAttribute('wicketpath')) + "]" +
                path, e);
          }
        } else {
          return null;
        }
        current = current.parentNode;
      }
      return null;
        });
  • Open the Selenium IDE, go to menu Options > Options. In the Selenium Core extensions input field, paste the path to the earlier created folder 'wicketPathLocatorBuilder'.
  • Go to Options > Locator Builders and move the wicketpath entry to the top of the list
  • Restart FireFox.

...

  • setup web client property servoy.webclient.debug.wicketpath to true.
  • Save and restart application serverthe Application Server.

Selenium Description

Main Window Description

  • The left part of the main window contains the tree structure that represents the test-suite. The right side displays the details of a selected node. At the bottom of the main window you'll see is the terminal output area, which displays stan-dard standard messages and communications in between your the test-suite and the client applica-tion you are testingapplication being tested.
  • The basic structure of a test-suite and thus the child nodes of theTestthe Test-suite root node is fixed. An arbitrary number of Test-set, Test-case or Test nodes are followed by the Procedures, Extras and Windows and components nodes. The Procedures node holds Packages and Procedures.

Starting the Application

  • If Selenium is configured, Servoy web client also, then you can run the solution on web client and Servoy Web Client are configured, then the solution can be run on Web Client with Firefox browser.
  • When the application is running on browser, then the Selenium can be started using CTRL+ALT+S or going to Firefox > Web Developer > Selenium IDE.

Recording Events

  • Click record button
  • Go to WC, do the actions needed, typing data / adding records / delete
  • When done go to selenium and hit Stop recording button
  • A sequence is created which can be saved using CTRL+S

Recording Gotcha's

  • When using sendKeys, also add a fireEvent with value 'value blur' on the target for the sendKeys, otherwise the the sendKeys is not applied
  • When recording, Selenium inserts inserts selectWindow commands. Most of these can be removed. They are only needed when the test needs to switch to another tab or to a different dialog (or back to the main form from a dialog)
  • By default Selenium does not handle Ajax events very well when recording. It inserts simple 'simple click' events, but those clicks usually result in an Ajax call to the server

...