Skip to content

Commit

Permalink
Support Firefox driver, and change documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
luisza committed Sep 30, 2022
1 parent 4ce4ddc commit 83911bc
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 60 deletions.
68 changes: 17 additions & 51 deletions Readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,11 @@ Configure your settings
'chunked_upload',
'markitup',
]
USE_L10N = False
MARKITUP_FILTER = ('markdown.markdown', {'safe_mode': True})
MARKITUP_SET = 'markitup/sets/markdown/'
JQUERY_URL = None
DATE_INPUT_FORMATS=[
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y'
]
DATE_FORMAT= ['%d/%m/%Y',]
DATETIME_INPUT_FORMATS = [
'%m/%d/%Y %H:%M',
'%d/%m/%Y %H:%M',
'%Y-%m-%d %H:%M',
'%d/%m/%y %H:%M'
]
.. note:: Date format on Django uses localization and depends on USE_L10N, but we can not configure yet JS date widgets to change based on Django representation so USE_L10N need to be false.
Run migrations

Expand Down Expand Up @@ -113,43 +98,24 @@ In templates using base template

Take a look this file to note the template block that you can overwrite

widgets
Test
__________

There are several widgets implemented this is a list of what you can use

- TextInput
- NumberInput
- EmailInput
- URLInput
- PasswordInput
- Textarea
- TextareaWysiwyg (not working yet)
- DateInput
- DateTimeInput
- TimeInput
- CheckboxInput
- YesNoInput
- Select (jquery select2)
- SelectMultiple (jquery select2)
- SelectTail
- SelectMultipleTail
- RadioSelect
- NullBooleanSelect
- CheckboxSelectMultiple
- SplitDateTimeWidget (not ready)
- SplitHiddenDateTimeWidget (not ready)
- SelectDateWidget (not ready)
- PhoneNumberMaskInput
- DateMaskInput
- DateTimeMaskInput
- EmailMaskInput
- DateRangeTimeInput
- DateRangeInput
- AutocompleteSelect
- AutocompleteSelectMultiple
- Formset implementation
- Remote select2 views.
To run the all test use:

.. code:: bash
cd demo
python manage.py test
To run the responsive test use:

.. code:: bash
cd demo
python manage.py test demoapp.tests.selenium.responsive
Run the demo
---------------
Expand All @@ -176,4 +142,4 @@ ____________________________
Remember update the package version before make deploy it on server.


sudo apt install node-babel-cli npm webpack
sudo apt install node-babel-cli npm webpack
11 changes: 9 additions & 2 deletions demo/demoapp/tests/selenium/FullCalendar.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
from time import sleep

from django.urls import reverse
from selenium.webdriver.chrome.webdriver import WebDriver
#from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.by import By
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium.webdriver.support.expected_conditions import element_to_be_clickable
from selenium.webdriver.support.wait import WebDriverWait

from demoapp.models import Event, Calendar
from django.test import override_settings
from datetime import date, timedelta
Expand Down Expand Up @@ -49,6 +55,7 @@ def test_events_save(self):
url = self.live_server_url + str(reverse('calendar_view'))
self.selenium.get(url)
self.selenium.find_element(By.ID, 'id_title').send_keys('CalendarTest')
self.selenium.find_element(By.XPATH, '//input[@type="submit"]').click()
element = self.selenium.find_element(By.XPATH, '//input[@type="submit"]')
self.selenium.execute_script("arguments[0].click();", element)
assert len(self.events) == len(Calendar.objects.last().events)

3 changes: 2 additions & 1 deletion demo/demoapp/tests/selenium/StoryLine.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium.webdriver.chrome.webdriver import WebDriver
#from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.firefox.webdriver import WebDriver
from django.urls import reverse
from selenium.webdriver.common.by import By

Expand Down
3 changes: 2 additions & 1 deletion demo/demoapp/tests/selenium/StoryMap.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.urls import reverse

from selenium.webdriver.chrome.webdriver import WebDriver
#from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.by import By


Expand Down
3 changes: 2 additions & 1 deletion demo/demoapp/tests/selenium/TimeLine.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium.webdriver.chrome.webdriver import WebDriver
#from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.firefox.webdriver import WebDriver
from django.urls import reverse
from selenium.webdriver.common.by import By

Expand Down
7 changes: 6 additions & 1 deletion demo/demoapp/tests/selenium/responsive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
from django.conf import settings
import shutil
from Screenshot import Screenshot
from django.core.management import call_command

class ScreenshotSeleniumTest(StaticLiveServerTestCase):

@classmethod
def setUpClass(cls):
super(ScreenshotSeleniumTest, cls).setUpClass()
call_command('createdemo', verbosity=3)
call_command('demomenu', verbosity=3)


cls.timeout =10
cls.resolutions=[{'width': 1920,'height': 1080},
Expand Down Expand Up @@ -42,7 +47,7 @@ def setUpClass(cls):
cls.tmp = Path(settings.BASE_DIR) / 'tmp'
cls.folder = '%s/%dx%d' % (cls.tmp, cls.width, cls.height)
cls.dir = Path(settings.BASE_DIR) / cls.folder
cls.server_thread.port = 8012
#cls.server_thread.port = 8012
if not cls.tmp.exists():
cls.tmp.mkdir()

Expand Down
6 changes: 3 additions & 3 deletions djgentelella/static/gentelella/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ $.fn.listcrudrest = function(){
list.html(html);
}
$(btn).on('click', function(){
$(form).closest('.x_content').find('.alert').remove();
$(form).closest('.card').find('.alert').remove();
$.ajax({
url: url_add, // url where to submit the request
type : "POST", // type of action POST || GET
Expand Down Expand Up @@ -1062,10 +1062,10 @@ function build_select2_init(instance){
}
$(window).select2related('related', value.sort(compare));
});


}



function decore_select2 (data) {
// We only really care if there is an element to pull classes from
if (!data.element) {
Expand Down
2 changes: 2 additions & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
selenium==4.5.0
selenium-screenshot==2.0.0

0 comments on commit 83911bc

Please sign in to comment.