virtual-cursor


Namevirtual-cursor JSON
Version 0.1 PyPI version JSON
download
home_page
SummaryWrite responsive web apps in full python
upload_time2023-08-17 20:43:48
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT License Copyright (c) 2023 Florian Scherf Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # virtual-cursor

![license MIT](https://img.shields.io/pypi/l/virtual-cursor.svg)
![Python Version](https://img.shields.io/pypi/pyversions/virtual-cursor.svg)
![Latest Version](https://img.shields.io/pypi/v/virtual-cursor.svg)

virtual-cursor adds human-like cursor animations to your browser tests.

Browser test libraries like [Selenium](https://www.selenium.dev/) or [Playwright](https://playwright.dev/) can be used to generate screenshots or videos of websites, which are great for debugging or as media for documentation.
Most of the times, these videos are not very useful, because the test code clicks much faster than a human and the cursor is invisible.

virtual-cursor emulates a cursor by injecting a custom JavaScript payload into the test browser, which animates a mocked, second cursor, and adds delays to slow down the [test code](tests/test_virtual_cursor.py).

![](doc/popup-desktop-chrome-dark.gif)

[Gallery](doc/gallery.md)


## Installation

virtual-cursor can be installed via pip

```
pip install virtual-cursor
```

## Usage

### pytest + playwright

See a full [example](tests/test_virtual_cursor.py) which produces the clip above.

```python
async def test_virtual_cursor():
    from playwright.async_api import async_playwright

    from virtual_cursor.playwright import click, fill, check, selectOption

    async with async_playwright() as playwright:
        browser = await playwright.chromium.launch()

        browser_context = await browser.new_context(
            record_video_dir='/tmp/videos/',
        )

        page = await browser_context.new_page()
        await page.goto('http://localhost')

        # click element
        await click(page, '#button')

        # fill out a text-input
        await fill(page, '#text-input', 'Lorem Ipsum')

        # select an option of a select
        await selectOption(page, '#select', 'Option 17')

        # check a checkbox
        await check(page, '#check-box')
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "virtual-cursor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Florian Scherf <mail@florianscherf.de>",
    "download_url": "https://files.pythonhosted.org/packages/f2/a5/17b51e579534e0aea4d166714a25d6b6138120c6a2649794896176159c64/virtual-cursor-0.1.tar.gz",
    "platform": null,
    "description": "# virtual-cursor\n\n![license MIT](https://img.shields.io/pypi/l/virtual-cursor.svg)\n![Python Version](https://img.shields.io/pypi/pyversions/virtual-cursor.svg)\n![Latest Version](https://img.shields.io/pypi/v/virtual-cursor.svg)\n\nvirtual-cursor adds human-like cursor animations to your browser tests.\n\nBrowser test libraries like [Selenium](https://www.selenium.dev/) or [Playwright](https://playwright.dev/) can be used to generate screenshots or videos of websites, which are great for debugging or as media for documentation.\nMost of the times, these videos are not very useful, because the test code clicks much faster than a human and the cursor is invisible.\n\nvirtual-cursor emulates a cursor by injecting a custom JavaScript payload into the test browser, which animates a mocked, second cursor, and adds delays to slow down the [test code](tests/test_virtual_cursor.py).\n\n![](doc/popup-desktop-chrome-dark.gif)\n\n[Gallery](doc/gallery.md)\n\n\n## Installation\n\nvirtual-cursor can be installed via pip\n\n```\npip install virtual-cursor\n```\n\n## Usage\n\n### pytest + playwright\n\nSee a full [example](tests/test_virtual_cursor.py) which produces the clip above.\n\n```python\nasync def test_virtual_cursor():\n    from playwright.async_api import async_playwright\n\n    from virtual_cursor.playwright import click, fill, check, selectOption\n\n    async with async_playwright() as playwright:\n        browser = await playwright.chromium.launch()\n\n        browser_context = await browser.new_context(\n            record_video_dir='/tmp/videos/',\n        )\n\n        page = await browser_context.new_page()\n        await page.goto('http://localhost')\n\n        # click element\n        await click(page, '#button')\n\n        # fill out a text-input\n        await fill(page, '#text-input', 'Lorem Ipsum')\n\n        # select an option of a select\n        await selectOption(page, '#select', 'Option 17')\n\n        # check a checkbox\n        await check(page, '#check-box')\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Florian Scherf  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Write responsive web apps in full python",
    "version": "0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/fscherf/virtual-cursor/issues",
        "Homepage": "https://github.com/fscherf/virtual-cursor",
        "Repository": "https://github.com/fscherf/virtual-cursor"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bfda95cd4f807660f64bee0ecf4731acd136d387f493e8839cbfe3707488e92",
                "md5": "b2bae9369988338e0f103c9ce5cd7a45",
                "sha256": "493a4cf851a2d31f3c17bd3ef837153ab5223eb01cecc59de708fdd2733ace82"
            },
            "downloads": -1,
            "filename": "virtual_cursor-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b2bae9369988338e0f103c9ce5cd7a45",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7928,
            "upload_time": "2023-08-17T20:43:46",
            "upload_time_iso_8601": "2023-08-17T20:43:46.517213Z",
            "url": "https://files.pythonhosted.org/packages/0b/fd/a95cd4f807660f64bee0ecf4731acd136d387f493e8839cbfe3707488e92/virtual_cursor-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2a517b51e579534e0aea4d166714a25d6b6138120c6a2649794896176159c64",
                "md5": "331cb2b196456d78db2ccd089d7c10ed",
                "sha256": "7be3d5d243ceff3a3c61f5ef1f1bee0da01245c53c5505a88662511191be9fcc"
            },
            "downloads": -1,
            "filename": "virtual-cursor-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "331cb2b196456d78db2ccd089d7c10ed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8602,
            "upload_time": "2023-08-17T20:43:48",
            "upload_time_iso_8601": "2023-08-17T20:43:48.528508Z",
            "url": "https://files.pythonhosted.org/packages/f2/a5/17b51e579534e0aea4d166714a25d6b6138120c6a2649794896176159c64/virtual-cursor-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-17 20:43:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fscherf",
    "github_project": "virtual-cursor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "virtual-cursor"
}
        
Elapsed time: 0.12618s