<s> """<STR_LIT>""" <EOL> import time <EOL> from gluon import current <EOL> from tests . web2unittest import SeleniumUnitTest <EOL> from selenium . webdriver . support . ui import WebDriverWait <EOL> class SearchMember ( SeleniumUnitTest ) : <EOL> def start ( self ) : <EOL> print "<STR_LIT:\n>" <EOL> self . login ( account = "<STR_LIT>" , <EOL> nexturl = "<STR_LIT>" ) <EOL> def advancedSearchTest ( self , ids ) : <EOL> self . clickLabel ( ids ) <EOL> self . browser . find_element_by_xpath ( "<STR_LIT>" <EOL> "<STR_LIT>" ) . click ( ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> self . clickLabel ( ids ) <EOL> def clickLabel ( self , ids ) : <EOL> try : <EOL> self . browser . find_element_by_link_text ( "<STR_LIT>" ) . click ( ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> except : <EOL> pass <EOL> for id in ids : <EOL> self . browser . find_element_by_xpath ( "<STR_LIT>" + id + "<STR_LIT>" ) . click ( ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> def compareRowCount ( self , dbRowCount ) : <EOL> """<STR_LIT>""" <EOL> browser = self . browser <EOL> elem = WebDriverWait ( browser , <NUM_LIT:30> ) . until ( <EOL> lambda driver : driver . find_element_by_id ( "<STR_LIT>" ) ) <EOL> htmlRowCount = len ( browser . find_elements_by_xpath ( "<STR_LIT>" ) ) <EOL> successMsg = "<STR_LIT>" "<STR_LIT>" % ( dbRowCount , htmlRowCount ) <EOL> failMsg = "<STR_LIT>" "<STR_LIT>" % ( dbRowCount , htmlRowCount ) <EOL> self . assertTrue ( dbRowCount == htmlRowCount , failMsg ) <EOL> self . reporter ( successMsg ) <EOL> def test_mem004_01_member_search_simple ( self ) : <EOL> """<STR_LIT>""" <EOL> self . start ( ) <EOL> self . browser . find_element_by_id ( "<STR_LIT>" ) . clear ( ) <EOL> self . browser . find_element_by_id ( "<STR_LIT>" ) . send_keys ( "<STR_LIT>" ) <EOL> self . browser . find_element_by_css_selector ( "<STR_LIT>" ) . click ( ) <EOL> member = current . s3db [ "<STR_LIT>" ] <EOL> person = current . s3db [ "<STR_LIT>" ] <EOL> dbRowCount = current . db ( ( member . deleted != '<STR_LIT:T>' ) & ( member . person_id == person . id ) & ( ( person . first_name . like ( '<STR_LIT>' ) ) | ( person . middle_name . like ( '<STR_LIT>' ) ) | ( person . last_name . like ( '<STR_LIT>' ) ) ) ) . count ( ) <EOL> self . compareRowCount ( dbRowCount ) <EOL> def test_mem004_02_member_search_advance_by_Paid ( self ) : <EOL> """<STR_LIT>""" <EOL> self . start ( ) <EOL> self . advancedSearchTest ( [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> member = current . s3db [ "<STR_LIT>" ] <EOL> rows = current . db ( ( member . deleted != '<STR_LIT:T>' ) ) . select ( ) <EOL> dbRowCount = <NUM_LIT:0> <EOL> for row in rows : <EOL> if row . paid ( ) == "<STR_LIT>" or row . paid ( ) == "<STR_LIT>" : <EOL> dbRowCount = dbRowCount + <NUM_LIT:1> <EOL> self . compareRowCount ( dbRowCount ) <EOL> def test_mem004_03_member_search_advance_by_Organisation ( self ) : <EOL> """<STR_LIT>""" <EOL> self . start ( ) <EOL> self . advancedSearchTest ( [ "<STR_LIT>" ] ) <EOL> member = current . s3db [ "<STR_LIT>" ] <EOL> org = current . s3db [ "<STR_LIT>" ] <EOL> dbRowCount = current . db ( ( member . deleted != True ) & ( member . organisation_id == org . id ) & <EOL> ( org . name == '<STR_LIT>' ) ) . count ( ) <EOL> self . compareRowCount ( dbRowCount ) <EOL> def test_mem004_04_member_search_advance_by_Country ( self ) : <EOL> """<STR_LIT>""" <EOL> self . start ( ) <EOL> self . advancedSearchTest ( [ "<STR_LIT>" ] ) <EOL> member = current . s3db [ "<STR_LIT>" ] <EOL> loc = current . s3db [ "<STR_LIT>" ] <EOL> dbRowCount = current . db ( ( member . deleted != '<STR_LIT:T>' ) & ( member . location_id == loc . id ) & ( loc . L0 == '<STR_LIT>' ) ) . count ( ) <EOL> self . compareRowCount ( dbRowCount ) <EOL> def test_mem004_05_member_search_advance_by_State_Province ( self ) : <EOL> """<STR_LIT>""" <EOL> self . start ( ) <EOL> self . advancedSearchTest ( [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> member = current . s3db [ "<STR_LIT>" ] <EOL> loc = current . s3db [ "<STR_LIT>" ] <EOL> dbRowCount = current . db ( ( member . deleted != '<STR_LIT:T>' ) & ( member . location_id == loc . id ) & ( ( loc . L1 == '<STR_LIT>' ) | ( loc . L1 == '<STR_LIT>' ) ) ) . count ( ) <EOL> self . compareRowCount ( dbRowCount ) <EOL> def test_mem004_06_member_search_advance_by_County_District ( self ) : <EOL> """<STR_LIT>""" <EOL> self . start ( ) <EOL> self . advancedSearchTest ( [ "<STR_LIT>" ] ) <EOL> member = current . s3db [ "<STR_LIT>" ] <EOL> loc = current . s3db [ "<STR_LIT>" ] <EOL> dbRowCount = current . db ( ( member . deleted != '<STR_LIT:T>' ) & ( member . location_id == loc . id ) & ( loc . L2 == '<STR_LIT>' ) ) . count ( ) <EOL> self . compareRowCount ( dbRowCount ) <EOL> def test_mem004_07_member_search_advance_by_City_Town_Village ( self ) : <EOL> """<STR_LIT>""" <EOL> self . start ( ) <EOL> self . advancedSearchTest ( [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> member = current . s3db [ "<STR_LIT>" ] <EOL> loc = current . s3db [ "<STR_LIT>" ] <EOL> dbRowCount = current . db ( ( member . deleted != '<STR_LIT:T>' ) & ( member . location_id == loc . id ) & ( ( loc . L3 == '<STR_LIT>' ) | ( loc . L3 == '<STR_LIT>' ) ) ) . count ( ) <EOL> self . compareRowCount ( dbRowCount ) </s>
