def test_create_project(self): """ test to make sure that creating a project works correctly """ # Create project with default args util.create_project(self.driver) #assert that the title and description above the same #as the webpage redirect_title = self.driver.find_element_by_xpath( '//h1[@id="node-title-editable"]').text redirect_description_all = self.driver.find_element_by_xpath( '//p[@id="contributors"]').text #theres a lot of text in this p element, so have to find #where the description starts index = redirect_description_all.find(config.project_description) self.assertEqual(redirect_description_all[index:], config.project_description) self.assertEqual(redirect_title, config.project_title) #navigate to dashboard util.goto_dashboard(self.driver) #find created project in dashboard title = self.driver.find_element_by_link_text(config.project_title) self.assertTrue(title) # Delete project util.delete_project(self.driver)
def test_create_project(self): """ test to make sure that creating a project works correctly """ # Create project with default args util.create_project(self.driver) #assert that the title and description above the same #as the webpage redirect_title = self.driver.find_element_by_xpath( '//h1[@id="node-title-editable"]' ).text redirect_description_all = self.driver.find_element_by_xpath( '//p[@id="contributors"]' ).text #theres a lot of text in this p element, so have to find #where the description starts index = redirect_description_all.find(config.project_description) self.assertEqual( redirect_description_all[index:], config.project_description ) self.assertEqual(redirect_title, config.project_title) #navigate to dashboard util.goto_dashboard(self.driver) #find created project in dashboard title=self.driver.find_element_by_link_text(config.project_title) self.assertTrue(title) # Delete project util.delete_project(self.driver)
def test_create_project_no_title(self): #self.project_title = '' #self.project_description = "This is a great project" util.create_project(self.driver, '') # self.driver, self.project_title, self.project_description) alert_msg = self.driver.find_element_by_xpath( '//div[@class="alert alert-block alert-warning fade in"]//p').text self.assertEqual(alert_msg, "Title is required")
def test_create_project_no_title(self): #self.project_title = '' #self.project_description = "This is a great project" util.create_project(self.driver, '') # self.driver, self.project_title, self.project_description) alert_msg = self.driver.find_element_by_xpath( '//div[@class="alert alert-block alert-warning fade in"]//p' ).text self.assertEqual(alert_msg, "Title is required")
def test_delete_project(self): """ Test creating and then deleting a project. """ # Create a new project util.create_project(self.driver) # Delete the project util.delete_project(self.driver) # Get alert boxes alerts = util.get_alert_boxes(self.driver, 'component(s) deleted') # Must be exactly one matching alert self.assertEqual(len(alerts), 1)
def test_create_project_no_description(self): # util.create_project(self.driver, project_description='') #assert that the title and description above the same #as the webpage redirect_title = self.driver.find_element_by_xpath( '//h1[@id="node-title-editable"]').text #theres a lot of text in this p element, so have to find #where the description starts self.assertEqual(redirect_title, config.project_title) util.delete_project(self.driver)
def setUp(self): # Create test project self.project_url = util.create_project(self.driver) # Browse to project page util.goto_project(self.driver)
def test_create_project_no_description(self): # util.create_project( self.driver, project_description='' ) #assert that the title and description above the same #as the webpage redirect_title = self.driver.find_element_by_xpath( '//h1[@id="node-title-editable"]' ).text #theres a lot of text in this p element, so have to find #where the description starts self.assertEqual(redirect_title, config.project_title) util.delete_project(self.driver)
def test_add_contributor_log(self): """ test to make sure that add contributor log works correctly """ # As of 9 Sep 2013, log says "component"; expected "project" # Log out user_url = self.get_user_url() util.logout(self.driver) # Create second user and get his url second_user_data = util.create_user(self.driver) util.login( self.driver, second_user_data['username'], second_user_data['password'] ) project_url = util.create_project(self.driver) #add contributor self.add_contributor(self.user_data) #get log message_log = self.get_log() #assert the time self._assert_time(message_log.log_time) #assert the log self.assertEqual( message_log.log_text, u'{} added {} as contributor on node {}'.format( second_user_data['fullname'], self.user_data['fullname'], config.project_title, ) ) #check the user_url and project_url self.assertEqual( message_log.log_url[0], self.get_user_url() ) self.assertEqual( message_log.log_url[1], user_url ) self.assertEqual( message_log.log_url[2], project_url.strip('/') )
def test_node_add_contributor_log(self): """ test to make sure that project log works correctly on adding contributor to a node """ # Log out user_url=self.get_user_url() util.logout(self.driver) # Create second user and get his url second_user_data = util.create_user(self.driver) util.login( self.driver, second_user_data['username'], second_user_data['password'] ) util.create_project(self.driver) util.create_node(self.driver) self.driver.find_element_by_css_selector("li span a").click() new_node_url=self.driver.current_url #add contributor self.add_contributor(self.user_data) #get log util.goto_project(self.driver) message_log = self.get_log() #assert the time self._assert_time(message_log.log_time) #assert the log self.assertEqual(message_log.log_text, second_user_data["fullname"] + " added " + self.user_data['fullname'] + " as contributor on node " + config.node_title) #check the second user_url, first user_url and node_url self.assertEqual(message_log.log_url[0], self.get_user_url()) self.assertEqual(message_log.log_url[1], user_url) self.assertEqual(message_log.log_url[2]+"/", new_node_url)
def test_node_add_contributor_log(self): """ test to make sure that project log works correctly on adding contributor to a node """ # Log out user_url = self.get_user_url() util.logout(self.driver) # Create second user and get his url second_user_data = util.create_user(self.driver) util.login(self.driver, second_user_data['username'], second_user_data['password']) util.create_project(self.driver) util.create_node(self.driver) self.driver.find_element_by_css_selector("li span a").click() new_node_url = self.driver.current_url #add contributor self.add_contributor(self.user_data) #get log util.goto_project(self.driver) message_log = self.get_log() #assert the time self._assert_time(message_log.log_time) #assert the log self.assertEqual( message_log.log_text, second_user_data["fullname"] + " added " + self.user_data['fullname'] + " as contributor on node " + config.node_title) #check the second user_url, first user_url and node_url self.assertEqual(message_log.log_url[0], self.get_user_url()) self.assertEqual(message_log.log_url[1], user_url) self.assertEqual(message_log.log_url[2] + "/", new_node_url)
def setUp(self): # Start WebDriver self.driver = util.launch_driver() # Create test user self.user_data = util.create_user(self.driver) # Login to test account util.login( self.driver, self.user_data['username'], self.user_data['password'] ) # Create project and store URL self.url = util.create_project(self.driver)
def test_delete_contributor_log(self): # As of 9 Sep 2013, the log says "component"; expected "project" # Log out user_url = self.get_user_url() util.logout(self.driver) # Create second user and get his url second_user_data = util.create_user(self.driver) util.login( self.driver, second_user_data['username'], second_user_data['password'] ) project_url = util.create_project(self.driver) #add contributor self.add_contributor(self.user_data) time.sleep(3) #remove contributor self.remove_contributor(self.user_data) time.sleep(3) #get log message_log = self.get_log() #assert the time self._assert_time(message_log.log_time) #assert the log self.assertEqual( message_log.log_text, u'{} removed {} as a contributor from project {}'.format( second_user_data["fullname"], self.user_data['fullname'], config.project_title ) ) #check the second user_url, first user_url and project_url self.assertEqual(message_log.log_url[0], self.get_user_url()) self.assertEqual(message_log.log_url[1], user_url) self.assertEqual(message_log.log_url[2]+"/", project_url)
def setUpClass(cls): # Start WebDriver cls.driver = webdriver.Firefox() # cls.driver.implicitly_wait(5) # Create user account and login cls.user_data = util.create_user(cls.driver) util.login(cls.driver, cls.user_data['username'], cls.user_data['password']) # Create test project and store URL cls.project_url = util.create_project(cls.driver) # Log out util.logout(cls.driver)
def setUpClass(cls): # Start WebDriver cls.driver = webdriver.Firefox() # cls.driver.implicitly_wait(5) # Create user account and login cls.user_data = util.create_user(cls.driver) util.login( cls.driver, cls.user_data['username'], cls.user_data['password'] ) # Create test project and store URL cls.project_url = util.create_project(cls.driver) # Log out util.logout(cls.driver)
def setUp(self): # Call parent setUp super(ProjectSmokeTest, self).setUp() # Create test project self.project_url = util.create_project(self.driver) # Browse to project page util.goto_project(self.driver) # add file paths self.image_files = _generate_full_filepaths({ 'jpg': 'test.jpg', 'png': 'test.png', 'gif': 'test.gif', }) self.text_files = _generate_full_filepaths({ 'txt': 'txtfile.txt', 'html': 'htmlfile.html', }) self.archive_files = _generate_full_filepaths({ 'tar': 'text_files.tar', 'tar.gz': 'text_files.tar.gz', 'zip': 'text_files.zip', }) self.archive_file_contents = ('txtfile.txt', 'htmlfile.html') self.binary_files = _generate_full_filepaths({ 'pdf': 'pdffile.pdf', }) self.versioned_files = _generate_full_filepaths({ 0: 'versioned-0.txt', 1: 'versioned-1.txt', })
def setUp(self): # Call parent setUp super(ProjectSmokeTest, self).setUp() # Create test project self.project_url = util.create_project(self.driver) # Browse to project page util.goto_project(self.driver) # add file paths self.image_files = _generate_full_filepaths({ 'jpg': 'test.jpg', 'png': 'test.png', 'gif': 'test.gif', }) self.text_files = _generate_full_filepaths({ 'txt': 'txtfile.txt', 'html': 'htmlfile.html', }) self.archive_files = _generate_full_filepaths({ 'tar': 'text_files.tar', 'tar.gz': 'text_files.tar.gz', 'zip': 'text_files.zip', }) self.archive_file_contents = ('txtfile.txt','htmlfile.html') self.binary_files = _generate_full_filepaths({ 'pdf': 'pdffile.pdf', }) self.versioned_files = _generate_full_filepaths({ 0: 'versioned-0.txt', 1: 'versioned-1.txt', })
def create_project(self, name=None): return util.create_project(self.client, name)