n8n/packages/testing/playwright/pages/OAuthConsentPage.ts
Ricardo Espinoza c3ca9a36da
feat(editor): Add scope selection to MCP OAuth consent screen (#33710)
Co-authored-by: Danny Martini <danny@n8n.io>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 13:21:14 +00:00

41 lines
1.2 KiB
TypeScript

import { BasePage } from './BasePage';
/**
* OAuth consent screen shown at /oauth/consent during the MCP OAuth
* authorization flow. The flow is entered by navigating the browser to the
* /mcp-oauth/authorize URL, which redirects here.
*/
export class OAuthConsentPage extends BasePage {
/** Enter the flow by navigating to the /mcp-oauth/authorize URL, which redirects here. */
async goto(authorizeUrl: string) {
await this.page.goto(authorizeUrl);
}
getConsentContent() {
return this.page.getByTestId('consent-content');
}
/**
* Tick the "I recognize and trust this URL" checkbox shown alongside the
* redirect URI warning. Allow is gated on this until the user acknowledges
* the destination they will be sent back to.
*/
async acknowledgeRedirectUri() {
await this.page.getByLabel('I recognize and trust this URL').click();
}
getScopesSelector() {
return this.page.getByTestId('consent-scopes');
}
/** Pick the "Read only" preset in the scope picker. */
async selectReadOnlyScopes() {
await this.clickByTestId('scopes-mode-read-only');
}
async allow() {
await this.acknowledgeRedirectUri();
await this.clickByTestId('consent-allow-button');
}
}