def test_genes_tab_headers(self): ''' @status this test verifies all the table headers on the genes tab are correct and in the correct order. ''' my_select = self.driver.find_element_by_xpath("//select[starts-with(@id, 'field_0_')]")#identifies the select field and picks the gene symbols option for option in my_select.find_elements_by_tag_name("option"): if option.text == 'Gene Symbol(s) or ID(s)': option.click() break self.driver.find_element_by_name("formly_3_input_input_0").send_keys("Gata1")#indentifies the input field and enters gata1 wait.forAngular(self.driver) self.driver.find_element_by_id("searchButton").click() #identify the Genes tab and verify the tab's text gene_tab = self.driver.find_element_by_css_selector("ul.nav.nav-tabs > li.uib-tab.nav-item.ng-scope.ng-isolate-scope:nth-child(2) > a.nav-link.ng-binding") print gene_tab.text self.assertEqual(gene_tab.text, "Genes (6)", "Genes tab is not visible!") gene_tab.click() gene_table_headers = self.driver.find_element_by_id("geneTable").find_element_by_css_selector("tr") items = gene_table_headers.find_elements_by_tag_name("th") searchTermItems = iterate.getTextAsList(items) self.assertEqual(searchTermItems[0], "Organism") self.assertEqual(searchTermItems[1], "Gene Symbol") self.assertEqual(searchTermItems[2], "Genetic Location") self.assertEqual(searchTermItems[3], "Genome Coordinates") self.assertEqual(searchTermItems[4], "Associated Human Diseases (Source)") self.assertEqual(searchTermItems[5], "Abnormal Mouse Phenotypes\nReported in these Systems") self.assertEqual(searchTermItems[6], "References in MGI") self.assertEqual(searchTermItems[7], "Mice With Mutations\nIn this Gene (IMSR)")
def press_tab(self): """ press enter key on previous_element """ current_element = self._get_current_element() current_element.send_keys(Keys.TAB) wait.forAngular(self.driver)
def testAnnotationResults(self): """ tests that when you click a term from the tree the annotation results changes to just that node results @status: test works @todo: add comments """ self.performSearch(term="brain") # select specific stage activetree = self.driver.find_element_by_css_selector(".mgitreeview .active") self.assertEqual(activetree.text,"brain") # verify count of results for the EMAPA term term1CountTag = self.driver.find_element_by_css_selector(".resultsLink a") term1Count = int(term1CountTag.text) # assert positive count self.assertGreater(term1Count,0) # navigate to a term from the tree self.driver.find_element_by_css_selector(".mgitreeview").find_element_by_link_text("brain blood vessel").click() wait.forAngular(self.driver) # verify count of results for the stage specific term2 term term2CountTag = self.driver.find_element_by_css_selector(".resultsLink a") term2Count = int(term2CountTag.text) # assert positive count self.assertGreater(term2Count,0) # verify the count is different from the first term self.assertNotEqual(term1Count, term2Count)
def test_genes_tab_doids(self): ''' @status this test verifies the correct DO IDs are returned for this query. @bug: under construction ''' my_select = self.driver.find_element_by_xpath("//select[starts-with(@id, 'field_0_')]")#identifies the select field and picks the gene symbols option for option in my_select.find_elements_by_tag_name("option"): if option.text == 'Gene Symbol(s) or ID(s)': option.click() break self.driver.find_element_by_name("formly_3_input_input_0").send_keys("Gata1")#identifies the input field and enters gata1 wait.forAngular(self.driver) self.driver.find_element_by_id("searchButton").click() wait.forAngular(self.driver) #identify the Genes tab and verify the tab's text gene_tab = self.driver.find_element_by_css_selector("ul.nav.nav-tabs > li.uib-tab.nav-item.ng-scope.ng-isolate-scope:nth-child(3) > a.nav-link.ng-binding") self.assertEqual(gene_tab.text, "Diseases (3)", "Diseases tab is not visible!") gene_tab.click() gene_table = Table(self.driver.find_element_by_id("diseaseTable")) cells = gene_table.get_column_cells("DO ID") print iterate.getTextAsList(cells) #displays each row of gene data doid1 = cells[1] doid2 = cells[2] doid3 = cells[3] #asserts that the correct genes in the correct order are returned self.assertEqual(doid1.text, 'DOID:14250') self.assertEqual(doid2.text, 'DOID:4971') self.assertEqual(doid3.text, 'DOID:1588')
def enter_shortcut(self, keys): """ send keys to previous_element """ current_element = self._get_current_element() current_element.send_keys(keys) wait.forAngular(self.driver)
def testDeleteIndex(self): """ @Status tests that an index record can be deleted """ driver = self.driver form = self.form form.enter_value('jnumid', '225216') # click the Tab key form.press_tab() #finds the citation field citation = form.get_value('citation') print citation self.assertEqual(citation, 'Alvarez-Saavedra M, Nat Commun 2014;5():4181') #finds the marker field form.enter_value('marker_symbol', 'Bmp2') marker_symbol = form.get_value('marker_symbol') form.press_tab() print marker_symbol self.assertEqual(marker_symbol, 'Bmp2') #find the table field to check table_element = driver.find_element_by_id("indexGrid") table = Table(table_element) #puts an X in the Prot-sxn by age 7.5 box cell = table.get_cell("prot-sxn", "7.5") cell.click() wait.forAngular(driver) self.assertEqual(cell.text, 'X', "the cell is not checked") form.click_modify() form.click_delete()#click the delete button
def testAnnotationStageResults(self): """ tests that when you click a term for a specific stage from the tree the annotation results changes to just that node results; jlewis @status: test works """ self.performSearch(term="bowman's capsule%", stage=26) # verify tree is highlighting correct term activetree = self.driver.find_element_by_css_selector(".mgitreeview .active") self.assertEqual(activetree.text,"Bowman's capsule of mature renal corpuscle") # verify there is a count of results for the EMAPS term term1CountTag = self.driver.find_element_by_css_selector(".resultsLink a") term1Count = int(term1CountTag.text) # assert positive count self.assertGreater(term1Count,0) # navigate to a child term from the tree self.driver.find_element_by_css_selector(".mgitreeview").find_element_by_link_text("urinary space of mature renal corpuscle").click() wait.forAngular(self.driver) # verify count of results for the stage specific term2 term term2CountTag = self.driver.find_element_by_css_selector(".resultsLink a") term2Count = int(term2CountTag.text) # assert zero count (as-of data on 8/18/2016) self.assertEqual(term2Count,0) # verify the count is different from the first term self.assertNotEqual(term1Count, term2Count)
def testAnnotationDetailLink(self): """ tests that when you click on the annotations link in the detail section it goes to the correct assay results """ self.performSearch(term="brain blood vessel") # select specific stage activetree = self.driver.find_element_by_css_selector(".mgitreeview .active") self.assertEqual(activetree.text,"brain blood vessel") wait.forAngular(self.driver) # verify annotation count exists annotCountTag = self.driver.find_element_by_css_selector(".resultsLink a") annotCount = int(annotCountTag.text) self.assertTrue(annotCount > 0, "annotation count not greater than zero") # click link to go to results page annotCountTag.click() wait.forNewWindow(self.driver) searchFor = self.driver.find_element_by_css_selector(".youSearchedFor") self.assertEqual(self.driver.title, "Result Summary") self.assertTrue("brain blood vessel" in searchFor.text, "You searched for does not contain structure name") body = self.driver.find_element_by_tag_name("body") self.assertTrue( ("of %d" % annotCount) in body.text, "same annotation count not found on results summary")
def testGreaterThanEqualDateSearch(self): """ @Status tests that searching by greater than or equal to created by date gives the correct results """ form = self.form form.enter_value('_priority_key', 'Medium') form.press_tab() form.enter_value('_conditionalmutants_key', 'Conditional (minor)') form.press_tab() form.enter_value('is_coded', 'Yes') form.press_tab() form.enter_value('creation_date', ">=11/10/2015") form.press_tab() wait.forAngular(self.driver) form.click_search()#click the search button #find the search results table results_table = self.driver.find_element_by_id("resultsTable") table = Table(results_table) #Iterate and print the search results headers header_cells = table.get_header_cells() print iterate.getTextAsList(header_cells) # print row 1 cells = table.get_row_cells(1) print iterate.getTextAsList(cells) #print column 1 symbols_cells = table.get_column_cells('Marker') symbols = iterate.getTextAsList(symbols_cells) self.assertEqual(symbols, ['Marker', 'Acta2', 'Aqp2', 'Emcn', 'Postn', 'Tagln', 'Upk1b', 'Upk3a', 'Upk3b'])
def testBetweenDateSearch(self): """ @Status tests that searching by inclusive dates gives the correct results """ form = self.form form.enter_value('_priority_key', 'Medium') form.press_tab() form.enter_value('_conditionalmutants_key', 'Conditional') form.press_tab() form.enter_value('is_coded', 'Yes') form.press_tab() form.enter_value('creation_date', "10/01/2015..12/01/2015") form.press_tab() wait.forAngular(self.driver) form.click_search()#click the search button #find the search results table results_table = self.driver.find_element_by_id("resultsTable") table = Table(results_table) #Iterate and print the search results headers header_cells = table.get_header_cells() print iterate.getTextAsList(header_cells) # print row 1 cells = table.get_row_cells(1) print iterate.getTextAsList(cells) #print column 1 symbols_cells = table.get_column_cells('Marker') symbols = iterate.getTextAsList(symbols_cells) self.assertEqual(symbols, ['Marker', 'Flrt3', 'Ntn1', 'Pecam1', 'Slit1', 'Tlx1'])
def testSearchIndex(self): """ @Status tests that an index record(s) can be searched """ driver = self.driver form = self.form #find the Index grid table_element = driver.find_element_by_id("indexGrid") table = Table(table_element) #puts an X in the Prot-wm by age 7 box cell = table.get_cell("prot-wm", "7") cell.click() #puts an X in the Prot-wm by age 8 box cell = table.get_cell("prot-wm", "8") cell.click() wait.forAngular(driver) form.click_search()#click the search button #find the search results table results_table = driver.find_element_by_id("resultsTable") table = Table(results_table) #Iterate and print the search results headers header_cells = table.get_header_cells() print iterate.getTextAsList(header_cells) # print row 1 cells = table.get_row_cells(1) print iterate.getTextAsList(cells) #print column 1 symbols_cells = table.get_column_cells('Marker') symbols = iterate.getTextAsList(symbols_cells) self.assertEqual(symbols, ['Marker','Adgre1', 'Cdh5', 'Cdx4', 'Eng', 'Fgf8', 'Foxa2', 'Gata6', 'Itga2b', 'Kdr', 'Kdr', 'Kdr', 'Kdr', 'Lrp2', 'Nanog', 'Pdgfra', 'Pecam1', 'Pou3f1', 'Ptprc', 'T', 'T', 'Tal1', 'Tek'])
def testMultipleMrkSearch(self): """ @Status tests that a multiple marker search works @bug test needs to be written """ driver = self.driver form = self.form form.enter_value('marker_symbol', 't') form.press_tab() wait.forAngular(driver) # verify that display with two markers is shown mrkrows = driver.find_elements_by_css_selector(".markerSelections td") print mrkrows markers = [r.text for r in mrkrows] self.assertEqual(len(markers), 2) self.assertEqual(markers[0], "T, brachyury, Chr 17, Band") self.assertEqual(markers[1], "t, t-complex, Chr 17, Band") #form.press_enter() mrkrows[0].click() wait.forAngular(driver) # marker T should be selected marker_symbol = form.get_value('marker_symbol') self.assertEqual(marker_symbol, 'T')
def testClipboardShortcut(self): """ @status confirm the shortcut keys(CTRL + ALT + k) resets the clipboard input box """ actions = ActionChains(self.driver) #search for the term tail self.performSearch(term="tail") result = self.driver.find_element_by_id("termResultList").find_element_by_css_selector("mark") result.click() wait.forAngular(self.driver) #clear all items in the clipboard clear = self.driver.find_element_by_id("clipboardFunctions").find_element_by_id("clipboardClear") clear.click() #Add 18 into the add to clipboard field clipbox = self.driver.find_element_by_id("clipboardInput") clipbox.send_keys("18") clipbox.send_keys(Keys.RETURN) clipdata = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipdata.find_elements_by_css_selector("li") searchTreeItems = iterate.getTextAsList(items) #assert that TS18 tail is displayed in the clipboard self.assertEqual(["TS18; tail"], searchTreeItems) #clear the clipboard using the shortcut keys actions.key_down(Keys.CONTROL).key_down(Keys.ALT).send_keys('k').key_up(Keys.CONTROL).key_up(Keys.ALT).perform() time.sleep(5) clipdata = self.driver.find_element_by_id("emapClipBoardContent") items = clipdata.find_elements_by_css_selector("li") searchTreeItems = iterate.getTextAsList(items) #Assert that the clipboard is empty self.assertEqual([], searchTreeItems)
def test_diseases_tab_headers(self): ''' @status this test verifies the headings on the disease tab are correct and in the correct order. @bug: under construction ''' my_select = self.driver.find_element_by_xpath("//select[starts-with(@id, 'field_0_')]")#identifies the select field and picks the gene symbols option for option in my_select.find_elements_by_tag_name("option"): if option.text == 'Gene Symbol(s) or ID(s)': option.click() break self.driver.find_element_by_name("formly_3_input_input_0").send_keys("Gata1")#indentifies the input field and enters gata1 wait.forAngular(self.driver) self.driver.find_element_by_id("searchButton").click() #identify the Genes tab and verify the tab's text disease_tab = self.driver.find_element_by_css_selector("ul.nav.nav-tabs > li.uib-tab.nav-item.ng-scope.ng-isolate-scope:nth-child(3) > a.nav-link.ng-binding") print disease_tab.text self.assertEqual(disease_tab.text, "Diseases (3)", "Diseases tab is not visible!") disease_tab.click() gene_table_headers = self.driver.find_element_by_id("diseaseTable").find_element_by_css_selector("tr") items = gene_table_headers.find_elements_by_tag_name("th") searchTermItems = iterate.getTextAsList(items) self.assertEqual(searchTermItems[0], "Disease") self.assertEqual(searchTermItems[1], "DO ID") self.assertEqual(searchTermItems[2], "OMIM ID(s)") self.assertEqual(searchTermItems[3], "Mouse Models") self.assertEqual(searchTermItems[4], "Associated Genes from Mouse Models") self.assertEqual(searchTermItems[5], "Associated Human Genes (Source)") self.assertEqual(searchTermItems[6], "References using\nMouse Models")
def testStageLinks(self): """ tests that all stage links exist in the term detail section and clicking them function correctly """ self.performSearch(term="mouse") detailArea = self.driver.find_element_by_id("termDetailContent") stageItems = detailArea.find_elements_by_class_name("stageSelector") # add all li text to a list for "assertIn" test stages = iterate.getTextAsList(stageItems) self.assertEqual(stages, ["All","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28"]) # click stage 10 stage10 = detailArea.find_element_by_link_text("10").click() wait.forAngular(self.driver) #verify EMAPS term is loaded for mouse detailItems = self.driver.find_elements_by_css_selector("#termDetailContent dd") self.assertEqual(detailItems[2].text, "EMAPA:2576510") # verify stage is active activeStage = self.driver.find_element_by_css_selector(".stageSelector.active") self.assertEqual(activeStage.text, "10")
def testdeleteoneclipboard(self): """ @status tests you can delete one item from the clipboard. """ self.performSearch(term="emb%") result = self.driver.find_element_by_id("termResultList").find_elements_by_link_text("embryo") clear = self.driver.find_element_by_id("clipboardFunctions").find_element_by_id("clipboardClear") clear.click() wait.forAngular(self.driver) clipbox = self.driver.find_element_by_id("clipboardInput") clipbox.send_keys("4-5") clipbox.send_keys(Keys.RETURN) wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") # add all li text to a list for "assertIn" test searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS4; embryo", "TS5; embryo"], searchTreeItems) items[1].click() wait.forAngular(self.driver) self.driver.find_element_by_xpath("//*[@id='clipboard']/li[2]/img").click() wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS4; embryo"], searchTreeItems)
def testNonNumberStage(self): """ @status trying to add a stage to the clip board using a non-numeric number. """ self.performSearch(term="epiblast") result = self.driver.find_element_by_id("termResultList").find_element_by_css_selector("mark") result.click() clipbox = self.driver.find_element_by_id("clipboardInput") clipbox.send_keys("seven") clipbox.send_keys(Keys.RETURN) wait.forAngular(self.driver) errdisplay = self.driver.find_element_by_id("errorMessage") self.assertTrue(errdisplay.is_displayed(), "Error message not displaying")
def testSpecificStageTree(self): """ tests that tree view changes to show just tree of term selected. @status: test works @todo: add comments """ self.performSearch(term="embryo") # select specific stage stage20 = self.driver.find_element_by_id("stageList").find_element_by_link_text("20") stage20.click() wait.forAngular(self.driver) term_det = self.driver.find_element_by_id("termDetailContent") items = term_det.find_elements_by_tag_name("dd") self.assertEqual(items[0].text, "embryo") self.assertEqual(items[1].text, "Theiler Stage 20 (11.5-13.0 dpc)") self.assertEqual(items[2].text, "EMAPS:1603920")
def testParentStage(self): """ tests that if parent link is clicked remain in the current stage. @status: works fine @todo: add comments """ self.performSearch(term="3rd ventricle%") term_det = self.driver.find_element_by_id("termDetailContent") items = term_det.find_elements_by_tag_name("dd") self.assertEqual(items[0].text, "3rd ventricle") self.assertEqual(items[1].text, "Theiler Stages 14-28") self.assertEqual(items[2].text, "EMAPA:16900") self.assertEqual(items[3].text, "diencephalic vesicle, third ventricle") self.assertEqual(items[4].text.split("\n"), ["is-a brain ventricle","part-of diencephalon","part-of future diencephalon"]) stage15 = self.driver.find_element_by_id("stageList").find_element_by_link_text("15") stage15.click() wait.forAngular(self.driver) term_det = self.driver.find_element_by_id("termDetailContent") items = term_det.find_elements_by_tag_name("dd") self.assertEqual(items[0].text, "3rd ventricle") self.assertEqual(items[1].text, "Theiler Stage 15 (9.0-10.25 dpc)") self.assertEqual(items[2].text, "EMAPS:1690015") self.assertEqual(items[3].text, "diencephalic vesicle, third ventricle") self.assertEqual(items[4].text.split("\n"), ["is-a brain ventricle","part-of diencephalon"]) parent = self.driver.find_element_by_id("termDetailContent").find_element_by_class_name("detailPageListData") parent.find_element_by_link_text("diencephalon").click() wait.forAngular(self.driver) term_det = self.driver.find_element_by_id("termDetailContent") items = term_det.find_elements_by_tag_name("dd") self.assertEqual(items[0].text, "diencephalon") self.assertEqual(items[1].text, "Theiler Stage 15 (9.0-10.25 dpc)") self.assertEqual(items[2].text, "EMAPS:1689615") self.assertEqual(items[3].text.split("\n"), ["part-of future forebrain"]) activestage = self.driver.find_element_by_css_selector(".stageselector.active") self.assertEqual(activestage.text,"15")
def testClipboardBasicSort(self): """ @status tests that a basic sort works by displaying the clip board results in smart alpha order. """ self.performSearch(term="emb%") result = self.driver.find_element_by_id("termResultList").find_elements_by_link_text("embryo") clear = self.driver.find_element_by_id("clipboardFunctions").find_element_by_id("clipboardClear") clear.click() wait.forAngular(self.driver) clipbox = self.driver.find_element_by_id("clipboardInput") clipbox.send_keys("5-7") clipbox.send_keys(Keys.RETURN) wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") # add all li text to a list for "assertIn" test searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS5; embryo","TS6; embryo","TS7; embryo"], searchTreeItems) clipbox.clear() # do a new search for endoderm self.performSearch(term="endoderm") result = self.driver.find_element_by_id("termResultList").find_elements_by_link_text("endoderm") clipbox = self.driver.find_element_by_id("clipboardInput") clipbox.send_keys("6-8") clipbox.send_keys(Keys.RETURN) wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") # add all li text to a list for "assertIn" test searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS5; embryo","TS6; embryo","TS7; embryo","TS6; endoderm","TS7; endoderm","TS8; endoderm"], searchTreeItems) sort = self.driver.find_element_by_id("clipboardFunctions").find_element_by_id("clipboardSort") sort.click() wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") # add all li text to a list for "assertIn" test searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS5; embryo","TS6; embryo","TS6; endoderm","TS7; embryo","TS7; endoderm","TS8; endoderm"], searchTreeItems)
def performSearch(self, term="", stage=""): """ Submit the EMAPA search form with the supplied parameters """ termSearch = self.driver.find_element_by_id("termSearch") termSearch.clear() termSearch.send_keys(term) stageSearch = self.driver.find_element_by_id("stageSearch") stageSearch.clear() stageSearch.send_keys(stage) stageSearch.send_keys(Keys.RETURN) # wait for all AJAX behavior to complete wait.forAngular(self.driver)
def testDashStages(self): """ @status adding stages to the clip board separated by a dash. """ self.performSearch(term="neck") result = self.driver.find_element_by_id("termResultList").find_element_by_css_selector("mark") result.click() wait.forAngular(self.driver) clear = self.driver.find_element_by_id("clipboardFunctions").find_element_by_id("clipboardClear") clear.click() wait.forAngular(self.driver) clipbox = self.driver.find_element_by_id("clipboardInput") clipbox.send_keys("22-25") clipbox.send_keys(Keys.RETURN) wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") # add all li text to a list for "assertIn" test searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS22; neck", "TS23; neck", "TS24; neck", "TS25; neck"], searchTreeItems)
def testDuplicateStage(self): """ @status trying to add a duplicate term/stage to the clip board. """ self.performSearch(term="brain") result = self.driver.find_element_by_id("termResultList").find_element_by_css_selector("mark") result.click() wait.forAngular(self.driver) clear = self.driver.find_element_by_id("clipboardFunctions").find_element_by_id("clipboardClear") clear.click() wait.forAngular(self.driver) clipbox = self.driver.find_element_by_id("clipboardInput") clipbox.send_keys("18,19,20,20,21,22,23,24,25") clipbox.send_keys(Keys.RETURN) wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") # add all li text to a list for "assertIn" test searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS18; brain", "TS19; brain", "TS20; brain", "TS21; brain", "TS22; brain", "TS23; brain", "TS24; brain", "TS25; brain"], searchTreeItems)
def testWildcardStage(self): """ @status adding all stages to clip board using a *. """ self.performSearch(term="epiblast") result = self.driver.find_element_by_id("termResultList").find_element_by_css_selector("mark") result.click() wait.forAngular(self.driver) clear = self.driver.find_element_by_id("clipboardFunctions").find_element_by_id("clipboardClear") clear.click() wait.forAngular(self.driver) clipbox = self.driver.find_element_by_id("clipboardInput") clipbox.send_keys("*") clipbox.send_keys(Keys.RETURN) wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") # add all li text to a list for "assertIn" test searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS6; epiblast", "TS7; epiblast", "TS8; epiblast"], searchTreeItems)
def testCommaStages(self): """ @status adding stages to the clipboard separated by commas. """ self.performSearch(term="epithelium") result = self.driver.find_element_by_id("termResultList").find_element_by_css_selector("mark") result.click() wait.forAngular(self.driver) clear = self.driver.find_element_by_id("clipboardFunctions").find_element_by_id("clipboardClear") clear.click() wait.forAngular(self.driver) clipbox = self.driver.find_element_by_id("clipboardInput") clipbox.send_keys("15,16,17,19") clipbox.send_keys(Keys.RETURN) wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") # add all li text to a list for "assertIn" test searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS15; epithelium", "TS16; epithelium", "TS17; epithelium", "TS19; epithelium"], searchTreeItems)
def test_genes_tab_genes(self): ''' @status this test verifies the correct genes are returned for this query. ''' my_select = self.driver.find_element_by_xpath("//select[starts-with(@id, 'field_0_')]")#identifies the select field and picks the gene symbols option for option in my_select.find_elements_by_tag_name("option"): if option.text == 'Gene Symbol(s) or ID(s)': option.click() break self.driver.find_element_by_name("formly_3_input_input_0").send_keys("Gata1")#identifies the input field and enters gata1 wait.forAngular(self.driver) self.driver.find_element_by_id("searchButton").click() wait.forAngular(self.driver) #identify the Genes tab and verify the tab's text gene_tab = self.driver.find_element_by_css_selector("ul.nav.nav-tabs > li.uib-tab.nav-item.ng-scope.ng-isolate-scope:nth-child(2) > a.nav-link.ng-binding") print gene_tab.text self.assertEqual(gene_tab.text, "Genes (6)", "Genes tab is not visible!") gene_tab.click() gene_table = Table(self.driver.find_element_by_id("geneTable")) cells = gene_table.get_column_cells("Gene Symbol") print iterate.getTextAsList(cells) #displays each row of gene data gene1 = cells[1] gene2 = cells[2] gene3 = cells[3] gene4 = cells[4] gene5 = cells[5] gene6 = cells[6] #asserts that the correct genes in the correct order are returned self.assertEqual(gene1.text, 'Gata1') self.assertEqual(gene2.text, 'GATA1') self.assertEqual(gene3.text, 'Tg(Gata1)#Mym') self.assertEqual(gene4.text, 'Tg(Gata1*)#Mym') self.assertEqual(gene5.text, 'Tg(Gata1*V205G)1Mym') self.assertEqual(gene6.text, 'Tg(HBB-Gata1)G4Phi')
def testDeleteMultClipboard(self): """ @status tests you can delete multiple items from the clipboard. """ self.performSearch(term="neck") clear = self.driver.find_element_by_id("clipboardFunctions").find_element_by_id("clipboardClear") clear.click() wait.forAngular(self.driver) clipbox = self.driver.find_element_by_id("clipboardInput") clipbox.send_keys("23-27") clipbox.send_keys(Keys.RETURN) wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") # add all li text to a list for "assertIn" test searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS23; neck","TS24; neck","TS25; neck","TS26; neck","TS27; neck"], searchTreeItems) # TS24; neck self.driver.find_element_by_xpath("//*[@id='clipboard']/li[2]").click() self.driver.find_element_by_xpath("//*[@id='clipboard']/li[2]/img").click() wait.forAngular(self.driver) # TS25; neck self.driver.find_element_by_xpath("//*[@id='clipboard']/li[2]").click() self.driver.find_element_by_xpath("//*[@id='clipboard']/li[2]/img").click() wait.forAngular(self.driver) # TS26; neck self.driver.find_element_by_xpath("//*[@id='clipboard']/li[2]").click() self.driver.find_element_by_xpath("//*[@id='clipboard']/li[2]/img").click() wait.forAngular(self.driver) clipsort = self.driver.find_element_by_id("emapClipBoardContent").find_element_by_id("clipboard") items = clipsort.find_elements_by_css_selector("li") searchTreeItems = iterate.getTextAsList(items) self.assertEqual(["TS23; neck","TS27; neck"], searchTreeItems)
def test_genes_tab_diseases(self): ''' @status this test verifies the correct diseases are returned for this query. ''' my_select = self.driver.find_element_by_xpath("//select[starts-with(@id, 'field_0_')]")#identifies the select field and picks the gene symbols option for option in my_select.find_elements_by_tag_name("option"): if option.text == 'Gene Symbol(s) or ID(s)': option.click() break self.driver.find_element_by_name("formly_3_input_input_0").send_keys("Gata1")#identifies the input field and enters gata1 wait.forAngular(self.driver) self.driver.find_element_by_id("searchButton").click() wait.forAngular(self.driver) #identify the Genes tab and verify the tab's text gene_tab = self.driver.find_element_by_css_selector("ul.nav.nav-tabs > li.uib-tab.nav-item.ng-scope.ng-isolate-scope:nth-child(2) > a.nav-link.ng-binding") self.assertEqual(gene_tab.text, "Genes (6)", "Genes tab is not visible!") gene_tab.click() gene_table = Table(self.driver.find_element_by_id("geneTable")) cells = gene_table.get_column_cells("Associated Human Diseases (Source)") print iterate.getTextAsList(cells) #displays each row of gene data disease1 = cells[1] disease2 = cells[2] disease3 = cells[3] disease4 = cells[4] disease5 = cells[5] disease6 = cells[6] #asserts that the correct genes in the correct order are returned self.assertEqual(disease1.text, 'myelofibrosis\nthrombocytopenia') self.assertEqual(disease2.text, 'Down syndrome\nthrombocytopenia') self.assertEqual(disease3.text, '') self.assertEqual(disease4.text, '') self.assertEqual(disease5.text, 'thrombocytopenia') self.assertEqual(disease6.text, '')
def testDetailParent(self): """ tests that term detail updates including valid parents. @status: test works @todo: needs comments """ self.performSearch(term="cortical renal tubule") term_det = self.driver.find_element_by_id("termDetailContent") items = term_det.find_elements_by_tag_name("dd") self.assertEqual(items[0].text, "cortical renal tubule") self.assertEqual(items[1].text, "Theiler Stages 22-28") self.assertEqual(items[2].text, "EMAPA:18976") self.assertEqual(items[3].text, "kidney cortex tubule, renal cortex tubule") self.assertEqual(items[4].text.split("\n"), ["part-of developing capillary loop stage nephron group","part-of early nephron","part-of late tubule","part-of mature nephron","part-of maturing nephron","part-of renal cortex","part-of stage IV immature nephron"]) stage24 = self.driver.find_element_by_id("stageList").find_element_by_link_text("24") stage24.click() wait.forAngular(self.driver) term_det = self.driver.find_element_by_id("termDetailContent") items = term_det.find_elements_by_tag_name("dd") self.assertEqual(items[0].text, "cortical renal tubule") self.assertEqual(items[1].text, "Theiler Stage 24 (16.0-16.99 dpc)") self.assertEqual(items[2].text, "EMAPS:1897624") self.assertEqual(items[3].text, "kidney cortex tubule, renal cortex tubule") self.assertEqual(items[4].text.split("\n"), ["part-of developing capillary loop stage nephron group","part-of early nephron","part-of late tubule","part-of maturing nephron","part-of renal cortex"]) stage22 = self.driver.find_element_by_id("stageList").find_element_by_link_text("22") stage22.click() wait.forAngular(self.driver) term_det = self.driver.find_element_by_id("termDetailContent") items = term_det.find_elements_by_tag_name("dd") self.assertEqual(items[0].text, "cortical renal tubule") self.assertEqual(items[1].text, "Theiler Stage 22 (13.5-15.0 dpc)") self.assertEqual(items[2].text, "EMAPS:1897622") self.assertEqual(items[3].text, "kidney cortex tubule, renal cortex tubule") self.assertEqual(items[4].text.split("\n"), ["part-of developing capillary loop stage nephron group","part-of early nephron","part-of late tubule","part-of maturing nephron","part-of renal cortex","part-of stage IV immature nephron"])
def testClickingNode(self): """ tests that if a term is clicked, the detail updates, and also that node expands """ self.performSearch(term="mouse") # click tissue node in tree tree = self.driver.find_element_by_id("emapaTree") tissueNode = tree.find_element_by_link_text("tissue") tissueNode.click() wait.forAngular(self.driver) # verify term detail changed detail = self.driver.find_element_by_id("termDetailContent") ddItems = detail.find_elements_by_tag_name("dd") # verify EMAPA ID for 'tissue' is displayed self.assertEqual(ddItems[2].text, "EMAPA:35868") # verify tree has expanded to include children of tissue tree = self.driver.find_element_by_id("emapaTree") self.assertTrue("epithelium" in tree.text, "epithelium should be in tree view") self.assertTrue("muscle tissue" in tree.text, "muscle tissue should be in tree view")