ScreenPyHQ / screenpy

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

aliases natural language logging doesn't match #76

Open bandophahita opened 1 year ago

bandophahita commented 1 year ago

Consider the following test using DoesNot (an alias of IsNot)

admin.shall(See(BrowserURL(), DoesNot(ContainsTheText("sortDirection"))))

will produce log

Marcel sees if the browser URL is not containing the text "sortField".

Would be nice if (in this case) the natural language log read the same way as the code.

Marcel sees if the browser URL does not contain the text "sortField".
bandophahita commented 1 year ago

My gut hunch is not all aliases have the same language problem, but this one stood out enough as awkward to read.

perrygoy commented 10 months ago

To catch this issue up with some Discord conversation, we were thinking about incorporating Natural Language Processing somehow to figure this stuff out. It would result in a complete overhaul of the whole .describe() approach, probably removing it entirely.

It will take some work and some toying, but it could be really really cool.

bandophahita commented 10 months ago

A nugget of an idea keeps nagging at me; perhaps aliases need to be copies rather than pointers.
Functionally IsNot and DoesNot would be the same. (could even have a shared base class), but code wise they would be separate classes. This would allow each class to maintain the natural language description to be used.

It would require some rework around how beat messages are crafted, but we already do some of that currently.

perrygoy commented 10 months ago

Yeah, that was part of the Discord/Slack discussion, we'd have like operative_word for the action word to be modified into different tenses for the beat, and use that in our NLP figurin'. That would remove the need for a .describe() method and allow us to basically use subclasses for our aliases with different operative_words to use.