From 61758c87273c84d4cab6c74a0f9da91c88c710b0 Mon Sep 17 00:00:00 2001 From: huanghuoguoguo <60681390+huanghuoguoguo@users.noreply.github.com> Date: Sat, 17 Oct 2026 16:31:51 +0800 Subject: [PATCH 1/2] test(web): replace account source checks with browser assertions --- web/tests/e2e/account-oauth.spec.ts | 103 ++++++++++++ web/tests/e2e/bot-form-layout.spec.ts | 133 +++++++++++++++ web/tests/e2e/cloud-storage-privacy.spec.ts | 49 ++++++ web/tests/e2e/invitations.spec.ts | 4 + web/tests/e2e/owner-space-billing.spec.ts | 156 +++++++++++------- web/tests/e2e/plugin-page-auth.spec.ts | 120 ++++++++++++++ .../unit/cloud-new-account-entry.test.mjs | 19 --- .../unit/oss-account-space-billing.test.mjs | 39 ----- web/tests/unit/oss-cloud-ui-privacy.test.mjs | 108 ------------ 9 files changed, 504 insertions(+), 227 deletions(-) create mode 100644 web/tests/e2e/account-oauth.spec.ts create mode 100644 web/tests/e2e/bot-form-layout.spec.ts delete mode 100644 web/tests/unit/cloud-new-account-entry.test.mjs diff --git a/web/tests/e2e/account-oauth.spec.ts b/web/tests/e2e/account-oauth.spec.ts new file mode 100644 index 000000000..927fb0fda --- /dev/null +++ b/web/tests/e2e/account-oauth.spec.ts @@ -0,0 +1,103 @@ +import { expect, test } from '@playwright/test'; +import { installLangBotApiMocks } from './fixtures/langbot-api'; + +for (const invitation of [false, true]) { + test(`Cloud login starts standard OAuth, invitation=${invitation}`, async ({ + page, + }) => { + await installLangBotApiMocks(page); + await page.route('**/api/v1/system/info', (route) => + route.fulfill({ + json: { + code: 0, + data: { + edition: 'cloud', + deployment_mode: 'cloud', + cloud_service_url: 'https://space.langbot.app', + wizard_status: 'completed', + }, + }, + }), + ); + await page.route('**/api/v1/user/account-info', (route) => + route.fulfill({ + json: { + code: 0, + data: { + initialized: true, + password_login_enabled: false, + space_login_enabled: true, + authenticated_invitation_acceptance_enabled: true, + }, + }, + }), + ); + if (invitation) + await page.addInitScript(() => + sessionStorage.setItem( + 'langbot_pending_invitation_token', + 'invited-token', + ), + ); + let redirectUri: string | null = null; + await page.route('**/api/v1/user/space/authorize-url**', async (route) => { + redirectUri = new URL(route.request().url()).searchParams.get( + 'redirect_uri', + ); + await route.fulfill({ + json: { code: 0, data: { authorize_url: '/oauth-provider' } }, + }); + }); + await page.route('**/oauth-provider', (route) => + route.fulfill({ + contentType: 'text/html', + body: '