Esempio n. 1
0
    def setup(self):
        # Click on the PhyloTree app launcher and wait for it to load.
        try:
            button = self.window.find_element_by_link_text("PhyloTree")
        except NoSuchElementException:
            print >>sys.stderr, "fatal error: could not find the 'PhyloTree' button!"
            print >>sys.stderr, "(visit %s to diagnose the problem)" % (url)
            self.window.quit()
            sys.exit(1)

        button.click()

        # Wait for the vtkweb process to start (but time out after 10 seconds).
        if not vtkwebtest.wait_with_timeout(delay=0.5, limit=10, criterion=found_viewport(self.window)):
            print >>sys.stderr, "fatal error: timed out while waiting for vtkweb process to start"

        # Grab the body element to use as a positional reference.
        body = self.window.find_element_by_tag_name("body")

        # Double-click on a sub-tree to collapse it.
        dblclick = ActionChains(self.window)
        dblclick.move_to_element_with_offset(body, 475, 333)
        dblclick.double_click()
        dblclick.perform()

        # Give the page some time to update the image.
        time.sleep(1)
Esempio n. 2
0
    def setup(self):
        try:
            button = self.window.find_element_by_link_text("Cone")
        except NoSuchElementException:
            print >>sys.stderr, "fatal error: could not find the 'Cone' button!"
            print >>sys.stderr, "(visit %s to diagnose the problem)" % (url)
            raise vtkwebtest.WebTest.Abort()

        button.click()

        # Wait for the vtkweb process to start (but time out after 10 seconds).
        if not vtkwebtest.wait_with_timeout(delay=0.5, limit=10, criterion=found_viewport(self.window)):
            print >>sys.stderr, "fatal error: timed out while waiting for vtkweb process to start"
            raise vtkwebtest.WebTest.Abort()

        # Grab the viewport element so we know where to put the mouse.
        div = self.window.find_element_by_id("viewport")

        # Click-and-drag on the cone to change its position a bit.
        drag = ActionChains(self.window)
        drag.move_to_element(div)
        drag.click_and_hold()
        drag.move_by_offset(-300, 100)
        drag.release()
        drag.perform()

        # Give the page some time to update the image.
        time.sleep(1)