summaryrefslogtreecommitdiff
path: root/ishtar_common/tests.py
diff options
context:
space:
mode:
authorQuentinAndre <quentin.andre@imt-atlantique.net>2021-08-25 11:54:27 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-11-16 17:04:41 +0100
commit2fd7713af7cca592a59f9ce974e5b382f63b45b3 (patch)
tree486a128c0c607746f3136f8944f3587593d0320f /ishtar_common/tests.py
parent980e67ca5e9ab913fbf9d250d9d1a36c15959df7 (diff)
downloadIshtar-2fd7713af7cca592a59f9ce974e5b382f63b45b3.tar.bz2
Ishtar-2fd7713af7cca592a59f9ce974e5b382f63b45b3.zip
additional tests without nested tabs for testing the ui of basefinds
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r--ishtar_common/tests.py39
1 files changed, 31 insertions, 8 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index ca3b40303..1c757dd2a 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -3548,8 +3548,23 @@ class SeleniumTests(StaticLiveServerTestCase):
+ "window.scrollBy(0, elementTop-(viewPortHeight/2));",
element)
+ '''
+ arguments:
+ i is the number of the row (starting at 1)
+ target and source are a tuple of french/english slugs corresponding respectively to the slug of the item of
+ which we want some details and the slug of the item from which we launched the search
+ '''
+ def click_on_details(self, i, target, source=None):
+ table = '//table[contains(@id, ' + target[0] + ') or contains(@id, ' + target[1] + ')]'
+ if source:
+ table += '[contains(@id, ' + source[0] + ') or contains(@id, ' + source[1] + ')]'
+ details = table + '/tbody/' + '/tr[' + str(i) + ']/td/a[@class="display_details"]'
+ details = self.selenium.find_element_by_xpath(details)
+ self.scroll(details)
+ details.click()
+
def assertNotInDOM(self, xpath):
- self.selenium.implicitly_wait(5)
+ self.selenium.implicitly_wait(3)
try:
self.WebDriverWait(self.selenium, 2).until(
self.EC.visibility_of_element_located((self.By.XPATH, xpath))
@@ -3562,20 +3577,24 @@ class SeleniumTests(StaticLiveServerTestCase):
def assertMap(self, dic_base, slug_pk, features_collecs=None):
dic_base = {'type': 'FeatureCollection', 'features': [dic_base]}
- mapdivs = self.selenium.find_elements_by_class_name("window-map")
mapid = None
- for mapdiv in mapdivs:
- if slug_pk in mapdiv.get_attribute("id"):
- mapid = mapdiv.get_attribute("id")
- break
+ timeout = 20
+ t = time()
+ while not mapid and time()-t < timeout:
+ mapdivs = self.selenium.find_elements_by_class_name("window-map")
+ for mapdiv in mapdivs:
+ if slug_pk in mapdiv.get_attribute("id"):
+ mapid = mapdiv.get_attribute("id")
+ break
id = int(re.search(r'\d+$', mapid).group())
# TODO: use the map and not the map_features in the js function
if features_collecs:
self.WebDriverWait(self.selenium, 2).until(
self.EC.visibility_of_element_located((self.By.ID, "http-geo-items-ready-"+slug_pk))
)
- print(id)
+ print('id : ', id)
print('mapid : ', mapid)
+ print('slug_pk : ', slug_pk)
print(self.selenium.execute_script('return base_features_type(arguments[0])', mapid))
base_features, geo_items_feats = self.selenium.execute_script('return get_features_by_id(arguments[0])', mapid)
base_features['features'][0]['properties'].pop('name')
@@ -3586,4 +3605,8 @@ class SeleniumTests(StaticLiveServerTestCase):
if features_collecs:
print('feat : ', geo_items_feats)
print('dic : ', features_collecs)
- self.assertEqual(geo_items_feats, features_collecs)
+ try:
+ self.assertEqual(geo_items_feats, features_collecs)
+ except:
+ self.selenium.implicitly_wait(10000)
+ self.selenium.find_element_by_xpath('doesnet')