Benji York wrote:
Testbrowser Real
----------------
zc.testbrowser.real lets you use the testbrowser API to drive
a real web browser; at the moment Firefox (but we may add support for
others in the future). This lets you do testing of JavaScript heavy
web applications with testbrowser (and doctests, of course). I
envision people often beginning tests using the "regular" testbrowser,
realizing the test/documentation they want to write needs JS, and then
switching their test to use "real" and not having to change the
already written parts of the doctest.
Congratulations, guys! By the way, I think you really want to mention in
the docs that you need to
* install the MozDev extension for Firefox and
* start the MozRepl service (under the default port)
When running the 'real' tests, I get two failures, by the way.
Tracebacks are attached. The timeout problem could be machine-related,
but the first one looks like an actual failure.
Screen Shots
------------
One other feature of zc.testbrowser.real is the ability to save the
current web page to a PNG file. This should be very useful for
creating user manuals with embedded screen shots.
Neat!
Bikeshedding Request
--------------------
Even though I coined it, I don't really like the name "real". I'd
like suggestions that are short, pithy, and descriptive if anyone has
any. Along the same lines, any suggestions for a new name for
zc.testbrowser.browser (the classic testbrowser) would be appreciated
as well.
I suggest renaming 'zc.testbrowser.real' to 'z.t.firefox' or
'z.t.remotecontrol', depending on how tied it is to Firefox and how
realistic you think it would be to add support for other browsers in the
future.
I suppose 'zc.testbrowser.browser' could become 'z.t.python' (unless
that's not a good name to use for a module name). I can't really think
of a better name.
Feature suggestion
------------------
I hope that we can use this stuff in Zope soon. I suppose
zope.testbrowser could be made to depend on zc.testbrowser (unless you
guys changed APIs).
Then again, instead of having a testbrowser that's limited to the
zope.publisher (and ZPublisher, if you count the one in Five), it would
be *much* cooler to have one that simply talks WSGI. The zope.publisher
talks WSGI, so no problem making it work with Zope 3, and no problem
making it work with pretty much any other Python web framework.
I would actually like to investigate this at soonish. Since this isn't
Zope specific at all, would this still be a candidate for the
zc.testbrowser package? Or a separate package?
--
http://worldcookery.com -- Professional Zope documentation and training
[EMAIL PROTECTED]:~/dev/zc.testbrowser$ bin/test -vv --all
Running tests at all levels
Running unit tests:
Running:
test_file_upload (zc.testbrowser.tests)
test_strip_linebreaks_from_textarea (zc.testbrowser.tests)
test_submit_duplicate_name (zc.testbrowser.tests)
/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/README.txt
/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/README.txt
Failure in test /Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/README.txt
Failed doctest test for README.txt
File "/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/README.txt", line 0
----------------------------------------------------------------------
File "/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/README.txt", line
924, in README.txt
Failed example:
form = browser.getForm(name='one')
Exception raised:
Traceback (most recent call last):
File
"/Users/philipp/shared-eggs/tmpCYrHf_/zope.testing-3.5.1-py2.4.egg/zope/testing/doctest.py",
line 1356, in __run
File "<doctest README.txt[293]>", line 1, in ?
form = browser.getForm(name='one')
File "/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/real.py", line
315, in getForm
if index is None and not any([id, name, action]):
NameError: global name 'any' is not defined
/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/screen-shots.txt
Failure in test
/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/screen-shots.txt
Failed doctest test for screen-shots.txt
File "/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/screen-shots.txt",
line 0
----------------------------------------------------------------------
File "/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/screen-shots.txt",
line 3, in screen-shots.txt
Failed example:
browser.open('http://slashdot.org')
Exception raised:
Traceback (most recent call last):
File
"/Users/philipp/shared-eggs/tmpCYrHf_/zope.testing-3.5.1-py2.4.egg/zope/testing/doctest.py",
line 1356, in __run
File "<doctest screen-shots.txt[2]>", line 1, in ?
File "/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/real.py", line
176, in open
self.waitForPageLoad()
File "/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/real.py", line
165, in waitForPageLoad
raise RuntimeError('timed out waiting for page load')
RuntimeError: timed out waiting for page load
Ran 190 tests with 2 failures and 0 errors in 19.923 seconds.
Tests generated new (1) garbage:
[<socket._fileobject object at 0x22e8618>]
Tests with failures:
/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/README.txt
/Users/philipp/dev/zc.testbrowser/src/zc/testbrowser/screen-shots.txt
[EMAIL PROTECTED]:~/dev/zc.testbrowser$
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com