{ "info": { "author": "Asko Soukka", "author_email": "asko.soukka@iki.fi", "bugtrack_url": null, "classifiers": [ "Development Status :: 7 - Inactive", "Programming Language :: Python" ], "description": "Fast functional JavaScript testing with Zombie.js\r\n=================================================\r\n\r\nZombie.js_ is a fast headless browser with all the JavaScript support Node.js_\r\nprovides. This package provides a function decorator, which allows Python\r\ndoctest-style functional JavaScript testing using Python-like CoffeeScript.\r\n\r\n**Disclaimer:** This is mostly an experiment. This wouldn't ever replace your\r\nexisting Selenium-stack, because Zombie.js, even when it works, is just an\r\nanother browser with its own quirks.\r\n\r\n.. _Zombie.js: http://zombie.labnotes.org/\r\n.. _Node.js: http://nodejs.org/\r\n\r\n\r\nRequirements\r\n------------\r\n\r\n- a UNIX like environment\r\n- Node.js_ must be installed\r\n- npm_ must be installed\r\n- ``coffee-script``, ``zombie`` and ``async`` packages must be installed using\r\n npm\r\n- ``coffee``-executable must be found on the path\r\n\r\n.. _npm: http://npmjs.org/\r\n\r\nThe requirements should be filled, when you can run the following command on a\r\nconsole without it printing anything (returning any errors)::\r\n\r\n $ echo \"require 'zombie'; require 'async'\"|coffee -s\r\n\r\n\r\nExample of use (with ``plone.app.testing``)\r\n-------------------------------------------\r\n\r\nStart with defining a functional testing fixture with ZServer (that will run\r\nyour Plone on localhost:55001 by default)::\r\n\r\n from plone.app.testing import PLONE_FIXTURE\r\n from plone.app.testing import FunctionalTesting\r\n\r\n from plone.testing import z2\r\n\r\n FUNCTIONAL_TESTING = FunctionalTesting(\r\n bases=(PLONE_FIXTURE, z2.ZSERVER_FIXTURE), name=\"PloneFixture:ZServer\")\r\n\r\n\r\nThen write your functional JavaScript test as a doctest for your testmethod\r\nusing CoffeeScript instead of Python. Define the context (URL) of your test by\r\nusing the decorator (``@browser``) from ``collective.zombiedoctesting`` as\r\nshown below. You may use all the JavaScript that's provided by your context and\r\nthe global ``browser`` that represents Zombie.js' browser::\r\n\r\n import unittest\r\n\r\n from plone.app.testing import TEST_USER_NAME\r\n from plone.app.testing import TEST_USER_PASSWORD\r\n\r\n from collective.zombiedoctesting import browser\r\n\r\n constants = {\r\n \"TEST_USER_NAME\": TEST_USER_NAME,\r\n \"TEST_USER_PASSWORD\": TEST_USER_PASSWORD\r\n }\r\n\r\n\r\n class LoginOverlayTest(unittest.TestCase):\r\n\r\n layer = FUNCTIONAL_TESTING\r\n\r\n @browser(\"http://localhost:55001/plone/\", mapping=constants)\r\n def test_login(self):\r\n \"\"\"\r\n Let's start by looking up the login link using the jQuery available\r\n on our site:\r\n\r\n >>> console.log $(\"#personaltools-login\").text()\r\n Log in\r\n\r\n Clicking that link should not redirect us anywhere, but give us an\r\n AJAX overlay with a login form.\r\n\r\n >>> $(\"#personaltools-login\").click()\r\n >>> console.log window.location.href\r\n ... console.log $(\".pb-ajax #login-form\").text()\r\n http://localhost:55001/plone/\r\n Login Name\r\n Password\r\n\r\n Let's store that form as global (to be available between different\r\n doctest examples) and fill it...\r\n\r\n >>> global.form = $(\".pb-ajax #login-form\")\r\n ... form.find(\"#__ac_name\").val(\"%(TEST_USER_NAME)s\")\r\n ... form.find(\"#__ac_password\").val(\"%(TEST_USER_PASSWORD)s\")\r\n ... console.log form.find(\"#__ac_name\").val()\r\n ... console.log form.find(\"#__ac_password\").val()\r\n %(TEST_USER_NAME)s\r\n %(TEST_USER_PASSWORD)s\r\n\r\n ... and click the button to log in.\r\n\r\n >>> form.find(\"input[type='submit']\").click()\r\n >>> console.log window.location.href\r\n ... console.log browser.text(\".documentFirstHeading\")\r\n http://localhost:55001/plone/login_form\r\n You are now logged in\r\n\r\n Uh oh, we were properly logged in, but we were redirected also, so\r\n zombie is not a perfect browser yet.\r\n\r\n Also, notice, that we couldn't use jQuery in testing the document\r\n first heading (we used zombie's custom browser API), because the\r\n context after the click is an AJAX-response without jQuery or any\r\n other javascript.\r\n \"\"\"\r\n\r\nNote that every parsed doctest-example (a line starting with *>>>*) is executed\r\nseparately, but you may use Node.js' ``global`` to make variables available\r\nbetween doctest-examples.\r\n\r\nIf you'd like to see the complete JavaScript generated to be run with zombie,\r\nyou may add ``debug=True`` into ``@browser``-decorator call.\r\n\r\nChangelog\r\n---------\r\n\r\n\r\n1.1.0 \u2013 2011-10-30\r\n------------------\r\n\r\n- First (hopefully) non-broken release.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/datakurre/collective.zombiedoctesting/", "keywords": "corejet pivotal", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "collective.zombiedoctesting", "package_url": "https://pypi.org/project/collective.zombiedoctesting/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/collective.zombiedoctesting/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/datakurre/collective.zombiedoctesting/" }, "release_url": "https://pypi.org/project/collective.zombiedoctesting/1.1.0/", "requires_dist": null, "requires_python": null, "summary": "Fast functional JavaScript testing with Zombie.js", "version": "1.1.0" }, "last_serial": 712821, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "803acfa00d207c1cfe33dd1e20e4f099", "sha256": "f645b3e3343cec7d881a8eab7dd7b2a075d01658f4af0ee8f96cc197f140441e" }, "downloads": -1, "filename": "collective.zombiedoctesting-1.0.zip", "has_sig": false, "md5_digest": "803acfa00d207c1cfe33dd1e20e4f099", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7541, "upload_time": "2011-10-30T19:32:11", "url": "https://files.pythonhosted.org/packages/16/b9/c0d1518123d42e1a34ebc54d09dde2145d661736af2b12d1f9075e2f80f5/collective.zombiedoctesting-1.0.zip" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "d4981757f1054ef427cb1e65b30cffeb", "sha256": "36b19aa70754ab6538484382d77a1f7bfd66d2e38fae83c266c80b8eea564fde" }, "downloads": -1, "filename": "collective.zombiedoctesting-1.1.0.zip", "has_sig": false, "md5_digest": "d4981757f1054ef427cb1e65b30cffeb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16990, "upload_time": "2012-04-27T16:20:20", "url": "https://files.pythonhosted.org/packages/b1/82/8d0d397c7ae62ca02b7daf48a36db9bed350803d889a5f69206f154aaa0c/collective.zombiedoctesting-1.1.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d4981757f1054ef427cb1e65b30cffeb", "sha256": "36b19aa70754ab6538484382d77a1f7bfd66d2e38fae83c266c80b8eea564fde" }, "downloads": -1, "filename": "collective.zombiedoctesting-1.1.0.zip", "has_sig": false, "md5_digest": "d4981757f1054ef427cb1e65b30cffeb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16990, "upload_time": "2012-04-27T16:20:20", "url": "https://files.pythonhosted.org/packages/b1/82/8d0d397c7ae62ca02b7daf48a36db9bed350803d889a5f69206f154aaa0c/collective.zombiedoctesting-1.1.0.zip" } ] }