-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding front end test login page
- Loading branch information
1 parent
05a6a62
commit 451cc32
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |