lesouffleur
v0.0.5
Published
Library to run Playwright codegen generated code with minimal modifications on Puppeteer
Readme
Le Souffleur
Playwright has really good codegen tool,
but you are stuck with Puppeteer. Then this library is what you need as it
allows to take code generated by Playwright's codegen and use it in Puppeteer
with minimal changes.
This is very early version that might be improved in the future. Here some ideas:
[x] Add tests
[ ] Add custom jest matchers.
codegengenerates matchers liketoContainTextortoBeVisiblethat are not supported by this library yet[ ] Allow to specify test id attribute (in current implementation
data-hookis used)[ ] Support more functions and cases. Only small subset of
codegengenerated code is supported now.
Installation
npm:
npm install -D lesouffleuryarn:
yarn add -D lesouffleurUsage
import { LeSouffleur } from 'lesouffleur';
const driver = new LeSouffleur(page); // <-- Puppeteer page here
await driver.getByTestId('some-test-id').click();
await driver.getByRole('button', { name: 'Increment' }).click();
await driver.getByText('Approve').click();Development
Since we are working on abstraction of Puppeteer here (no real Puppeteer types) make sure to write tests and, please, test with real product as well.
You can use dev version by linking it. E.g. using yarn you can do something like this:
yarn add lesouffleur@portal:./../../../lesouffleurThe goal is to make Puppeteer act like Playwright as much as possible thus try to mimic Playwright behaviour, e.g. read how actions work here: https://playwright.dev/docs/actionability
Misc
As both Playwright and Puppeteer is theatre related I simply chose name related to theatre as well. See this Wikipedia article: Prompter
