def testResultsTable(self): """ An example of getting data from the results table using Table class NOTE: this is only for example purposes. Not a real test """ driver = self.driver form = self.form form.enter_value('jnumid', '121946') form.press_tab() form.click_search() results_table = driver.find_element_by_id("indexGrid") table = Table(results_table) header_cells = table.get_header_cells() print iterate.getTextAsList(header_cells) # print row 1 cells = table.get_row_cells(1) print iterate.getTextAsList(cells) # single cell cell = table.get_cell("RNA-WM", "10.5") print cell.text # empty cell cell = table.get_cell("prot-sxn", "A")
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 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 testClearFields(self): """ @Status tests that when an index record is cleared the correct fields get cleared """ driver = self.driver form = self.form form.enter_value("jnumid", "74162") # click the Tab key form.press_tab() # finds the citation field citation = form.get_value("citation") print citation self.assertEqual(citation, "Abdelwahid E, Cell Tissue Res 2001 Jul;305(1):67-78") # 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") form.click_search() # finds the coded? field is_coded = form.get_value("is_coded") print is_coded self.assertEqual(is_coded, "false") # finds the priority field priority = form.get_selected_text("_priority_key") print priority self.assertEqual(priority, "High") # finds the conditional mutants field conditional = form.get_selected_text("_conditionalmutants_key") print conditional self.assertEqual(conditional, "Not Specified") # finds the created by field created_user = form.get_value("createdby_login") print created_user self.assertEqual(created_user, "MGI_2.97") # finds the modified by field modified_user = form.get_value("modifiedby_login") # .find_element_by_css_selector('td') print modified_user self.assertEqual(modified_user, "MGI_2.97") # finds the created by date field created_date = form.get_value("creation_date") print created_date self.assertEqual(created_date, "04/23/2002") # finds the created by date field modified_date = form.get_value("modification_date") print modified_date self.assertEqual(modified_date, "04/23/2002") # 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("RT-PCR", "A") # cell.click() wait.forAngular(driver) self.assertEqual(cell.text, "X", "the cell is not checked") form.click_clear() # press the clear button # finds the citation field citation = form.get_value("citation") print citation self.assertEqual(citation, "") # finds the marker field marker_symbol = form.get_value("marker_symbol") print marker_symbol self.assertEqual(marker_symbol, "") # finds the coded? field is_coded = form.get_value("is_coded") print is_coded self.assertEqual(is_coded, "") # finds the priority field priority = form.get_selected_text("_priority_key") print priority self.assertEqual(priority, "Search All") # finds the conditional mutants field conditional = form.get_selected_text("_conditionalmutants_key") print conditional self.assertEqual(conditional, "Search All") # finds the created by field created_user = form.get_value("createdby_login") print created_user self.assertEqual(created_user, "") # finds the modified by field modified_user = form.get_value("modifiedby_login") # .find_element_by_css_selector('td') print modified_user self.assertEqual(modified_user, "") # finds the created by date field created_date = form.get_value("creation_date") print created_date self.assertEqual(created_date, "") # finds the created by date field modified_date = form.get_value("modification_date") print modified_date self.assertEqual(modified_date, "") # 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("RT-PCR", "A") # cell.click() wait.forAngular(driver) self.assertNotEqual(cell.text, "X", "the cell is not checked")
def testCtrlAltc(self): """ @Status tests that when an index record is cleared using Ctrl+Alt+c the correct fields are cleared """ driver = self.driver form = self.form action = ActionChains(self.driver) form.enter_value('jnumid', '74162') # click the Tab key form.press_tab() #finds the citation field citation = form.get_value('citation') print citation try: self.assertEqual(citation, 'Abdelwahid E, Cell Tissue Res 2001 Jul;305(1):67-78') self.report.AppendToReport("gxdIdx1-0", "testctrrlaltc", "citation text displays", "correct citation text displays", citation, "Pass", "") except Exception: self.report.AppendToReport("gxdIdx1-0", "testctrrlaltc", "citation text displays", "correct citation text displays", citation, "Fail", "") #finds the marker field form.enter_value('marker_symbol', 'Bmp2') marker_symbol = form.get_value('marker_symbol') form.press_tab() print marker_symbol try: self.assertEqual(marker_symbol, 'Bmp2') self.report.AppendToReport("gxdIdx1-1", "testctrrlaltc", "marker symbol displays", "correct marker symbol displays", "symbol is ", "Pass", "") except Exception: self.report.AppendToReport("gxdIdx1-1", "testctrrlaltc", "marker symbol displays", "correct marker symbol displays", "symbol is ", "Fail", "") form.click_search() time.sleep(2) action.key_down(Keys.CONTROL).key_down(Keys.ALT).send_keys('c').key_up(Keys.CONTROL).key_up(Keys.ALT).perform() time.sleep(5) #finds the citation field citation = form.get_value('citation') print citation self.assertEqual(citation, '') #finds the marker field marker_symbol = form.get_value('marker_symbol') print marker_symbol self.assertEqual(marker_symbol, '') #finds the coded? field is_coded = form.get_value('is_coded') print is_coded self.assertEqual(is_coded, '') #finds the priority field priority = form.get_selected_text('_priority_key') print priority self.assertEqual(priority, 'Search All') #finds the conditional mutants field conditional = form.get_selected_text('_conditionalmutants_key') print conditional self.assertEqual(conditional, 'Search All') #finds the created by field created_user = form.get_value('createdby_login') print created_user self.assertEqual(created_user, '') #finds the modified by field modified_user = form.get_value('modifiedby_login')#.find_element_by_css_selector('td') print modified_user self.assertEqual(modified_user, '') #finds the created by date field created_date = form.get_value('creation_date') print created_date self.assertEqual(created_date, '') #finds the created by date field modified_date = form.get_value('modification_date') print modified_date self.assertEqual(modified_date, '') #find the table field to check table_element = driver.find_element_by_id("indexGrid") table = Table(table_element) #verifies there is no X in the RNA-sxn by age 10.5 box cell = table.get_cell(2, 21) #cell.click() wait.forAngular(driver) self.assertEqual(cell.text, '', "the cell is checked")
def testCtrlAlts(self): """ @Status tests that when a reference is entered then Ctrl+Alt+s is pressed the correct results are returned """ driver = self.driver form = self.form actions = ActionChains(self.driver) form.enter_value('jnumid', '124809') # click the Tab key form.press_tab() #finds the citation field citation = form.get_value('citation') print citation try: self.assertEqual(citation, 'Cheong N, J Biol Chem 2007 Aug 17;282(33):23811-7') self.report.AppendToReport("gxdIdx1-2", "testctrrlalts", "Citation is displayed", "correct citation displays", "citation is ", "Pass", "") except Exception: self.report.AppendToReport("gxdIdx1-2", "testctrrlalts", "Citation is displayed", "correct citation displays", "citation is ", "Fail", "") actions.key_down(Keys.CONTROL).key_down(Keys.ALT).send_keys('s').key_up(Keys.CONTROL).key_up(Keys.ALT).perform() time.sleep(5) #finds the citation field citation = form.get_value('citation') print citation self.assertEqual(citation, 'Cheong N, J Biol Chem 2007 Aug 17;282(33):23811-7') #finds the marker field marker_symbol = form.get_value('marker_symbol') print marker_symbol self.assertEqual(marker_symbol, 'Abca3') #finds the coded? field is_coded = form.get_value('is_coded') print is_coded self.assertEqual(is_coded, 'false') #finds the priority field priority = form.get_selected_text('_priority_key') print priority self.assertEqual(priority, 'Medium') #finds the conditional mutants field conditional = form.get_selected_text('_conditionalmutants_key') print conditional self.assertEqual(conditional, 'Not Specified') #finds the created by field created_user = form.get_value('createdby_login') print created_user self.assertEqual(created_user, 'terryh') #finds the modified by field modified_user = form.get_value('modifiedby_login')#.find_element_by_css_selector('td') print modified_user self.assertEqual(modified_user, 'terryh') #finds the created by date field created_date = form.get_value('creation_date') print created_date self.assertEqual(created_date, '10/01/2007') #finds the created by date field modified_date = form.get_value('modification_date') print modified_date self.assertEqual(modified_date, '10/01/2007') #find the table field to check table_element = driver.find_element_by_id("indexGrid") table = Table(table_element) #verifies there is an X in the Prot-sxn by age 18.5 box cell = table.get_cell(1, 37) wait.forAngular(driver) self.assertEqual(cell.text, 'X', "the cell is checked")