limelight.scene
¶
Scene
¶
A page object for a single screen of a demo.
This class pairs a route with the assertions that prove the screen has loaded. A subclass sets the route and overrides expect_ready().
The protected helpers are the vocabulary an actor is written in. Each one performs an action through the demo and then holds, so a narrated run shows the drawn pointer land before the next step begins and a silent run pays nothing for the hold. A scene calls them rather than a Playwright locator method, because a bare click moves the real mouse without moving the drawn one.
class OrderScene(Scene):
route = 'sales:order:page:list'
def expect_ready(self) -> None:
expect(self.search_field).to_be_visible()
def search(self, text: str) -> None:
self._teach_focus(self.search_field, headline='Search', label='Search')
self._fill(self.search_field, text)
The constructor for the Scene class.
Parameters:
-
demo(Demo) –The demo that drives the browser for this scene.
Source code in limelight/scene.py
route = ''
class-attribute
instance-attribute
¶
demo = demo
instance-attribute
¶
expect_ready
¶
A method that waits until the scene has finished loading.
The base implementation does nothing, so a scene that needs to settle before the next step overrides this with its own assertions.
open
¶
A method that navigates to the scene route and waits for it to be ready.
Parameters:
-
query(Mapping[str, object] | None, default:None) –The query string parameters appended to the URL, or None for none.
-
url_kwargs(object, default:{}) –The arguments used to reverse the route into a URL.
Returns:
-
Self–The scene itself, so calls can be chained.
Raises:
-
ValueError–If the route has not been set on the subclass.