self.assertNotEqual(newStartDate, origStartDate, "Changes were not set by to the original via Reset") self.assertNotEqual(origEndDate, newEndDate, "Changes were not set by to the original via Reset") def test_05_installBarHover(self): graphBars = driver.find_elements_by_class_name("bar") # Scroll bar into view graphBars[0].location_once_scrolled_into_view ActionChains(driver).move_to_element(graphBars[0]).perform() time.sleep(5) tooltip = driver.find_element_by_id("toolTip") self.assertTrue(re.search(" [A-Z]+\*[0-9.]+\*[0-9]+", tooltip.find_element_by_id("header1").get_attribute("innerHTML")), "Header of tool tip didn't match expected format") self.assertTrue(re.search("[0-9]+\-[0-9]+\-[0-9]+", tooltip.find_element_by_id("installDate").get_attribute("innerHTML")), "Install date of tool tip didnt match expected format") time.sleep(1) def test_06_installBarClick(self): graphBars = driver.find_elements_by_class_name("bar") graphBars[-1].click() driver.switch_to.window(driver.window_handles[1]) time.sleep(1) self.assertTrue(re.search("/vivian-data/9_7/9.7-[0-9]+.html", driver.current_url), "URL of new window didnt match expected format") driver.close() driver.switch_to.window(driver.window_handles[0]) if __name__ == '__main__': description = "Test the Install Timeline page of the ViViaN(TM) webpage" page = "vivian/installScale.php" webroot, driver, browser = setup_webdriver(description, page) suite = unittest.TestLoader().loadTestsFromTestCase(test_installscale) unittest.TextTestRunner(verbosity=2).run(suite)
button.click() time.sleep(1) newVal = menuTreeDisplay.get_attribute("transform") self.assertNotEqual(oldVal, newVal, "Centering the pan from drag-and-drop did not change the transform") def test_11_panReset(self): menuTree = driver.find_element_by_id("treeview_placeholder").find_element_by_tag_name('svg') menuTreeDisplay = menuTree.find_element_by_tag_name('g') ActionChains(driver).move_to_element(menuTree).drag_and_drop_by_offset(menuTree, 300, 200).perform() oldval = menuTreeDisplay.get_attribute("transform") button = driver.find_element_by_xpath("//button[contains(@onclick,'_resetAllNode')]") button.click() time.sleep(1) newVal = menuTreeDisplay.get_attribute("transform") self.assertNotEqual(oldval, newVal, "Resetting the pan from drag-and-drop did not change the transform") def test_12_directLink(self): (urlParam, rootMenu) = targetedMenus[pageExtension]['12'] driver.get("%s?name=%s" % (driver.current_url, urlParam) ) time.sleep(3) node_list = driver.find_elements_by_class_name('node') self.assertEqual(node_list[0].text, rootMenu) if __name__ == '__main__': description = "Test the Install Timeline page of the ViViaN(TM) webpage" page = "vivian/vista_menus.php" for pageExtension in ['19', '101']: webroot, driver, browser = setup_webdriver(description, page + "#%s" % pageExtension) suite = unittest.TestLoader().loadTestsFromTestCase(test_menus) unittest.TextTestRunner(verbosity=2).run(suite)
table = driver.find_element_by_id("ICR_List-All") odd_rows = len(table.find_elements_by_class_name('odd')) even_rows = len(table.find_elements_by_class_name('even')) total_rows = odd_rows + even_rows # Do a global search for a string that won't be found search_text = "lsjdjlksdjf" search_element = driver.find_elements_by_xpath("//*[@type='search']")[0] search_element.clear() search_element.send_keys(search_text) time.sleep(1) empty_row = table.find_elements_by_class_name('odd')[0].find_elements_by_class_name('dataTables_empty')[0] self.assertEqual("No matching records found", empty_row.text) # clear search driver.find_element_by_tag_name("button").click() odd_rows2 = len(table.find_elements_by_class_name('odd')) even_rows2 = len(table.find_elements_by_class_name('even')) total_rows2 = odd_rows2 + even_rows2 self.assertEqual(total_rows, total_rows2) if __name__ == '__main__': description = "Test the ICR table pages of the ViViaN(TM) tool, the VistA Package visualization" page = "files/ICR/All-ICR List.html" webroot, driver, browser, is_local = setup_webdriver(description, page) suite = unittest.TestLoader().loadTestsFromTestCase(test_icrtable) unittest.TextTestRunner(verbosity=2).run(suite)
self.assertNotEqual(oldVal, newVal, "Centering the pan from drag-and-drop did not change the transform") def test_11_panReset(self): global driver menuTree = driver.find_element_by_id("treeview_placeholder").find_element_by_tag_name('svg') menuTreeDisplay = menuTree.find_element_by_tag_name('g') ActionChains(driver).move_to_element(menuTree).drag_and_drop_by_offset(menuTree, 300, 200).perform() oldval = menuTreeDisplay.get_attribute("transform") button = driver.find_element_by_xpath("//button[contains(@onclick,'_resetAllNode')]") button.click() time.sleep(1) newVal = menuTreeDisplay.get_attribute("transform") self.assertNotEqual(oldval , newVal, "Resetting the pan from drag-and-drop did not change the transform") def test_12_directLink(self): global driver (urlParam, rootMenu) = targetedMenus[pageExtension]['12'] driver.get("%s?name=%s" % (driver.current_url,urlParam) ) time.sleep(3) node_list = driver.find_elements_by_class_name('node') self.assertEqual(node_list[0].text, rootMenu) if __name__ == '__main__': description = "Test the Install Timeline page of the ViViaN(TM) webpage" page = "vista_menus.php" for pageExtension in ['19','101']: webroot, driver, browser, is_local = setup_webdriver(description, page + "#%s" % pageExtension) suite = unittest.TestLoader().loadTestsFromTestCase(test_menus) unittest.TextTestRunner(verbosity=2).run(suite)