Closed Fmstrat closed 1 year ago
As a note, this is what it looks like when I run the above test (in the framework I've created) which then provides return codes based on if success came back (page.pass
).
@Fmstrat thanks for contributing, and this is absolutely something we want to add. First response after reading your proposal:
For assertions, we would 99% sure use an existing assertion library, i.e. chai.js, Node's own assert and/or the Jest expect
function.
A right-click, "add assertion" workflow is exactly what I was thinking. Maybe even a custom in page menu to provide some more options.
Hi,
I think a nice feature of PR would be to include the ability to handle assertions. I.E:
"Confirm that a piece of content exists on a page after an action is taken."
I do this manually in Puppeteer with a variation of the below block of code (specifically the
page.assert
function).I think an amazing feature (that can be reused in your path forward even if it's not puppeteer as most apps, even playwrite, support this, would be to add a right click menu to include an assertion.
The process could work like this:
Add assertion
The code would then generate a shell with similar added
page
functions to the above, along with:Where for
assert
the first argument is what is being searched prefixed with "Found:", the second is the CSS selector of where that object is on the page, and the third is the actual text to search for.Much of the assert function from above can be leveraged, you already have the code to grab the CSS selector, it just requires the right-click functionality to be added.
Thoughts?