From 668a715e3626030edad87b428678ce9eca66eb3d Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Wed, 21 Aug 2013 18:05:21 -0500 Subject: Fixed an issue where correlationFunction was being imported instead of its updated name correlation_function --- webtests/show_trait_js_test.py | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 webtests/show_trait_js_test.py (limited to 'webtests/show_trait_js_test.py') diff --git a/webtests/show_trait_js_test.py b/webtests/show_trait_js_test.py new file mode 100644 index 00000000..d92cf369 --- /dev/null +++ b/webtests/show_trait_js_test.py @@ -0,0 +1,51 @@ +""" +Test calculate correlations + +>>> test.get("http://genenetwork.org") +title: GeneNetwork + +Choose the type +>>> test.click_option('''//*[@id="tissue"]''', 'Hippocampus mRNA') + +Enter the Get Any +>>> test.enter_text('''//*[@id="tfor"]''', 'ssh') +text: ssh + +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 + +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) + +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 + +""" + +from __future__ import absolute_import, division, print_function + +from browser_test import * + +testmod() -- cgit v1.2.3 From 2db8468a8e3e802588d97bdeb64b5b638d634bb6 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Wed, 21 Aug 2013 18:10:38 -0500 Subject: Just changed a comment in the show trait js test --- webtests/show_trait_js_test.py | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'webtests/show_trait_js_test.py') diff --git a/webtests/show_trait_js_test.py b/webtests/show_trait_js_test.py index d92cf369..5e8b72bf 100644 --- a/webtests/show_trait_js_test.py +++ b/webtests/show_trait_js_test.py @@ -1,46 +1,35 @@ """ -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 +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 +title: KIN/YSM Human OFC Affy Hu-Exon 1.0 ST (Jul11) Quantile : 3081205: Display Trait -Sleep a bunch because this can take a while ->>> sleep(25) -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 """ -- cgit v1.2.3 From b34e262f0371952fdec850483c0929d4f0a858d1 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 22 Aug 2013 16:54:13 -0500 Subject: Fixed import in show_trait_js_test.py Added a function to browser_run.py that gets an element's style --- webtests/browser_run.py | 8 +++++++- webtests/show_trait_js_test.py | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'webtests/show_trait_js_test.py') 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 5e8b72bf..7a98af6a 100644 --- a/webtests/show_trait_js_test.py +++ b/webtests/show_trait_js_test.py @@ -29,12 +29,14 @@ A new window is created, so we switch to it >>> test.switch_window() title: KIN/YSM Human OFC Affy Hu-Exon 1.0 ST (Jul11) Quantile : 3081205: Display Trait - +Check that the Calculate Correlations tab is closed (if javascript isn't working, it will be open) +>>> test.get_style('''//*[@id="sectionbody3"]''') +style: "display: none;" """ from __future__ import absolute_import, division, print_function -from browser_test import * +from browser_run import * testmod() -- cgit v1.2.3 From 73ad2b41c0f9ca45b06de467400184f7b1bd9d91 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 22 Aug 2013 16:58:31 -0500 Subject: Fixed a couple minor things --- webtests/show_trait_js_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'webtests/show_trait_js_test.py') diff --git a/webtests/show_trait_js_test.py b/webtests/show_trait_js_test.py index 7a98af6a..35e6c758 100644 --- a/webtests/show_trait_js_test.py +++ b/webtests/show_trait_js_test.py @@ -14,7 +14,7 @@ Choose the type >>> test.click_option('''//*[@id="tissue"]''', 'Orbital Prefrontal Cortex mRNA') Enter the Get Any ->>> test.enter_text('''//*[@id="tfor"]''', 'ssh') +>>> test.enter_text('''//*[@id="tfor"]''', 'shh') text: shh Search @@ -30,7 +30,7 @@ A new window is created, so we switch to it title: KIN/YSM Human OFC Affy Hu-Exon 1.0 ST (Jul11) Quantile : 3081205: Display Trait Check that the Calculate Correlations tab is closed (if javascript isn't working, it will be open) ->>> test.get_style('''//*[@id="sectionbody3"]''') +>>> test.get_element_style('''//*[@id="sectionbody3"]''') style: "display: none;" """ -- cgit v1.2.3 From c5fc931621707865357ace4b637db7481e0be552 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 22 Aug 2013 18:18:11 -0500 Subject: Added show_trait_js_test to the tests run by test_runner Fixed the part of show_trait_js_test that checks that the style is "display: none;" --- webtests/show_trait_js_test.py | 2 +- webtests/test_runner.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'webtests/show_trait_js_test.py') diff --git a/webtests/show_trait_js_test.py b/webtests/show_trait_js_test.py index 35e6c758..0fd2c16c 100644 --- a/webtests/show_trait_js_test.py +++ b/webtests/show_trait_js_test.py @@ -31,7 +31,7 @@ title: KIN/YSM Human OFC Affy Hu-Exon 1.0 ST (Jul11) Quantile : 3081205: Display 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;" +style: display: none; """ 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(): -- cgit v1.2.3