Problem:
Our automation scripts were originally written in Playwright for Windows and Linux. They used "test" instead of "step" for each section.
I'm using the following environment:
- Elastic using a synthetic monitor
- Browser monitor type
- Inserting steps using "Inline Script"
With Playwright, if 1 test fails, the others can run
With Elastic inline scripting, if 1 step fails, the others are skipped.
Note: I've tried using journeys within the inline script, but I'm having problems with the proper syntax.
I look forward to your feedback and advice.
==============
Example 1 - Using Playwright and "test".
It runs 4 times. If the first test fails, the other 7 will still run.
for (let user in userProfiles)
{
test('Enter Educator site'+user,async ({ page }) => {
await page.goto(urlLocation);
await page.locator('[placeholder="School/District"]').fill(userProfiles[user].domain);
await page.locator('[placeholder="Username"]').fill(userProfiles[user].user);
await page.locator('[placeholder="Password"]').fill(userProfiles[user].password);
await page.locator('button:has-text("Login")').click();
await expect(page.locator(userProfiles[user].location)).toContainText(userProfiles[user].schoolArea);
});
test('Logout'+user, async ({ page }) => {
await page.goto(urlLocation + "/Account/LogOff");
await page.waitForTimeout(3000);
expect(page.url().includes(urlLocationExit)).not.toEqual(false);
});
}
====================
Example 2 - Using Elastic inline with synthetic monitor and “step”.
This will run 8 steps. If the 1 step fails, the other 7 are skipped.
for (let user in userProfiles)
{
step('Launch Educator site'+user,async () => {
await page.goto(urlLocation);
});
step('Login - '+userProfiles[user].lastName,async () => {
await page.locator('[placeholder="School/District"]').fill(userProfiles[user].domain);
await page.locator('[placeholder="Username"]').fill(userProfiles[user].user);
await page.locator('[placeholder="Password"]').fill(userProfiles[user].password);
await page.locator('button:has-text("Login")').click();
element = await page.innerText(userProfiles[user].location);
expect(element.includes(userProfiles[user].schoolArea)).not.toEqual(false);
});
step('Logout - '+userProfiles[user].lastName, async () => {
await page.goto(urlLocation + "/Account/LogOff");
await page.waitForTimeout(3000);
expect(page.url().includes(urlLocationExit)).not.toEqual(false);
});
}