Quick Start¶
Overview¶
This page takes one test through a silent run, a narrated run, and a render. The test answers its own requests, so it needs no server.
Run A Test¶
-
Add the plugin to the root
conftest.py. -
Copy this test into your project.
examples/test_order_approval.pyfrom __future__ import annotations from typing import TYPE_CHECKING from playwright.sync_api import expect from limelight import Demo, StaticApplication if TYPE_CHECKING: from playwright.sync_api import Page, Route BASE_URL = 'http://shop.example.com' PAGE_HTML = """ <html><body> <h1>Order SHOP-214</h1> <button onclick="this.textContent = 'Approved'">Approve</button> </body></html> """ def order_serve(route: Route) -> None: route.fulfill(body=PAGE_HTML, content_type='text/html') def test_order_approval_demo(page: Page) -> None: page.route(f'{BASE_URL}/**', order_serve) application = StaticApplication(base_url=BASE_URL) demo = Demo(page, application, name='order-approval') demo.goto('/orders/SHOP-214') demo.title('Order Approval', subtitle='Draft to approved.') demo.narrate('Approve the order', body='Riley Chen signs off on SHOP-214.') demo.click(page.get_by_role('button', name='Approve')) expect(page.get_by_role('button', name='Approved')).to_be_visible() -
Run it silent. A silent run has no holds and writes nothing.
-
Run it narrated. The
--headedflag opens the window, becauseDEMO_MODEdoes not open one on its own. -
Render a video. The render needs
ffmpeg.
A narrated run writes to .demos/order-approval/, relative to the directory you ran it from. The name argument of the Demo names that directory.
The plugin fails a test whose page logs a console.error or throws an uncaught exception. The Configuration page shows how to allow one.