Hi,
I’m wondering if k6 has support for OAuth authentication with browser based tests. Trying to do a proof of concept with twitter’s site signing in with a google account and the execution seems to stop working
Hi,
I’m wondering if k6 has support for OAuth authentication with browser based tests. Trying to do a proof of concept with twitter’s site signing in with a google account and the execution seems to stop working
Hi @brandonc,
Yes, it should be able to follow the OAuth path. Have you scripted a test to see whether you run into any issues. Can you share it with us as well as the output when the test completes/fails?
Cheers,
Ankur
Hey @ankur, thanks for your response. I’ve posted my default testing function below. Some issues I ran into are:
When running the test script below, it generates an Uncaught (in promise) error: clicking on "iframe[title=\"Sign in with Google Button\"]": checking hit target: another element is intercepting with pointer action
Any insight on this issue would be greatly appreciated!
export default async function () {
const browser = chromium.launch({ headless: false });
const context = browser.newContext();
const page = context.newPage();
const loginModal = 'div[aria-labelledby="modal-header"]';
try {
await page.goto("https://twitter.com", { waitUntil: "networkidle" });
page.locator('a[href="/login"]').click();
page.locator(loginModal).waitFor({ state: "visible" });
check(page, {
"login modal is visible": page.locator(loginModal).isVisible(),
});
page.locator('iframe[title="Sign in with Google Button"]').click();
} finally {
page.close();
browser.close();
}
}
Hi @brandonc,
Aha, now i understand the issue. So you’ve hit upon two things that k6-browser doesn’t support:
iframe
yet. You could try a workaround using page.evaluate
, here’s a post that might help you: Locating elements within an iframe.Hope this helps a little bit,
Ankur