const { test, expect } = require("@playwright/test"); const { gotoOnion } = require("./personas"); exports.register = function (shared) { test("native: broker bypassed and PDS createSession accepts the deployed administrator (no oauth2)", async ({ page, playwright }) => { test.skip( process.env.SSO_SERVICE_ENABLED === "true", "Native login path only exists when oauth2 is disabled — when oauth2 is on, the broker owns provisioning and the OIDC test covers the journey.", ); const { baseUrl, adminHandle, adminPassword, pdsBaseUrl } = shared.env; expect(adminHandle, "ADMIN_HANDLE must be set when oauth2 is disabled").toBeTruthy(); expect(adminPassword, "ADMIN_PASSWORD must be set when oauth2 is disabled").toBeTruthy(); expect(pdsBaseUrl, "PDS_BASE_URL must be set when oauth2 is disabled").toBeTruthy(); const expectedBaseUrl = baseUrl.replace(/\/$/, ""); const landing = await gotoOnion(page, `${expectedBaseUrl}/`); expect(landing, "Expected bluesky landing response").toBeTruthy(); const landingBody = await landing.text(); expect( landingBody.includes("Refusing handoff"), "broker bypass: the front-proxy MUST NOT route through the login-broker when oauth2 is disabled", ).toBe(false); expect( /