mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Removed selenium as a test dependency
This commit is contained in:
@@ -1,46 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from django.conf import settings
|
||||
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
|
||||
from django.test import TestCase
|
||||
from selenium import webdriver
|
||||
|
||||
# could use Chrome, Firefox, etc... here
|
||||
BROWSER = os.environ.get('TEST_BROWSER', 'PhantomJS')
|
||||
|
||||
|
||||
class BrowserTest(StaticLiveServerTestCase):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
settings.DEBUG = ('--debug' in sys.argv)
|
||||
|
||||
def setUp(self):
|
||||
if hasattr(webdriver, BROWSER):
|
||||
self.driver = getattr(webdriver, BROWSER)()
|
||||
else:
|
||||
self.driver = webdriver.Remote(
|
||||
desired_capabilities=webdriver.DesiredCapabilities.CHROME,
|
||||
command_executor=BROWSER
|
||||
)
|
||||
self.driver.set_window_size(1920, 1080)
|
||||
self.driver.implicitly_wait(10)
|
||||
|
||||
def tearDown(self):
|
||||
self.driver.quit()
|
||||
|
||||
def scroll_into_view(self, element):
|
||||
"""Scroll element into view"""
|
||||
y = element.location['y']
|
||||
self.driver.execute_script('window.scrollTo(0, {0})'.format(y))
|
||||
|
||||
def scroll_and_click(self, element):
|
||||
self.scroll_into_view(element)
|
||||
time.sleep(0.5)
|
||||
element.click()
|
||||
|
||||
|
||||
class SoupTest(TestCase):
|
||||
@@ -69,7 +28,6 @@ def extract_form_fields(soup):
|
||||
if field['type'] in ('checkbox', 'radio'):
|
||||
if field.has_attr('checked'):
|
||||
data[field['name']] = field.get('value', 'on')
|
||||
|
||||
continue
|
||||
else:
|
||||
# single element name/value fields
|
||||
|
||||
Reference in New Issue
Block a user