diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/static/js/ishtar-map.js | 2 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_geo_items.html | 2 | ||||
| -rw-r--r-- | ishtar_common/tests.py | 39 | 
3 files changed, 33 insertions, 10 deletions
| diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js index ab8096b06..aa7263f7f 100644 --- a/ishtar_common/static/js/ishtar-map.js +++ b/ishtar_common/static/js/ishtar-map.js @@ -558,7 +558,7 @@ var initialize_test_map = function (slug_pk) {      geo_items_features = {};      current_test = true;      if ($("#"+id).length === 0) { -        $("#display-geo-items").after('<div id="'+id+'">Ready!</div>'); +        $("#display-geo-items-for-" + slug_pk).after('<div id="'+id+'">Ready!</div>');      }      $("#"+id).hide();  } diff --git a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html index 33b3dc5ed..12e4b4ef0 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html @@ -1,7 +1,7 @@  {% load i18n window_field %}{% if PROFILE.mapping %}  {% if geo_item.point_2d or geo_item.multi_polygon %}  <dl class="col-12"> -    <dt id="display-geo-items">{% trans "Display geo items" %}</dt> +    <dt id="display-geo-items-for-{{geo_item.SLUG}}-{{geo_item.pk}}">{% trans "Display geo items" %}</dt>      <dd>          <fieldset>              {% if geo_item.SLUG == "operation" %} 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') | 
