diff options
Diffstat (limited to 'archaeological_operations')
| -rw-r--r-- | archaeological_operations/tests.py | 43 | 
1 files changed, 18 insertions, 25 deletions
| diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 085897dea..8fc567c0d 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -4248,7 +4248,10 @@ class DocumentQATest(OperationInitTest, TestCase):  class SeleniumTestsOperations(SeleniumTests):      fixtures = OPERATION_FIXTURES -    def _test_operation(self, i, slug_pk, geojsons, label): +    def _test_operation(self, xpath, slug_pk, geojsons): +        self.wait_and_click(xpath) +        label = self.label_from_internal_id(slug_pk) +          get_poly_id = "get-poly-for-" + slug_pk          get_poly_label_id = "get-poly-label-for-" + slug_pk          disp_cr_id = "disp-cr-for-" + slug_pk @@ -4281,16 +4284,7 @@ class SeleniumTestsOperations(SeleniumTests):          }          ope_base = geojsons[label]["get_polys"] -        title = self.selenium.find_element_by_xpath( -            '//h3[text()="Rechercher une opération" or text()="Operation search"]' -        ) -        panel = title.find_element_by_xpath("./..") -        tbody = "./form" + "/div" * 7 + "/table/tbody" -        details = panel.find_element_by_xpath( -            tbody + "/tr[" + str(i) + ']/td/a[@class="display_details"]' -        ) -        self.scroll(details) -        details.click() +          self.WebDriverWait(self.selenium, self.waiting_time).until(              lambda driver: driver.find_element_by_xpath(                  '//dl[@class="col-12"]/dt[@id="display-geo-items-for-' + slug_pk + '"]' @@ -4392,17 +4386,16 @@ class SeleniumTestsOperations(SeleniumTests):          self.assertMap(ope_base, slug_pk)      def test_geo_items(self): -        pks, geojsons = self.pks_and_geojson() - -        self.access_from_dropdown('operation') -        ope = models.Operation.objects.get(pk=pks["Poly"]) -        slug_pk_poly = ope.SLUG + "-" + str(ope.pk) -        self._test_operation(2, slug_pk_poly, copy.deepcopy(geojsons), "Poly") - -        self.access_from_dropdown('operation') -        ope = models.Operation.objects.get(pk=pks["Pt"]) -        slug_pk_pt = ope.SLUG + "-" + str(ope.pk) -        self._test_operation(1, slug_pk_pt, copy.deepcopy(geojsons), "Pt") - -        # display both at the same time (1 is already displayed) -        self._test_operation(2, slug_pk_poly, geojsons, "Poly") +        geojsons = self.default_geojson() +        slug = "operation" +        self.access_from_dropdown(slug) +        from_table = self.pks_and_details_from_table(slug) +        for pk, xpath in from_table: +            self.access_from_dropdown(slug) +            slug_pk = slug + "-" + str(pk) +            self._test_operation(xpath, slug_pk, copy.deepcopy(geojsons)) +        # display both at the same time +        self.access_from_dropdown(slug) +        for pk, xpath in from_table: +            slug_pk = slug + "-" + str(pk) +            self._test_operation(xpath, slug_pk, copy.deepcopy(geojsons)) | 
