PuppeteerSharp.Replay is a .NET port of [https://github.com/puppeteer/replay]
dotnet add package PuppeteerSharp.Replay
You can use PuppeteerSharp.Replay to replay user flows recorded by Chrome's developer tools. The Recorder allows you to export your recordings as JSON files. You can easily play back those files like:
var flow = UserFlow.Parse(File.ReadAllText("everything.json"));
var runnerExt = new RunnerExtension(puppeteerBrowser, puppeteerPage);
var runner = await Runner.CreateRunner(flow, runnerExt);
await runner.Run();
Optionally, you can create user flows in code like:
var flow = new UserFlow()
{
Title = "Change Existing Input Value",
Steps = new Step[]
{
new Step()
{
Type = StepType.Navigate,
Url = $"{PuppeteerFixture.BaseUrl}/input.html"
},
new Step()
{
Type = StepType.Change,
Target = "main",
Selectors = new string[][] { new string[] { "#prefilled" } },
Value = "cba"
}
}
};
The current version of the user flow document spec does not have an "assert" action. It is recommended you create your Puppeteer browser and page objects in a way that allows you to re-use them to assert in your test. An example of using PuppeteerSharp.Replay with NUnit can be found in this repo's codebase.