diff --git a/ojusomap/tests.py b/ojusomap/tests.py index 782dd0a..33bafe5 100644 --- a/ojusomap/tests.py +++ b/ojusomap/tests.py @@ -100,6 +100,60 @@ class MapTest(SeleniumTest): error_message = self.sl.find_element_by_class_name('has-error') self.assertTrue(error_message.is_displayed()) + def test_short_form_will_submit(self): + self.user = User.objects.create_superuser(username='test', password='test', email='test@example.com'); + self._open('/en-gb/case-study/create/short'); + self.sl.find_element_by_id('id_username').send_keys('test'); + self.sl.find_element_by_id('id_password').send_keys('test'); + self.sl.find_element_by_css_selector('input[type="submit"]').click() + self.sl.find_element_by_id('id_entry_name').send_keys('test'); + for i in range(0, 20): + self.sl.find_element_by_class_name('leaflet-control-zoom-in').click() + self.sl.find_element_by_class_name('leaflet-draw-draw-marker').click() + self.sl.find_element_by_id('id_location-map').click() + Select(self.sl.find_element_by_id('id_country')).select_by_visible_text('Albania'); + self.sl.find_element_by_id('id_area_of_land').send_keys('123'); + Select(self.sl.find_element_by_id('id_land_ownership')).select_by_visible_text('Private Land'); + Select(self.sl.find_element_by_id('id_location_context')).select_by_visible_text('Urban'); + self.sl.find_element_by_id('id_describe_ecosystem').send_keys('test'); + Select(self.sl.find_element_by_id('id_project_status')).select_by_visible_text('Existing Project'); + Select(self.sl.find_element_by_id('id_sector_of_economy')).select_by_visible_text('Power Grids'); + self.sl.find_element_by_id('id_synopsis').send_keys('test'); + self.sl.find_element_by_id('id_full_description').send_keys('test'); + Select(self.sl.find_element_by_id('id_positive_or_negative')).select_by_visible_text('Positive'); + self.sl.execute_script("window.scrollTo(0, document.body.scrollHeight);") + self.sl.find_element_by_id('submit-id-submit').click() + self.assertTrue("Thanks!" in self.sl.page_source, "Case study not successfully submitted") + + def test_long_form_will_submit(self): + self.user = User.objects.create_superuser(username='test', password='test', email='test@example.com'); + self._open('/en-gb/case-study/create/long'); + self.sl.find_element_by_id('id_username').send_keys('test'); + self.sl.find_element_by_id('id_password').send_keys('test'); + self.sl.find_element_by_css_selector('input[type="submit"]').click() + self.sl.find_element_by_id('id_entry_name').send_keys('test'); + for i in range(0, 20): + self.sl.find_element_by_class_name('leaflet-control-zoom-in').click() + self.sl.find_element_by_class_name('leaflet-draw-draw-marker').click() + self.sl.find_element_by_id('id_location-map').click() + Select(self.sl.find_element_by_id('id_country')).select_by_visible_text('Albania'); + self.sl.find_element_by_id('id_area_of_land').send_keys('123'); + Select(self.sl.find_element_by_id('id_land_ownership')).select_by_visible_text('Private Land'); + Select(self.sl.find_element_by_id('id_location_context')).select_by_visible_text('Urban'); + self.sl.find_element_by_id('id_describe_ecosystem').send_keys('test'); + Select(self.sl.find_element_by_id('id_project_status')).select_by_visible_text('Existing Project'); + self.sl.find_element_by_id('id_synopsis').send_keys('test'); + self.sl.find_element_by_id('id_full_description').send_keys('test'); + self.sl.find_element_by_id('id_project_owners').send_keys('test'); + self.sl.find_element_by_id('id_shareholders').send_keys('test'); + self.sl.find_element_by_css_selector('a[href="#technical-and-economic-analysis"]').click() + Select(self.sl.find_element_by_id('id_sector_of_economy')).select_by_visible_text('Power Grids'); + self.sl.find_element_by_css_selector('a[href="#socio-environmental-analysis"]').click() + Select(self.sl.find_element_by_id('id_positive_or_negative')).select_by_visible_text('Positive'); + self.sl.find_element_by_css_selector('a[href="#uploads"]').click() + self.sl.find_element_by_id('submit-id-submit').click() + self.assertTrue("Thanks!" in self.sl.page_source, "Case study not successfully submitted") + def test_map(self): self._open('/') WebDriverWait(self.sl, 5).until(