Skip to content

Commit

Permalink
feat: adding front end test login page
Browse files Browse the repository at this point in the history
  • Loading branch information
DjalmaHenry committed May 13, 2023
1 parent 05a6a62 commit 451cc32
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions loginUserFrontEnd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { chromium } from "k6/experimental/browser";
import { check } from "k6";

export const options = {
vus: 3,
duration: "5s",
thresholds: {
checks: ["rate > 0.99"],
},
};

export default async function () {
const browser = chromium.launch({ headless: false });
const page = browser.newContext().newPage();

try {
await page.goto("https://test-api.k6.io", { waitUntil: "networkidle" });

await Promise.all([
page.waitForNavigation(),
page.locator('a[href="/my_messages.php"]').click(),
]);

page.locator('input[name="login"]').fill("admin");
page.locator('input[name="password"]').fill("123");

await Promise.all([
page.waitForNavigation(),
page.locator('input[type="submit"]').click(),
]);

check(page, {
header: page.locator("h2").textContent() === "Welcome, admin!",
});
} finally {
page.close();
browser.close();
}
}

0 comments on commit 451cc32

Please sign in to comment.