-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21d7305
commit b582e6a
Showing
1 changed file
with
36 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,36 @@ | ||
import { check } from 'k6'; | ||
import { browser } from 'k6/x/browser'; | ||
|
||
export const options = { | ||
scenarios: { | ||
ui: { | ||
executor: 'shared-iterations', | ||
options: { | ||
browser: { | ||
type: 'chromium', | ||
}, | ||
}, | ||
}, | ||
}, | ||
thresholds: { | ||
checks: ["rate==1.0"] | ||
} | ||
} | ||
|
||
export default async function() { | ||
const page = browser.newPage(); | ||
page.setContent("<html><head><style></style></head><body>hello!</body></html>") | ||
await page.evaluate(() => { | ||
const shadowRoot = document.createElement('div'); | ||
shadowRoot.id = 'shadow-root'; | ||
shadowRoot.attachShadow({mode: 'open'}); | ||
shadowRoot.shadowRoot.innerHTML = '<p id="find">Shadow DOM</p>'; | ||
document.body.appendChild(shadowRoot); | ||
}); | ||
const shadowEl = page.locator("#find"); | ||
check(shadowEl, { | ||
"shadow element exists": (e) => e !== null, | ||
"shadow element text is correct": (e) => e.innerText() === "Shadow DOM", | ||
}); | ||
page.close(); | ||
} |