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_not_fork_a_component(self): """ test to make sure can't fork a component """ #create a component # Click New Node button self.driver.find_element_by_link_text('Add Component').click() # Get form form = self.driver.find_element_by_xpath( '//form[contains(@action, "newnode")]') # Wait for modal to stop moving util.wait_until_stable( self.driver.find_element_by_css_selector('input[name="title"]')) # Fill out form util.fill_form(form, { 'input[name="title"]': config.node_title, '#category': 'Procedure', }) #check the fork option self.driver.find_element_by_css_selector("li span a").click() discrib=self.get_element('a[data-original-title="Number of times this node has been forked (copied)"]')\ .text self.assertEqual(discrib, u' 0') #cleanup util.delete_project(self.driver)
def test_not_fork_a_component(self): """ test to make sure can't fork a component """ # create a component # Click New Node button self.driver.find_element_by_link_text("Add Component").click() # Get form form = self.driver.find_element_by_xpath('//form[contains(@action, "newnode")]') # Wait for modal to stop moving util.wait_until_stable(self.driver.find_element_by_css_selector('input[name="title"]')) # Fill out form util.fill_form(form, {'input[name="title"]': config.node_title, "#category": "Procedure"}) # check the fork option self.driver.find_element_by_css_selector("li span a").click() discrib = self.get_element('a[data-original-title="Number of times this node has been forked (copied)"]').text self.assertEqual(discrib, u" 0") # cleanup util.delete_project(self.driver)
def test_fork_link_to_origin_tests(self): """ test to make sure a fork links to original project """ #fork a project self.get_element( 'a[data-original-title="Number of times this node has been forked (copied)"]' ).click() # Wait for JS; is there a better way to do this? time.sleep(3) #click the link to original project self.driver.find_element_by_css_selector("header#overview.jumbotron.subhead p#contributors")\ .find_element_by_xpath('a[contains(.,"/project/")]').click() #check the url and project title title = self.get_element("h1#node-title-editable").text self.assertEqual(title, config.project_title) self.assertEqual(self.driver.current_url, self.project_url) #cleanup util.delete_project(self.driver) util.delete_project(self.driver, "Fork of test project")
def tearDownClass(cls): # Need to login again to delete project util.login(cls.driver, cls.user_data['username'], cls.user_data['password']) # Delete test project util.delete_project(cls.driver) # Close WebDriver cls.driver.close()
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 tearDownClass(cls): # Need to login again to delete project util.login( cls.driver, cls.user_data['username'], cls.user_data['password'] ) # Delete test project util.delete_project(cls.driver) # Close WebDriver cls.driver.close()
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_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 __init__(self): super().__init__() self.setupUi(self) self._translate: QtCore = QtCore.QCoreApplication.translate self.main_render() # signals self.treeWidget.itemClicked.connect(self.on_item_clicked_menu) self.actionAdd_project.triggered.connect(lambda: add_project(self)) self.actionDelete_this_project.triggered.connect( lambda: delete_project(self)) signal.update_menu.connect(self.update_left_menu) signal.update_coord.connect(self.update_coord)
def test_fork_link_to_origin_tests(self): """ test to make sure a fork links to original project """ # fork a project self.get_element('a[data-original-title="Number of times this node has been forked (copied)"]').click() # Wait for JS; is there a better way to do this? time.sleep(3) # click the link to original project self.driver.find_element_by_css_selector( "header#overview.jumbotron.subhead p#contributors" ).find_element_by_xpath('a[contains(.,"/project/")]').click() # check the url and project title title = self.get_element("h1#node-title-editable").text self.assertEqual(title, config.project_title) self.assertEqual(self.driver.current_url, self.project_url) # cleanup util.delete_project(self.driver) util.delete_project(self.driver, "Fork of test project")
def tearDown(self): # Delete test project util.delete_project(self.driver)