diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/static/js/ishtar-map.js | 2 | ||||
| -rw-r--r-- | ishtar_common/templates/blocks/action_list.html | 2 | ||||
| -rw-r--r-- | ishtar_common/tests.py | 65 | 
3 files changed, 30 insertions, 39 deletions
| diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js index d4eb7285d..56694772b 100644 --- a/ishtar_common/static/js/ishtar-map.js +++ b/ishtar_common/static/js/ishtar-map.js @@ -871,7 +871,7 @@ var get_map_by_id_test = function (id) {      console.log(map_layers[id][0].getSource())  } -var get_map_by_id = function (id) { +var get_features_by_id = function (id) {      if (vector_features[id] == null) {          var base_features = geojson_format.writeFeaturesObject(point_features[id], {decimals: 3});      } else { diff --git a/ishtar_common/templates/blocks/action_list.html b/ishtar_common/templates/blocks/action_list.html index 384082ad4..b2db52f84 100644 --- a/ishtar_common/templates/blocks/action_list.html +++ b/ishtar_common/templates/blocks/action_list.html @@ -1,7 +1,7 @@  <li class="nav-item dropdown">      <a class="nav-link dropdown-toggle"         data-toggle="dropdown" href="#" role="button" aria-haspopup="true" -       aria-expanded="false">{{section_label|safe}}</a> +       aria-expanded="false" id="dropdown-menu-main">{{section_label|safe}}</a>      <div class="dropdown-menu">          {% for label, url, has_children in sections %} diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index ac78cad02..9ed7394ea 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -47,7 +47,7 @@ from django.core.urlresolvers import reverse  from django.db.models.fields import BooleanField  from django.db.models.fields.related import ForeignKey  from django.template.defaultfilters import slugify -from django.test import TestCase as BaseTestCase +from django.test import tag, TestCase as BaseTestCase  from django.test.client import Client  from django.test.runner import DiscoverRunner @@ -3212,6 +3212,7 @@ class TemplateGenerationTest(TestCase):  from django.contrib.staticfiles.testing import StaticLiveServerTestCase  from selenium.webdriver.firefox.webdriver import WebDriver +@tag("ui")  class SeleniumTests(StaticLiveServerTestCase):      from selenium.webdriver.support.wait import WebDriverWait      from selenium.webdriver.common.by import By @@ -3251,46 +3252,36 @@ class SeleniumTests(StaticLiveServerTestCase):          self.selenium.find_element_by_xpath('//button[@type="submit"][@class="btn btn-primary"]').click()      def setUpDefaultGeoItems(self): -        from django.contrib.gis.geos import GEOSGeometry -        from ishtar_common.models_common import SpatialReferenceSystem -        from archaeological_finds.tests import GeomaticTest          from archaeological_operations.tests import create_operation +        from archaeological_finds.tests import GeomaticTest as GeomaticFindsTest          ope1 = create_operation(self.user)          ope2 = create_operation(self.user) +        GeomaticFindsTest.create_cr_with_bfs(ope1, "Point", "Point", ["Polygon", "Point"], "CR Pt Poly Pt") +        GeomaticFindsTest.create_cr_with_bfs(ope1, "Point", "Polygon", ["Polygon", "Point"], "CR Poly Poly Pt") +        GeomaticFindsTest.create_cr_with_bfs(ope2, "Polygon", "Point", ["Polygon", "Point"], "CR Pt Poly Pt") +        GeomaticFindsTest.create_cr_with_bfs(ope2, "Polygon", "Polygon", ["Polygon", "Point"], "CR Poly Poly Pt") + +        geom_ope = [ +            [[[[1, 1], [5, 1], [5, 5], [1, 5], [1, 1]], [[2, 2], [2, 3], [3, 3], [3, 2], [2, 2]]], +             [[[6, 3], [9, 2], [9, 4], [6, 3]]]], +            [3.86111, 3.02778], +            [3.8, 3] +        ] +        geom_cr = [ +            [[[[2, 1], [5, 1], [5, 5], [1, 5], [2, 1]], [[2, 2], [2, 3], [3, 3], [3, 2], [2, 2]]], +             [[[6, 3], [9, 2], [9, 4], [6, 3]]]], +            [3.86111, 3.02778], #TODO: change it +            [3.9, 3] +        ] +        geom_bf = [ +            [[[[2, 1], [4, 1], [4, 4], [1, 4], [2, 1]], [[2, 2], [2, 3], [3, 3], [3, 2], [2, 2]]], +             [[[6, 3], [9, 2], [9, 4], [6, 3]]]], +            [4.42105, 2.73684], +            [3.9, 2.9] +        ] +        return [geom_ope, geom_cr, geom_bf] -        wgs84 = SpatialReferenceSystem.objects.get(srid=4326) -        limit = ( -            "MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2))," -            "((6 3,9 2,9 4,6 3)))" -        ) -        geom = GEOSGeometry("POINT({} {} {})".format(2, 43, 1), srid=4326) -        geom_2d = GEOSGeometry("POINT({} {})".format(2, 43), srid=4326) -        xy = 2, 43 -        geom_params = [limit, geom, geom_2d, xy, wgs84] - -        ope1 = self.Operation.objects.get(pk=ope1.pk) -        ope1.multi_polygon = limit -        ope1.save() -        ope1 = self.Operation.objects.get(pk=ope1.pk) -        ope1.point = geom -        ope1.x, ope2.y = xy -        ope1.point_source = "P" -        ope1.spatial_reference_system = wgs84 -        ope1.point_source_item = "Operation" -        ope1.save() -        ope1 = self.Operation.objects.get(pk=ope1.pk) -        ope2.multi_polygon = limit -        ope2.save() - -        cr_pt1, (bf_poly_pt1, bf_pt_pt1) = GeomaticTest.create_cr_with_bfs(ope1, "Point", ["Polygon", "Point"], -                                                                           "CR Pt Poly Pt", geom_params) -        cr_poly1, (bf_poly_poly1, bf_pt_poly1) = GeomaticTest.create_cr_with_bfs(ope1, "Polygon", ["Polygon", "Point"], -                                                                                 "CR Poly Poly Pt", geom_params) -        cr_pt2, (bf_poly_pt2, bf_pt_pt2) = GeomaticTest.create_cr_with_bfs(ope2, "Point", ["Polygon", "Point"], -                                                                           "CR Pt Poly Pt", geom_params) -        cr_poly2, (bf_poly_poly2, bf_pt_poly2) = GeomaticTest.create_cr_with_bfs(ope2, "Polygon", ["Polygon", "Point"], -                                                                                 "CR Poly Poly Pt", geom_params)      def scroll(self, element):          self.selenium.execute_script(              "var viewPortHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);" @@ -3309,7 +3300,7 @@ class SeleniumTests(StaticLiveServerTestCase):              )          print(id)          print(self.selenium.execute_script('return print(arguments[0])', mapid)) -        base_features, geo_items_feats = self.selenium.execute_script('return get_map_by_id(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')          dic_base['features'][0]['properties']['id'] = id          print('feat : ', base_features) | 
