Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 # 3 # 4 # Copyright (C) 2011 University of Dundee & Open Microscopy Environment. 5 # All rights reserved. 6 # 7 # This program is free software: you can redistribute it and/or modify 8 # it under the terms of the GNU Affero General Public License as 9 # published by the Free Software Foundation, either version 3 of the 10 # License, or (at your option) any later version. 11 # 12 # This program is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU Affero General Public License for more details. 16 # 17 # You should have received a copy of the GNU Affero General Public License 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 # 20 21 from omeroweb.webgateway.tests.seleniumbase import SeleniumTestBase, Utils 22 from omero.gateway.scripts import dbhelpers 23 from random import random 24 25 import sys 26 2729 3079 8032 sel = self.selenium 33 if self.selenium.is_element_present('link=Log out'): 34 self.logout() 35 sel.open("/webclient/login") 36 sel.type("id_username", u) 37 sel.type("id_password", p) 38 sel.click("//input[@value='Connect']")3941 self.selenium.open("/webclient/logout") 42 self.selenium.wait_for_page_to_load("30000") 43 self.waitForElementPresence("//input[@value='Connect']")44 4547 """ 48 This code from OmeroPy/tests/integration/library.py 49 TODO: Trying to find a way to do import from here, but no luck yet. 50 """ 51 #server = self.client.getProperty("omero.host") 52 #port = self.client.getProperty("omero.port") 53 #key = self.client.getSessionId() 54 server = 'localhost' 55 port = '4064' 56 key = '' 57 58 if filename is None: 59 filename = self.OmeroPy / ".." / ".." / ".." / "components" / "common" / "test" / "tinyTest.d3d.dv" 60 61 # Search up until we find "OmeroPy" 62 dist_dir = self.OmeroPy / ".." / ".." / ".." / "dist" 63 args = [sys.executable] 64 args.append(str(path(".") / "bin" / "omero")) 65 args.extend(["-s", server, "-k", key, "-p", port, "import", filename]) 66 popen = subprocess.Popen(args, cwd=str(dist_dir), stdout=subprocess.PIPE, stderr=subprocess.PIPE) 67 out, err = popen.communicate() 68 rc = popen.wait() 69 if rc != 0: 70 raise exceptions.Exception("import failed: [%r] %s\n%s" % (args, rc, err)) 71 pix_ids = [] 72 for x in out.split("\n"): 73 if x and x.find("Created") < 0 and x.find("#") < 0: 74 try: # if the line has an image ID... 75 imageId = str(long(x.strip())) 76 pix_ids.append(imageId) 77 except: pass 78 return pix_ids82 83 from omero.gateway.scripts import dbhelpers 84126 127 128 if __name__ == "__main__": 129 Utils.runAsScript('webadmin') 13086 super(WebClientTests, self).setUp() 87 #dbhelpers.refreshConfig() 88 #user = dbhelpers.ROOT.name 89 #password = dbhelpers.ROOT.passwd 90 #print user, password # seems to always be 'root', 'ome' 91 self.login('will', 'ome')92 9395 """ 96 Displays the metadata page for an image. 97 """ 98 99 #print "testMetadata" 100 101 sel = self.selenium 102 sel.open("/webclient/metadata_details/image/4183") 103 #sel.click("link=Metadata") # Making metadata 'visible' to user is unecessary for tests below 104 self.assertEqual("480 x 480 x 46 x 1", sel.get_table("//div[@id='metadata_tab']/table[2].0.1")) 105 106 # Check channel names... 107 self.failUnless(sel.is_text_present("DAPI")) # anywhere on page 108 # more specific (too fragile?) 109 self.assertEqual("DAPI", sel.get_text("//div[@id='metadata_tab']/h1[5]/span")) 110 self.assertEqual("FITC", sel.get_text("//div[@id='metadata_tab']/h1[6]/span")) 111 self.assertEqual("RD-TR-PE", sel.get_text("//div[@id='metadata_tab']/h1[7]/span")) 112 self.assertEqual("CY-5", sel.get_text("//div[@id='metadata_tab']/h1[8]/span")) 113 114 # check value of Channel inputs. 115 self.assertEqual("DAPI", sel.get_value("//div[@id='metadata_tab']/div[4]/table/tbody/tr[1]/td[2]/input")) # Name 116 self.assertEqual("360", sel.get_value("//div[@id='metadata_tab']/div[4]/table/tbody/tr[2]/td[2]/input")) # Excitation 117 self.assertEqual("457", sel.get_value("//div[@id='metadata_tab']/div[4]/table/tbody/tr[3]/td[2]/input")) # Excitation 118 119 # using id='id_name' gets us the FIRST element with that id (currently 1 per channel) 120 self.assertEqual("DAPI", sel.get_value("//input[@id='id_name']"))121 122
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Oct 18 13:29:14 2011 | http://epydoc.sourceforge.net |