Now the only thing that remains are the tests. And I like to do the the tests with video . So this is the code
var ports = builder.AddPort()
.WithDeterministicPortEnvironment("sqliteweb", "mongodb")
.Construct();
var aspire = builder.AddAspireResource();
builder.AddSqlite("sqlite")
.WithSqliteWeb(c =>
{
c.WithHttpEndpoint(targetPort: 8080, name: "http", port: ports.Resource.GetDeterministicPort("sqliteweb"));
});
var project = builder.AddProject<Projects.ShowPort>("ShowPort")
.WithPortReference(ports);
and one test that verifies that the port for sqlite is ok
test("makeVideo", async ({ page }) => {
await page.screencast.start({ path: 'video.webm' ,});
await page.screencast.showActions({ position: 'top-right', duration: 1000, fontSize: 18 })
await page.screencast.showOverlays();
var indic1 = await page.screencast.showOverlay('Recordin');
console.log(`going to of ${DEFAULT_LOGIN_URL} page`);
await page.goto(DEFAULT_LOGIN_URL, { waitUntil: 'domcontentloaded' });
await page.waitForTimeout(3000);
await flashAndClick(page.getByText('PortResource'))
await page.goto(RESOURCE_URL, { waitUntil: 'domcontentloaded' });
await page.waitForTimeout(3000);
await flashAndClick(page.getByText('sqliteweb has port 54874'))
console.log(`Going to full ${Console_URL} page`);
await page.goto(Console_URL, { waitUntil: 'domcontentloaded' });
await page.waitForTimeout(3000);
await flashAndClick(page.getByText('PORT_sqliteweb 54874'));
});
The flashAndClick makes an error if cannot find the document
And this is the video generated