diff options
Diffstat (limited to 'webtests')
-rw-r--r-- | webtests/browser_run.py | 8 | ||||
-rw-r--r-- | webtests/show_trait_js_test.py | 45 | ||||
-rw-r--r-- | webtests/test_runner.py | 7 |
3 files changed, 29 insertions, 31 deletions
diff --git a/webtests/browser_run.py b/webtests/browser_run.py index b2058cf8..2ec299c5 100644 --- a/webtests/browser_run.py +++ b/webtests/browser_run.py @@ -13,7 +13,8 @@ from selenium.webdriver.common.keys import Keys class Test(object): def __init__(self): - self.browser = webdriver.Chrome('/home/gn2/gn2/webtests/chromedriver') + #self.browser = webdriver.Chrome('/home/gn2/gn2/webtests/chromedriver') + self.browser = webdriver.Firefox() def get(self, url): self.browser.get(url) @@ -52,6 +53,11 @@ class Test(object): el = self.browser.find_element_by_xpath(xpath_selector) text = el.text.strip() or el.get_attribute("value").strip() print("text:", text) + + def get_element_style(self, xpath_selector): + el = self.browser.find_element_by_xpath(xpath_selector) + style = el.get_attribute("style").strip() + print("style:", style) def switch_window(self): self.browser.switch_to_window(self.browser.window_handles[-1]) diff --git a/webtests/show_trait_js_test.py b/webtests/show_trait_js_test.py index d92cf369..0fd2c16c 100644 --- a/webtests/show_trait_js_test.py +++ b/webtests/show_trait_js_test.py @@ -1,51 +1,42 @@ """ -Test calculate correlations +Test if JS is working on the show trait page ->>> test.get("http://genenetwork.org") +>>> test.get("alexandria.uthsc.edu:89") title: GeneNetwork +Choose the species +>>> test.click_option('''//*[@id="species"]''', 'Human') + +Choose the group +>>> test.click_option('''//*[@id="cross"]''', 'Human Brain Transcriptome (Yale/Kavli)') + Choose the type ->>> test.click_option('''//*[@id="tissue"]''', 'Hippocampus mRNA') +>>> test.click_option('''//*[@id="tissue"]''', 'Orbital Prefrontal Cortex mRNA') Enter the Get Any ->>> test.enter_text('''//*[@id="tfor"]''', 'ssh') -text: ssh +>>> test.enter_text('''//*[@id="tfor"]''', 'shh') +text: shh Search >>> test.click('//*[@id="btsearch"]') clicked: Search Choose the first result ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/p/table/tbody/tr[3]/td/div/table/tbody/tr[2]/td[2]/a''') -clicked: 1455854_a_at +>>> test.click('''//*[@id="KIN_YSM_OFC_0711::3081205"]/td[2]/a''') +clicked: 3081205 A new window is created, so we switch to it >>> test.switch_window() -title: Hippocampus M430v2 BXD 06/06 PDNN : 1455854_a_at: Display Trait - -Click on Calculate Correlations ->>> test.click('''//*[@id="title3"]''') -clicked: Calculate Correlations - -Click on Compute ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/p[6]/table/tbody/tr/td/div/div/span/table/tbody/tr/td/input[3]''') -clicked: Compute - -Another new window ->>> test.switch_window() -title: Correlation - -Sleep a bunch because this can take a while ->>> sleep(25) +title: KIN/YSM Human OFC Affy Hu-Exon 1.0 ST (Jul11) Quantile : 3081205: Display Trait -Ensure the Sample rho is the exepcted 1.000 because it should be the same record ->>> test.get_text('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[9]/a''') -text: 1.000 +Check that the Calculate Correlations tab is closed (if javascript isn't working, it will be open) +>>> test.get_element_style('''//*[@id="sectionbody3"]''') +style: display: none; """ from __future__ import absolute_import, division, print_function -from browser_test import * +from browser_run import * testmod() diff --git a/webtests/test_runner.py b/webtests/test_runner.py index d2d6339d..ef6d0d69 100644 --- a/webtests/test_runner.py +++ b/webtests/test_runner.py @@ -4,9 +4,10 @@ import unittest import doctest import glob -#tests = ("correlation_test", -# "correlation_matrix_test", -# "marker_regression_test") +tests = ("correlation_test", + "correlation_matrix_test", + "marker_regression_test", + "show_trait_js_test") def main(): |