Skip to content

Commit 4203d89

Browse files
committed
[chores] Added organization setup for geo selenium test
The geo selenium tests were failing overall due to organization not being created for the device. Added organization mixin to solve this. Also added a temporary link to `django_loci` tarball in requirements.txt to tackle failing builds. Signed-off-by: DragnEmperor <[email protected]>
1 parent 71974f5 commit 4203d89

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

openwisp_controller/geo/tests/test_selenium.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
33
from django_loci.tests.base.test_selenium import BaseTestDeviceAdminSelenium
44
from selenium.webdriver.common.by import By
5+
from selenium.webdriver.support.ui import Select
56
from swapper import load_model
67

8+
from openwisp_users.tests.utils import TestOrganizationMixin
9+
710
Device = load_model('config', 'Device')
811
Location = load_model('geo', 'Location')
912
FloorPlan = load_model('geo', 'FloorPlan')
1013
DeviceLocation = load_model('geo', 'DeviceLocation')
1114

1215

13-
class TestDeviceAdminSelenium(BaseTestDeviceAdminSelenium, StaticLiveServerTestCase):
16+
class TestDeviceAdminSelenium(
17+
BaseTestDeviceAdminSelenium, TestOrganizationMixin, StaticLiveServerTestCase
18+
):
1419
app_label = 'geo'
1520
object_model = Device
1621
location_model = Location
@@ -24,7 +29,21 @@ def _get_prefix(cls):
2429
return cls.inline_field_prefix
2530

2631
def _create_device(self):
32+
org = self._get_org()
2733
self.find_element(by=By.NAME, value='mac_address').send_keys(
2834
'11:22:33:44:55:66'
2935
)
36+
self.find_element(
37+
by=By.CSS_SELECTOR, value='#select2-id_organization-container'
38+
).click()
39+
self.wait_for_invisibility(
40+
By.CSS_SELECTOR, '.select2-results__option.loading-results'
41+
)
42+
self.find_element(by=By.CLASS_NAME, value='select2-search__field').send_keys(
43+
org.name
44+
)
45+
self.wait_for_invisibility(
46+
By.CSS_SELECTOR, '.select2-results__option.loading-results'
47+
)
48+
self.find_element(by=By.CLASS_NAME, value='select2-results__option').click()
3049
super()._create_device()

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ django-reversion~=5.1.0
33
django-taggit~=6.0.0
44
netjsonconfig @ https://github.com/openwisp/netjsonconfig/tarball/1.2
55
django-x509 @ https://github.com/openwisp/django-x509/tarball/1.3
6-
django-loci @ https://github.com/openwisp/django-loci/tarball/1.2
6+
# temp for passing tests
7+
django-loci @ https://github.com/DragnEmperor/django-loci/tarball/chores/migrate-formset-function
78
django-flat-json-widget~=0.3.1
89
openwisp-users @ https://github.com/openwisp/openwisp-users/tarball/1.2
910
openwisp-utils[celery,channels] @ https://github.com/openwisp/openwisp-utils/tarball/1.2

0 commit comments

Comments
 (0)