Exemple #1
0
  def assertTestServerPresenceOnPage(
      self, is_present, go_to_landing=True,
      name=TEST_SERVER_AS_DICT['name']):
    """Helper to assert whether a server is present on the landing page.

    Args:
      is_present: True for the server is present and false for not present.
      go_to_landing: True to get the landing page again (effectively a refresh
                     if the page is already on the landing) and False to use
                     whatever page the test is already on.
      name: The name of the server to assert upon, which defaults to the test
            server.
    """
    if go_to_landing:
      self.driver.get(self.args.server_url + flask.url_for('landing'))
    landing_page = LandingPage(self.driver)
    server_list = landing_page.get_element(LandingPage.SERVER_LIST_ITEM)
    server_listbox = server_list.find_element(*LandingPage.GENERIC_LISTBOX)
    test_server_item = landing_page.findItemInListing(server_listbox, name)
    if is_present:
      self.assertIsNotNone(test_server_item)
      self.assertTrue(test_server_item.is_displayed())
    else:
      self.assertIsNone(test_server_item)