jpulec / django-protractor Goto Github PK
View Code? Open in Web Editor NEWEasily run your protractor tests with django
License: MIT License
Easily run your protractor tests with django
License: MIT License
In order to get the protractor tests to pass, I have to run the dev server in a separate terminal. It would be better if it ran automatically like it does for python manage.py test
Currently getting a traceback when test runs via python manage.py protractor
:
Starting webdriver...
Creating test database for alias 'default'...
Starting server...
Process Process-1:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/multiprocessing/process.py", line 254, in _bootstrap
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/Users/me/.virtualenvs/sdj/lib/python3.4/site-packages/protractor/management/commands/protractor.py", line 111, in runserver
stdout=open(os.devnull, 'wb')
File "/Users/me/.virtualenvs/sdj/lib/python3.4/site-packages/django/core/management/__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "/Users/me/.virtualenvs/sdj/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 49, in execute
super(Command, self).execute(*args, **options)
File "/Users/me/.virtualenvs/sdj/lib/python3.4/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/Users/me/.virtualenvs/sdj/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 88, in handle
self.run(**options)
File "/Users/me/.virtualenvs/sdj/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 99, in run
self.inner_run(None, **options)
File "/Users/me/.virtualenvs/sdj/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
self.stdout.write("Performing system checks...\n\n")
File "/Users/me/.virtualenvs/sdj/lib/python3.4/site-packages/django/core/management/base.py", line 114, in write
self._out.write(force_str(style_func(msg)))
TypeError: 'str' does not support the buffer interface
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
........
Finished in 23.377 seconds
8 tests, 11 assertions, 0 failures
Running python manage.py protractor seems to work the first time.
It runs the tests and displays the following messages.
Starting webdriver...
Creating test database for alias 'default'...
.....etc
Destroying test database for alias 'default'...
Success
But it always fails the second time around, after poking around I noticed that the tests were actually being ran against the prod DB instead of test, hence the reason for the failing tests.
Not sure if this is a bug or if I configured it wrong?
The parser fails because BaseCommand has no longer such attribute as option_list
It's self explanatory but here is the exact traceback:
Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/home/antoni/.virtualenvs/djangotractor/local/lib/python2.7/site-packages/django/core/management/init.py", line 363, in execute_from_command_line
utility.execute()
File "/home/antoni/.virtualenvs/djangotractor/local/lib/python2.7/site-packages/django/core/management/init.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/antoni/.virtualenvs/djangotractor/local/lib/python2.7/site-packages/django/core/management/init.py", line 205, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/antoni/.virtualenvs/djangotractor/local/lib/python2.7/site-packages/django/core/management/init.py", line 40, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/antoni/.virtualenvs/djangotractor/local/lib/python2.7/site-packages/protractor/management/commands/protractor.py", line 16, in
class Command(BaseCommand):
File "/home/antoni/.virtualenvs/djangotractor/local/lib/python2.7/site-packages/protractor/management/commands/protractor.py", line 20, in Command
option_list = BaseCommand.option_list + (
AttributeError: type object 'BaseCommand' has no attribute 'option_list'
Change
option_list = BaseCommand.option_list + ...
to
def add_arguments(self, parser):
parser.add_argument('--protractor-conf',
action='store',
dest='protractor_conf',
default='protractor.conf.js',
help='Specify a destination for your protractor configuration'
)
...
It looks like it does the trick
Currently there is no way to load fixtures or setup initial data via factories. Would be a nice feature to add.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.