ScreenPyHQ / screenpy

Screenplay pattern base for Python automated UI test suites.
MIT License
28 stars 4 forks source link

An Action/Task's `beat` gravitas does not apply to inner `beat`s #55

Open perrygoy opened 1 year ago

perrygoy commented 1 year ago

Consider this simple Task:

class ExampleClick:
    ...
    @beat("{} clicks on something for an example.", gravitas=AIRY)
    def perform_as(self, the_actor: Actor) -> None:
        """Direct the Actor to do a click for an example in a Github issue."""
        the_actor.attempts_to(Click.on_the(self.example_target))

The beat on this Task has an AIRY gravitas, which any user would expect would apply to all the Performables performed within the task as well. But it does not. The Click contained within it will not have the gravitas of its parent, which will cause the default behavior to be taken (a logging.info message to be emitted, in the case of StdOutAdapter).

It would be very nice if the outer-most beat wrapping would "set" the gravitas for all of its inner beats and asides as well!

bandophahita commented 1 year ago

We might consider implementing an object that you can wrap actions to accomplish this:

actor(Gravitas.airy(ExampleClick(TARGET)))