def testManuallyAddUserFromSetupPage(self): """Test that manually adding a user shows up on the user listing.""" setup_page = SetupPage(self.driver) self.assertTestUserPresenceOnPage(False) setup_page.add_test_user(BaseTest.TEST_USER_AS_DICT['name'], BaseTest.TEST_USER_AS_DICT['email'], self.args.server_url) self.assertTestUserPresenceOnPage(True)
def testAddServerFromSetupPage(self): """Test that adding a server shows up on the server listing.""" setup_page = SetupPage(self.driver) self.assertTestServerPresenceOnPage(False) setup_page.add_test_server(BaseTest.TEST_SERVER_AS_DICT['ip'], BaseTest.TEST_SERVER_AS_DICT['name'], BaseTest.TEST_SERVER_AS_DICT['ssh_private_key'], BaseTest.TEST_SERVER_AS_DICT['host_public_key'], self.args.server_url) self.assertTestServerPresenceOnPage(True)
def testAddServerFromSetupPage(self): """Test that adding a server shows up on the server listing.""" setup_page = SetupPage(self.driver) self.assertTestServerPresenceOnPage(False) setup_page.add_test_server( BaseTest.TEST_SERVER_AS_DICT['ip'], BaseTest.TEST_SERVER_AS_DICT['name'], BaseTest.TEST_SERVER_AS_DICT['ssh_private_key'], BaseTest.TEST_SERVER_AS_DICT['host_public_key'], self.args.server_url) self.assertTestServerPresenceOnPage(True)
def testRepeatedSearchesFromSetupToSearchPage(self): """Test that search displays results within the new page.""" search_url = self.args.server_url + flask.url_for('search_page') # Add user and server. setup_page = SetupPage(self.driver) setup_page.add_test_user(BaseTest.TEST_USER_AS_DICT['name'], BaseTest.TEST_USER_AS_DICT['email'], self.args.server_url) setup_page.add_test_server(BaseTest.TEST_SERVER_AS_DICT['ip'], BaseTest.TEST_SERVER_AS_DICT['name'], BaseTest.TEST_SERVER_AS_DICT['ssh_private_key'], BaseTest.TEST_SERVER_AS_DICT['host_public_key'], self.args.server_url) # Verify they both show up. self.assertTestUserPresenceOnPage(True) self.assertTestServerPresenceOnPage(True) # Go to setup so we will get redirected to search page. self.driver.get(self.args.server_url + flask.url_for('setup')) # Search for a server. setup_page.searchForTestItem(BaseTest.TEST_SERVER_AS_DICT['name']) # Verify the server was found and the user was not. self.assertTestUserPresenceOnPage(False, False) self.assertTestServerPresenceOnPage(True, False) # Verify we are on the search page now. self.assertTrue(self.driver.current_url.startswith(search_url)) # Search for a user. setup_page.searchForTestItem(BaseTest.TEST_USER_AS_DICT['name']) # Verify the user was found and the server was not. self.assertTestUserPresenceOnPage(True, False) self.assertTestServerPresenceOnPage(False, False) # Verify we are still on the search page. self.assertTrue(self.driver.current_url.startswith(search_url))
def testSetupPageLayout(self): """Test the setup page layout contains the elements we expect. This should include elements inherited from the base page, BASE_PAGE_ELEMENTS (defined in layout.py), as well as elements specific to the setup page, SETUP_PAGE_ELEMENTS. Please add to each list as the UI is modified to ensure this test stays up to date. """ self.driver.get(self.args.server_url + flask.url_for('setup')) setup_page = SetupPage(self.driver) for element_by_id in SetupPage.BASE_PAGE_ELEMENTS: base_page_element = setup_page.get_element(element_by_id) self.assertIsNotNone(base_page_element) self.assertTrue(base_page_element.is_displayed()) self.assertLogoLinksToLandingPage() for element_by_id in SetupPage.SETUP_PAGE_ELEMENTS: setup_page_element = setup_page.get_element(element_by_id) self.assertIsNotNone(setup_page_element) self.assertTrue(setup_page_element.is_displayed())
def testSearchUserFromSetupPage(self): """Test that search displays user results on a new page.""" setup_page = SetupPage(self.driver) setup_page.add_test_user(BaseTest.TEST_USER_AS_DICT['name'], BaseTest.TEST_USER_AS_DICT['email'], self.args.server_url) self.assertTestUserPresenceOnPage(True) self.driver.get(self.args.server_url + flask.url_for('setup')) setup_page.searchForTestItem(BaseTest.TEST_USER_AS_DICT['name']) self.assertTestUserPresenceOnPage(True, False) search_url = self.args.server_url + flask.url_for('search_page') self.assertTrue(self.driver.current_url.startswith(search_url))