Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

test(e2e): bring the suite back to green on main and keep sessions alive for long runs (#21631)

zchpeterb555065095a4
diff --git a/frontend/tests/e2e/AGENTS.md b/frontend/tests/e2e/AGENTS.md
index 06604ce144..a219302601 100644
--- a/frontend/tests/e2e/AGENTS.md
+++ b/frontend/tests/e2e/AGENTS.md
@@ -72,6 +72,8 @@ Use `ControlOrMeta+a` (portable), not `Meta+a` (Mac-only) or `Control+a` (Linux/
Tailwind class substrings like `[class*='border border-gray']` break on any CSS refactor. If you need a new locator, add a `data-testid` attribute to the component. Existing class-based selectors are technical debt.
+Utility classes (`rounded-*`, `border-*`, `overflow-*`, `gap-*`) are presentation, and UI-guideline refactors rewrite them across the codebase at once. Before adding a `data-testid`, prefer role plus accessible name, or visible text scoped to fixture names the test owns. Product hook classes (`bb-*`) and third-party internals such as Monaco's `.view-lines` identify structure and may be used when no user-facing handle exists.
+
## Directory Layout
```
@@ -130,8 +132,10 @@ Get the correct port from `getInstance(env.instance)` rather than hardcoding the
- **`psql` dependency**: must be on PATH for DDL/DML setup.
- **Unix-like OS only**: the sample Postgres uses Unix sockets in `/tmp`.
- **Admin credentials**: hardcoded `[email protected]` / `12345678`. The first user created via `/v1/auth/signup` becomes workspace admin, so e2e signs up this fixture.
-- **First-run state**: the shared server has two members and a used sample, so it never shows the setup wizard. A spec that needs a workspace with one member and an unused sample starts its own with `startBareServer()` and stops it in `afterAll` (see `workspace-setup/workspace-setup.spec.ts`). That server has no license, so it is for free-plan behavior only.
-- **DBA fixture**: `[email protected]` / `12345678` is created during `globalSetup` and granted `roles/workspaceDBA`. Used as the second approver by plan-detail approval specs. If a spec needs additional users (developer, QA, etc.), provision them the same way in `mode-start-new-bytebase.ts` — don't assume they exist.
+- **First-run state**: the shared server has several members and a used sample, so it never shows the setup wizard. A spec that needs a workspace with one member and an unused sample starts its own with `startBareServer()` and stops it in `afterAll` (see `workspace-setup/workspace-setup.spec.ts`). That server has no license, so it is for free-plan behavior only.
+- **DBA fixture**: `[email protected]` / `12345678` is created during `globalSetup` and granted `roles/workspaceDBA`. Used as the second approver by plan-detail approval specs.
+- **Approver fixture**: `[email protected]` / `12345678` is created during `globalSetup` and granted `roles/workspaceAdmin`. It never edits a plan, so it is the approver when the author may not approve (`allow_last_plan_editor_approval=false`). If a spec needs additional users (developer, QA, etc.), provision them the same way in `mode-start-new-bytebase.ts` — don't assume they exist.
+- **Approval by the plan author**: the admin creates, edits, and approves its own plans, so it is both the issue creator and the last plan editor. A new project denies approval to both, through two separate settings. Enable both with `authorMayApprove(true)` from `plan-detail/plan-helpers.ts`, and snapshot and restore both fields.
## Assertions and regression coverage
diff --git a/frontend/tests/e2e/framework/api-client.ts b/frontend/tests/e2e/framework/api-client.ts
index 412f1683cc..28db92df81 100644
--- a/frontend/tests/e2e/framework/api-client.ts
+++ b/frontend/tests/e2e/framework/api-client.ts
@@ -799,12 +799,13 @@ export class BytebaseApiClient {
}>;
allowJustInTimeAccess?: boolean;
allowRequestRole?: boolean;
- // When license is installed, project.allow_self_approval defaults
- // to false → an issue's creator cannot approve their own issue
- // (403 "cannot approve because self-approval is not allowed for
- // this project"). Tests that have a single admin both create and
- // approve must flip this to true.
+ // Approval by the issue creator and by the last plan editor are
+ // separate, cumulative permissions, and a new project denies both
+ // ("cannot approve because self-approval is not allowed for this
+ // project" / "... the user is the last Plan editor"). A single admin
+ // who creates and approves a plan-backed issue needs both.
allowSelfApproval?: boolean;
+ allowLastPlanEditorApproval?: boolean;
// DATA_CLASSIFICATION config id the project uses. Must reference a config
// already defined in the DATA_CLASSIFICATION setting (UpdateProject
// validates it exists).
@@ -848,6 +849,10 @@ export class BytebaseApiClient {
fields.push("allow_self_approval");
body.allowSelfApproval = settings.allowSelfApproval;
}
+ if (settings.allowLastPlanEditorApproval !== undefined) {
+ fields.push("allow_last_plan_editor_approval");
+ body.allowLastPlanEditorApproval = settings.allowLastPlanEditorApproval;
+ }
if (settings.dataClassificationConfigId !== undefined) {
fields.push("data_classification_config_id");
body.dataClassificationConfigId = settings.dataClassificationConfigId;
diff --git a/frontend/tests/e2e/framework/mode-start-new-bytebase.ts b/frontend/tests/e2e/framework/mode-start-new-bytebase.ts
index 9228ebe9c2..59e31c6267 100644
--- a/frontend/tests/e2e/framework/mode-start-new-bytebase.ts
+++ b/frontend/tests/e2e/framework/mode-start-new-bytebase.ts
@@ -20,6 +20,12 @@ const DBA_EMAIL = "[email protected]";
const DBA_PASSWORD = "12345678"; // NOSONAR: e2e fixture
const DBA_TITLE = "DBA1";
const DBA_ROLE = "roles/workspaceDBA";
+// A second workspace admin who never edits a plan: the approver when the
+// author may not approve its own plan (allow_last_plan_editor_approval=false).
+const APPROVER_EMAIL = "[email protected]";
+const APPROVER_PASSWORD = "12345678"; // NOSONAR: e2e fixture
+const APPROVER_TITLE = "Approver1";
+const APPROVER_ROLE = "roles/workspaceAdmin";
let serverProcess: child_process.ChildProcess | undefined;
let tempDir: string | undefined;
@@ -59,7 +65,10 @@ export function cleanupOrphans(pidFile: string = PID_FILE): void {
fs.unlinkSync(pidFile);
}
-function checkPort(port: number): Promise<boolean> {
+// A port is free only when nothing answers on loopback, where the health
+// checks connect, and the server's own bind would succeed.
+async function checkPort(port: number): Promise<boolean> {
+ if (await isPortListening(port)) return false;
return new Promise((resolve) => {
const server = net.createServer();
server.once("error", () => resolve(false));
@@ -339,13 +348,24 @@ export async function startServer(): Promise<{
// is logged in. See frontend/tests/e2e/AGENTS.md for a dev license.
await api.uploadLicense(license);
- // Phase 3c: Provision the DBA fixture user that plan-detail approval
- // specs use as the second approver. The previous demo dump pre-seeded
- // additional users (dba1/dev1/qa1); now we create only what's actually
- // referenced. Add more fixtures here if new specs need them.
+ // Keep every browser session valid for the whole run. The setup project
+ // captures the admin's storage state once; access tokens default to one
+ // hour and refresh tokens are single-use, so after the first hour a context
+ // built from that state lands on the sign-in page and its spec fails on an
+ // unrelated element. Needs the license (sign-in frequency control) above.
+ await api.upsertSetting(
+ "WORKSPACE_PROFILE",
+ { workspaceProfile: { accessTokenDuration: "86400s" } },
+ "value.workspace_profile.access_token_duration",
+ );
+
+ // Phase 3c: Provision the fixture users the approval specs sign in as.
+ // Create only what a spec references; add more here, never inside a spec.
const { workspace } = await api.getActuatorInfo();
await api.createUser(DBA_EMAIL, DBA_PASSWORD, DBA_TITLE);
await api.addWorkspaceRoleMember(workspace, DBA_EMAIL, DBA_ROLE);
+ await api.createUser(APPROVER_EMAIL, APPROVER_PASSWORD, APPROVER_TITLE);
+ await api.addWorkspaceRoleMember(workspace, APPROVER_EMAIL, APPROVER_ROLE);
// Phase 4: Create the sample project and provision its instance on PORT+3.
const sampleProject = await api.createProject(
diff --git a/frontend/tests/e2e/issue-detail/issue-detail-targets.spec.ts b/frontend/tests/e2e/issue-detail/issue-detail-targets.spec.ts
index 5d11652455..efb25b99b6 100644
--- a/frontend/tests/e2e/issue-detail/issue-detail-targets.spec.ts
+++ b/frontend/tests/e2e/issue-detail/issue-detail-targets.spec.ts
@@ -145,18 +145,6 @@ test.describe("Targets 'View all' sheet scrolls to the last target on Plan Detai
.filter({ hasText: `Targets (${TARGET_COUNT})` });
await expect(sheet).toBeVisible({ timeout: 5000 });
- // The scroll container (min-h-0 flex-1 overflow-y-auto) must actually
- // overflow — sanity that we have enough rows to exercise the bug.
- const scrollRegion = sheet.locator("div.overflow-y-auto").first();
- await expect(scrollRegion).toBeVisible({ timeout: 5000 });
- const overflow = await scrollRegion.evaluate(
- (el) => el.scrollHeight - el.clientHeight,
- );
- expect(
- overflow,
- "the targets list must overflow its container (otherwise scroll can't be tested)",
- ).toBeGreaterThan(10);
-
// THE REGRESSION ORACLE: the last target row can be scrolled into the
// viewport. Pre-fix the Dialog had no functioning scroll container, so rows
// below the fold were unreachable → scrollIntoViewIfNeeded can't surface it
@@ -166,6 +154,24 @@ test.describe("Targets 'View all' sheet scrolls to the last target on Plan Detai
lastRow,
"the last target must be present in the (initially scrolled-off) list",
).toHaveCount(1);
+
+ // The list must actually overflow the element that scrolls it — sanity
+ // that we have enough rows to exercise the bug. The container is found
+ // from the row by computed style, not by a styling class.
+ const overflow = await lastRow.evaluate((el) => {
+ for (let node = el.parentElement; node; node = node.parentElement) {
+ const { overflowY } = getComputedStyle(node);
+ if (overflowY === "auto" || overflowY === "scroll") {
+ return node.scrollHeight - node.clientHeight;
+ }
+ }
+ return 0;
+ });
+ expect(
+ overflow,
+ "the targets list must overflow its container (otherwise scroll can't be tested)",
+ ).toBeGreaterThan(10);
+
await lastRow.scrollIntoViewIfNeeded();
await expect(
lastRow,
@@ -173,11 +179,11 @@ test.describe("Targets 'View all' sheet scrolls to the last target on Plan Detai
"popup was frozen and the bottom targets were unreachable)",
).toBeInViewport({ timeout: 5000 });
- // Anti-freeze: the in-sheet search narrows the list. Each target renders as
- // a `rounded-lg border` row inside the scroll region; at baseline there are
- // all 21 rows.
- const targetRows = scrollRegion.locator("div.rounded-lg.border");
- await expect(targetRows).toHaveCount(TARGET_COUNT, { timeout: 5000 });
+ // Anti-freeze: the in-sheet search narrows the list. Each target shows its
+ // database name as its own text, so the per-run prefix counts the listed
+ // targets: all 21 at baseline.
+ const targetNames = sheet.getByText(new RegExp(`^${DB_PREFIX}\\d{2}$`));
+ await expect(targetNames).toHaveCount(TARGET_COUNT, { timeout: 5000 });
const search = sheet.getByPlaceholder("Search").first();
await expect(search).toBeVisible({ timeout: 5000 });
@@ -185,8 +191,8 @@ test.describe("Targets 'View all' sheet scrolls to the last target on Plan Detai
await search.pressSequentially(LAST_DB, { delay: 15 });
// Filtering down to the single matching target proves the list is live
// (not a frozen popup).
- await expect(targetRows).toHaveCount(1, { timeout: 5000 });
- await expect(scrollRegion.getByText(LAST_DB, { exact: false })).toBeVisible();
+ await expect(targetNames).toHaveCount(1, { timeout: 5000 });
+ await expect(sheet.getByText(LAST_DB, { exact: false })).toBeVisible();
// Escape closes the sheet.
await page.keyboard.press("Escape");
diff --git a/frontend/tests/e2e/plan-detail/plan-detail-lifecycle.spec.ts b/frontend/tests/e2e/plan-detail/plan-detail-lifecycle.spec.ts
index 5a0e992336..f6f4d73f4b 100644
--- a/frontend/tests/e2e/plan-detail/plan-detail-lifecycle.spec.ts
+++ b/frontend/tests/e2e/plan-detail/plan-detail-lifecycle.spec.ts
@@ -56,6 +56,7 @@ import {
import { signInBrowserAs } from "../framework/sign-in";
import { PlanDetailPage } from "./plan-detail.page";
import {
+ authorMayApprove,
seedDraftPlan,
seedReviewPlan,
setPermissiveGates,
@@ -100,6 +101,7 @@ let originalProjectSettings: {
requireIssueApproval?: boolean;
requirePlanCheckNoError?: boolean;
allowSelfApproval?: boolean;
+ allowLastPlanEditorApproval?: boolean;
enforceSqlReview?: boolean;
forceIssueLabels?: boolean;
issueLabels?: IssueLabelSetting[];
@@ -136,15 +138,15 @@ const ADMIN_RULE = {
},
};
-// Mandatory single-step admin approval. allowSelfApproval decides whether the
-// admin creator is a candidate (true → "Review" action) or an observer
+// Mandatory single-step admin approval. `authorApproves` decides whether the
+// admin author is a candidate (true → "Review" action) or an observer
// (false → "Under review" pill).
-async function setApproval(allowSelfApproval: boolean): Promise<void> {
+async function setApproval(authorApproves: boolean): Promise<void> {
await env.api.deletePolicy(env.project, "tag").catch(() => {});
await env.api.updateProjectSettings(env.project, {
requireIssueApproval: true,
requirePlanCheckNoError: false,
- allowSelfApproval,
+ ...authorMayApprove(authorApproves),
enforceSqlReview: false,
forceIssueLabels: false,
});
@@ -193,6 +195,7 @@ test.beforeAll(async ({ browser }) => {
requireIssueApproval: !!project.requireIssueApproval,
requirePlanCheckNoError: !!project.requirePlanCheckNoError,
allowSelfApproval: !!project.allowSelfApproval,
+ allowLastPlanEditorApproval: !!project.allowLastPlanEditorApproval,
enforceSqlReview: !!project.enforceSqlReview,
forceIssueLabels: !!project.forceIssueLabels,
issueLabels: Array.isArray(project.issueLabels)
@@ -588,7 +591,7 @@ test.describe("Review advance is persona-scoped (R1/R2)", () => {
let planId = "";
test.beforeAll(async () => {
- // allowSelfApproval → admin (creator) IS the candidate.
+ // The author may approve → admin (creator) IS the candidate.
await setApproval(true);
const seeded = await seedReviewPlan(env, page, {
prefix: "E2E Hdr R1R2",
diff --git a/frontend/tests/e2e/plan-detail/plan-detail-review.spec.ts b/frontend/tests/e2e/plan-detail/plan-detail-review.spec.ts
index 7f8353511d..22ebbb8586 100644
--- a/frontend/tests/e2e/plan-detail/plan-detail-review.spec.ts
+++ b/frontend/tests/e2e/plan-detail/plan-detail-review.spec.ts
@@ -53,7 +53,11 @@ import { loadTestEnv, type TestEnv } from "../framework/env";
import { BytebaseApiClient, type IamPolicy } from "../framework/api-client";
import { signInBrowserAs } from "../framework/sign-in";
import { PlanDetailPage } from "./plan-detail.page";
-import { seedReviewPlan, waitForApprovalStatus } from "./plan-helpers";
+import {
+ authorMayApprove,
+ seedReviewPlan,
+ waitForApprovalStatus,
+} from "./plan-helpers";
test.setTimeout(180_000);
@@ -68,6 +72,7 @@ let originalProjectSettings: {
requireIssueApproval?: boolean;
requirePlanCheckNoError?: boolean;
allowSelfApproval?: boolean;
+ allowLastPlanEditorApproval?: boolean;
} = {};
let originalApproval: unknown = null;
const createdReviewConfigs: string[] = [];
@@ -108,14 +113,14 @@ async function goReview(planId: string): Promise<void> {
// Configure a mandatory single/multi-step approval flow (the common case for
// the review-action + flow describes). Clears any review-config tag first so a
-// prior describe's ERROR rule can't leak in. allowSelfApproval=true lets demo@
-// (the issue creator) approve their own issue for single-admin tests.
+// prior describe's ERROR rule can't leak in. authorMayApprove lets demo@ (the
+// issue creator and last plan editor) approve their own issue.
async function setupApproval(rule: object): Promise<void> {
await env.api.deletePolicy(env.project, "tag").catch(() => {});
await env.api.updateProjectSettings(env.project, {
requireIssueApproval: true,
requirePlanCheckNoError: false,
- allowSelfApproval: true,
+ ...authorMayApprove(true),
});
await env.api.upsertSetting(
"WORKSPACE_APPROVAL",
@@ -146,6 +151,7 @@ test.beforeAll(async ({ browser }) => {
requireIssueApproval: !!project.requireIssueApproval,
requirePlanCheckNoError: !!project.requirePlanCheckNoError,
allowSelfApproval: !!project.allowSelfApproval,
+ allowLastPlanEditorApproval: !!project.allowLastPlanEditorApproval,
};
originalApproval = (await env.api.getSetting("WORKSPACE_APPROVAL"))?.value ?? null;
@@ -427,6 +433,107 @@ test.describe("Permission boundary: non-candidate cannot review but can comment"
});
});
+// A new project denies approval by the last person who changed the plan
+// (allow_last_plan_editor_approval=false). Every other describe turns the
+// option on through authorMayApprove so the single admin can approve its own
+// plans; this one keeps it off and checks the rule from both sides of the
+// boundary: the editor (a candidate of the step) sees Approve disabled with
+// the reason and is refused by the API, can still reject, and a second admin
+// who never touched the plan approves as usual.
+test.describe("Last plan editor cannot approve while the project option is off", () => {
+ test.describe.configure({ mode: "serial" });
+ // The second workspace admin provisioned at server startup; it never edits
+ // a plan, so it is the approver this rule leaves.
+ const APPROVER_EMAIL = "[email protected]";
+ const APPROVER_PASSWORD = "12345678"; // NOSONAR: e2e fixture
+ let planId: string;
+ let issueName: string;
+
+ test.beforeAll(async () => {
+ await setupApproval(ONE_STEP_RULE);
+ await env.api.updateProjectSettings(env.project, {
+ allowSelfApproval: true,
+ allowLastPlanEditorApproval: false,
+ });
+ const seeded = await seedReviewPlan(env, page, {
+ prefix: "E2E Review LastEditor",
+ sql: `ALTER TABLE employee ADD COLUMN IF NOT EXISTS e2e_rev_le_${Date.now()} TEXT;`,
+ });
+ await waitForApprovalStatus(env.api, seeded.issueName, ["PENDING"]);
+ planId = seeded.planId;
+ issueName = seeded.issueName;
+ await goReview(planId);
+ });
+
+ test("the editor is a candidate, but Approve is disabled with the reason and the API refuses", async () => {
+ await expect(planPage.reviewBadge("Under review")).toBeVisible({
+ timeout: 15_000,
+ });
+ // The approval flow names the blocked candidate under the step.
+ await expect(
+ page.getByText("Can't approve — last changed this plan", { exact: false }),
+ ).toBeVisible();
+ // The Review action is still offered: the editor can comment or reject.
+ await planPage.reviewButton.click();
+ await page.getByText("Submit feedback and request changes").waitFor();
+ const approve = page.getByRole("radio", { name: /^Approve/ });
+ await expect(approve).toBeDisabled();
+ await page.getByText("Approve", { exact: true }).hover();
+ await expect(
+ page.getByText(
+ "You can't approve this issue because you were the last person to change its plan",
+ { exact: false },
+ ),
+ ).toBeVisible();
+ await page.keyboard.press("Escape");
+ // The server enforces the same rule.
+ await expect(env.api.approveIssue(issueName)).rejects.toThrow(
+ /last Plan editor/,
+ );
+ });
+
+ test("a second admin who never edited the plan approves it", async ({ browser }) => {
+ await signInBrowserAs(
+ browser,
+ env.baseURL,
+ APPROVER_EMAIL,
+ APPROVER_PASSWORD,
+ ".auth/approver-review.json",
+ );
+ const approverContext = await browser.newContext({
+ storageState: ".auth/approver-review.json",
+ });
+ try {
+ const approverPage = new PlanDetailPage(
+ await approverContext.newPage(),
+ env.baseURL,
+ );
+ await approverPage.goto(projectId, planId);
+ await approverPage.dismissModals();
+ await approverPage.expandSection("Review");
+ await expect(approverPage.reviewButton).toBeVisible({ timeout: 15_000 });
+ await approverPage.submitReview("Approve");
+ await expect(approverPage.reviewBadge("Approved")).toBeVisible({
+ timeout: 15_000,
+ });
+ } finally {
+ await approverContext.close();
+ }
+ });
+
+ test("the editor can still reject", async () => {
+ const seeded = await seedReviewPlan(env, page, {
+ prefix: "E2E Review LastEditor Reject",
+ sql: `ALTER TABLE employee ADD COLUMN IF NOT EXISTS e2e_rev_ler_${Date.now()} TEXT;`,
+ });
+ await waitForApprovalStatus(env.api, seeded.issueName, ["PENDING"]);
+ await goReview(seeded.planId);
+ await planPage.submitReview("Reject", "Add a default value before this can ship");
+ await expect(planPage.reviewBadge("Rejected")).toBeVisible({ timeout: 15_000 });
+ await expect(planPage.rejectionBanner).toBeVisible();
+ });
+});
+
// An integration approves through the API as a service account that holds a
// custom role (design doc: docs/design/approval-step-non-human-approvers.md).
// The step used to read "No reviewers".
@@ -650,12 +757,13 @@ test.describe("Inline comment threads (CUJ K)", () => {
});
// View in Statement lands on the anchored lines with the seeded thread
- // expanded, collapsing the thread created above.
+ // expanded. Threads expand independently (#21543), so the thread created
+ // above stays open beside it.
await reopened.getByRole("button", { name: "View in Statement" }).click();
const editorCard = planPage.threadCardIn("changes", seededRoot);
await expect(editorCard).toBeVisible({ timeout: 15_000 });
await expect(editorCard).toContainText(typedReply);
- await expect(planPage.threadCardIn("changes", createdRoot)).not.toBeVisible();
+ await expect(planPage.threadCardIn("changes", createdRoot)).toBeVisible();
});
});
@@ -713,7 +821,7 @@ test.describe("Bypass when approved but checks failed (CUJ F)", () => {
await env.api.updateProjectSettings(env.project, {
requireIssueApproval: false,
requirePlanCheckNoError: false,
- allowSelfApproval: true,
+ ...authorMayApprove(true),
});
await env.api.upsertSetting(
"WORKSPACE_APPROVAL",
@@ -761,7 +869,7 @@ test.describe("Waiting-review bypass link is gated by requireIssueApproval (CUJ
await env.api.updateProjectSettings(env.project, {
requireIssueApproval: true,
requirePlanCheckNoError: false,
- allowSelfApproval: true,
+ ...authorMayApprove(true),
});
await env.api.upsertSetting(
"WORKSPACE_APPROVAL",
@@ -806,7 +914,7 @@ test.describe("A mandatory project gate hard-blocks the bypass confirm", () => {
await env.api.updateProjectSettings(env.project, {
requireIssueApproval: false,
requirePlanCheckNoError: true,
- allowSelfApproval: true,
+ ...authorMayApprove(true),
});
await env.api.upsertSetting(
"WORKSPACE_APPROVAL",
@@ -855,7 +963,7 @@ test.describe("confirm sheet shows the skipped state in its review box (BYT-9745
await env.api.updateProjectSettings(env.project, {
requireIssueApproval: false,
requirePlanCheckNoError: false,
- allowSelfApproval: true,
+ ...authorMayApprove(true),
});
await env.api.upsertSetting(
"WORKSPACE_APPROVAL",
@@ -1010,9 +1118,13 @@ test.describe("Inline comment threads: composers, checkbox, walker, counts (CUJ
await expect(planPage.specUnresolvedCounts).toHaveCount(1, { timeout: 15_000 });
await expect(planPage.specUnresolvedCounts).toHaveText("2");
await expectReviewSummary("3 unresolved threads");
- await expect(planPage.threadWalker).toContainText("2");
- await expect(planPage.threadWalker).toHaveAttribute(
- "title",
+ // The walker reads "position/count" (#21543); its explanation is the
+ // aria-label of the count's tooltip trigger.
+ await expect(planPage.threadWalker).toContainText("/2");
+ await expect(
+ planPage.threadWalker.locator("[aria-label]").first(),
+ ).toHaveAttribute(
+ "aria-label",
"2 unresolved threads on this version · 1 more not shown on this version",
);
// Markers: A, B, and the resolved one; the stale thread has none.
@@ -1024,7 +1136,8 @@ test.describe("Inline comment threads: composers, checkbox, walker, counts (CUJ
await expect(planPage.threadCardIn("changes", rootA)).toBeVisible();
await planPage.threadWalkerNext.click();
await expect(planPage.threadCardIn("changes", rootB)).toBeVisible({ timeout: 10_000 });
- await expect(planPage.threadCardIn("changes", rootA)).not.toBeVisible();
+ // Stepping opens the next thread without closing the previous one (#21543).
+ await expect(planPage.threadCardIn("changes", rootA)).toBeVisible();
await planPage.threadWalkerNext.click();
await expect(planPage.threadCardIn("changes", rootA)).toBeVisible({ timeout: 10_000 });
await planPage.threadWalkerPrevious.click();
@@ -1238,6 +1351,7 @@ test.describe("Inline comment threads: ranges, shared markers, walker details, n
let issueName: string;
let specId: string;
let sheetSha256: string;
+ let earlierRootName = "";
let laterRootName = "";
const stamp = Date.now();
const earlierRoot = `M earlier root lines 4-5 ${stamp}`;
@@ -1265,7 +1379,8 @@ test.describe("Inline comment threads: ranges, shared markers, walker details, n
statementAnchor: { spec: specId, sheetSha256, startLine, endLine },
});
// Both end on line 5, so they share its marker.
- await env.api.createIssueComment(issueName, earlierRoot, anchor(4, 5));
+ const earlier = await env.api.createIssueComment(issueName, earlierRoot, anchor(4, 5));
+ earlierRootName = earlier.name;
const later = await env.api.createIssueComment(issueName, laterRoot, anchor(5, 5));
laterRootName = later.name;
await goReview(planId);
@@ -1297,15 +1412,31 @@ test.describe("Inline comment threads: ranges, shared markers, walker details, n
test("two threads ending on one line share a counted marker, and the stack expands either one", async () => {
const shared = planPage.statementEditor.locator(".bb-thread-glyph--count-2");
await expect(shared).toHaveCount(1);
- await shared.click();
- // The earliest unresolved thread expands; the other waits as a row.
+ // The marker toggles its own stack (#21543). The stack may already be open
+ // from the layer's mount, which expands the first unresolved thread, so
+ // open it only when it is not showing.
+ const stack = page
+ .locator("#plan-phase-changes [data-testid='thread-stack']")
+ .filter({ hasText: laterRoot });
+ if (!(await stack.isVisible().catch(() => false))) {
+ await shared.click();
+ }
+ await expect(stack).toBeVisible();
+ // Each thread in the stack opens on its own, and expanding one leaves the
+ // other open: both cards end up visible.
+ for (const [rootName, rootText] of [
+ [earlierRootName, earlierRoot],
+ [laterRootName, laterRoot],
+ ]) {
+ const row = planPage.collapsedThreadRow(rootName);
+ if (await row.isVisible().catch(() => false)) {
+ await expect(row).toContainText(rootText);
+ await row.click();
+ }
+ await expect(planPage.threadCardIn("changes", rootText)).toBeVisible();
+ }
await expect(planPage.threadCardIn("changes", earlierRoot)).toBeVisible();
- const laterRow = planPage.collapsedThreadRow(laterRootName);
- await expect(laterRow).toBeVisible();
- await expect(laterRow).toContainText(laterRoot);
- await laterRow.click();
await expect(planPage.threadCardIn("changes", laterRoot)).toBeVisible();
- await expect(planPage.threadCardIn("changes", earlierRoot)).not.toBeVisible();
});
test("the walker announces its position and yields the corner to the find widget", async () => {
@@ -1325,14 +1456,23 @@ test.describe("Inline comment threads: ranges, shared markers, walker details, n
test("a narrow viewport keeps the walker inside the editor's top-right corner and composers usable", async () => {
await page.setViewportSize({ width: 480, height: 1200 });
await expect(planPage.threadWalker).toBeVisible({ timeout: 10_000 });
- const editorBox = await planPage.statementEditor.boundingBox();
- const walkerBox = await planPage.threadWalker.boundingBox();
- expect(editorBox && walkerBox).toBeTruthy();
- if (editorBox && walkerBox) {
- expect(walkerBox.x + walkerBox.width).toBeLessThanOrEqual(editorBox.x + editorBox.width);
- expect(walkerBox.y).toBeGreaterThanOrEqual(editorBox.y);
- expect(walkerBox.y - editorBox.y).toBeLessThan(40);
- }
+ // The walker is a Monaco overlay widget, placed by Monaco's own layout a
+ // frame or more after the viewport changes, so wait for the corner.
+ await expect
+ .poll(
+ async () => {
+ const editorBox = await planPage.statementEditor.boundingBox();
+ const walkerBox = await planPage.threadWalker.boundingBox();
+ if (!editorBox || !walkerBox) return "missing box";
+ return {
+ rightEdgeInside: walkerBox.x + walkerBox.width <= editorBox.x + editorBox.width,
+ belowEditorTop: walkerBox.y >= editorBox.y,
+ nearEditorTop: walkerBox.y - editorBox.y < 40,
+ };
+ },
+ { timeout: 5_000 },
+ )
+ .toEqual({ rightEdgeInside: true, belowEditorTop: true, nearEditorTop: true });
const composer = await planPage.openInlineComposerOn(1);
await expect(composer.getByRole("button", { name: "Publish", exact: true })).toBeDisabled();
await composer.getByRole("button", { name: "Cancel" }).click();
diff --git a/frontend/tests/e2e/plan-detail/plan-detail-rollout.spec.ts b/frontend/tests/e2e/plan-detail/plan-detail-rollout.spec.ts
index 71466ac7fe..f96683862c 100644
--- a/frontend/tests/e2e/plan-detail/plan-detail-rollout.spec.ts
+++ b/frontend/tests/e2e/plan-detail/plan-detail-rollout.spec.ts
@@ -28,7 +28,11 @@ import { loadTestEnv, type TestEnv } from "../framework/env";
import { BytebaseApiClient } from "../framework/api-client";
import { createSubmittedDatabaseChangePlanViaUI } from "../framework/ui-create-plan";
import { PlanDetailPage } from "./plan-detail.page";
-import { resolveIssueName, waitForPlanChecksDone } from "./plan-helpers";
+import {
+ authorMayApprove,
+ resolveIssueName,
+ waitForPlanChecksDone,
+} from "./plan-helpers";
test.setTimeout(180_000);
@@ -42,6 +46,7 @@ let originalProjectSettings: {
requireIssueApproval?: boolean;
requirePlanCheckNoError?: boolean;
allowSelfApproval?: boolean;
+ allowLastPlanEditorApproval?: boolean;
} = {};
let originalApprovalSetting: unknown = null;
let createdReviewConfigs: string[] = [];
@@ -49,8 +54,9 @@ let createdReviewConfigs: string[] = [];
// Workspace approval rule used by the approval-gated tests. Single-step
// workspaceAdmin approval matched against `CHANGE_DATABASE` plans (the
// enum value covers DDL/DML — see proto `setting_service.proto`). The
-// admin who created the issue (env.adminEmail) can self-approve, which
-// is sufficient to verify the state transition without a second user.
+// admin who created the plan (env.adminEmail) approves it under
+// authorMayApprove, which is enough to verify the state transition without
+// a second user.
const APPROVAL_RULE = {
source: "CHANGE_DATABASE",
condition: { expression: "true" },
@@ -71,6 +77,7 @@ test.beforeAll(async ({ browser }) => {
requireIssueApproval: !!project.requireIssueApproval,
requirePlanCheckNoError: !!project.requirePlanCheckNoError,
allowSelfApproval: !!project.allowSelfApproval,
+ allowLastPlanEditorApproval: !!project.allowLastPlanEditorApproval,
};
// Snapshot WORKSPACE_APPROVAL so per-test mutations can be restored.
@@ -168,10 +175,7 @@ test.describe("Approval required, no plan-check gate", () => {
await env.api.updateProjectSettings(env.project, {
requireIssueApproval: true,
requirePlanCheckNoError: false,
- // Default with license is false → demo@ (issue creator) gets a
- // 403 trying to approve their own issue. We're doing single-
- // admin approval for test simplicity; flip on.
- allowSelfApproval: true,
+ ...authorMayApprove(true),
});
await env.api.upsertSetting(
"WORKSPACE_APPROVAL",
@@ -231,7 +235,7 @@ test.describe("Approval + plan-check gate with ERROR-level SQL review", () => {
await env.api.updateProjectSettings(env.project, {
requireIssueApproval: true,
requirePlanCheckNoError: true,
- allowSelfApproval: true,
+ ...authorMayApprove(true),
});
await env.api.upsertSetting(
"WORKSPACE_APPROVAL",
diff --git a/frontend/tests/e2e/plan-detail/plan-helpers.ts b/frontend/tests/e2e/plan-detail/plan-helpers.ts
index 1f9aaef67d..b2a0fd5505 100644
--- a/frontend/tests/e2e/plan-detail/plan-helpers.ts
+++ b/frontend/tests/e2e/plan-detail/plan-helpers.ts
@@ -21,6 +21,17 @@ function withTimeout<T>(p: Promise<T>, ms: number, label: string): Promise<T> {
]);
}
+// The admin in these specs creates, edits, and approves its own plans, so it is
+// both the issue creator and the last plan editor. Those are separate,
+// cumulative approval permissions that a new project denies, so they move
+// together; restore snapshots must cover both fields.
+export function authorMayApprove(allow: boolean): {
+ allowSelfApproval: boolean;
+ allowLastPlanEditorApproval: boolean;
+} {
+ return { allowSelfApproval: allow, allowLastPlanEditorApproval: allow };
+}
+
// Recover a plan's linked review-issue name from the Plan proto's OUTPUT_ONLY
// `issue` field. A UI-created plan's draft review issue is created together with
// the plan, so this is usually populated immediately — but poll briefly to
diff --git a/frontend/tests/e2e/sql-editor/sql-editor-connection.spec.ts b/frontend/tests/e2e/sql-editor/sql-editor-connection.spec.ts
index 67de2baf3d..fd171fc7e0 100644
--- a/frontend/tests/e2e/sql-editor/sql-editor-connection.spec.ts
+++ b/frontend/tests/e2e/sql-editor/sql-editor-connection.spec.ts
@@ -282,15 +282,16 @@ test.describe("SQL Editor entry from the database page connects the tab (BYT-961
await dbPage.keyboard.press("Escape").catch(() => {});
await dbPage.waitForTimeout(1500);
- // The "SQL Editor" entry is a <dd> (text = sql-editor.self) with onClick that
- // window.open's a new tab (DatabaseSQLEditorButton.tsx). Scope to the <dd>:
- // DashboardHeader also renders a "SQL Editor" *button* that, on a database
- // route, opens the SAME deep link — so a global getByText("SQL Editor")
- // .first() resolves to the header (it precedes the page content in the DOM,
- // confirmed: 2 exact matches, .first() = a SPAN inside a <button>), and the
- // test would pass even if this database-page entry were disabled or its
- // handler regressed. The <dd> locator exercises the intended entry point.
- const entry = dbPage.locator("dd").filter({ hasText: "SQL Editor" });
+ // The database page's entry is the "Open SQL Editor" link in its action bar
+ // (DatabaseSQLEditorButton.tsx), which opens the deep link in a new tab.
+ // DashboardHeader also renders a "SQL Editor" link to the SAME deep link on
+ // a database route, so match the page entry's full name exactly: a loose
+ // "SQL Editor" match would pass even if this entry were disabled or its
+ // handler regressed.
+ const entry = dbPage.getByRole("link", {
+ name: "Open SQL Editor",
+ exact: true,
+ });
await expect(entry).toBeVisible({ timeout: 10_000 });
const [popup] = await Promise.all([
diff --git a/frontend/tests/e2e/sql-editor/sql-editor-export.spec.ts b/frontend/tests/e2e/sql-editor/sql-editor-export.spec.ts
index 74e040c6ee..3620ba2c58 100644
--- a/frontend/tests/e2e/sql-editor/sql-editor-export.spec.ts
+++ b/frontend/tests/e2e/sql-editor/sql-editor-export.spec.ts
@@ -204,12 +204,19 @@ test.describe("Direct export when the policy allows it (C1, C9)", () => {
).toBeVisible({ timeout: 10_000 });
const drawer = await openExportDrawer();
await expect(drawer.getByText("Export format")).toBeVisible();
+ // The format is a Select whose list renders in a popup outside the drawer.
+ const formatSelect = drawer.getByRole("combobox");
+ await expect(formatSelect).toHaveText("CSV");
+ await formatSelect.click();
for (const fmt of ["CSV", "JSON", "SQL", "XLSX"]) {
await expect(
- drawer.getByRole("radio", { name: fmt, exact: true }),
- `format radio "${fmt}" must be offered`,
+ page.getByRole("option", { name: fmt, exact: true }),
+ `format option "${fmt}" must be offered`,
).toBeVisible();
}
+ // Re-pick the default to close the list without dismissing the drawer.
+ await page.getByRole("option", { name: "CSV", exact: true }).click();
+ await expect(formatSelect).toHaveText("CSV");
await expect(
drawer.getByText("Encrypt with password (Optional)"),
).toBeVisible();
diff --git a/frontend/tests/e2e/sql-editor/sql-editor-saved-query.spec.ts b/frontend/tests/e2e/sql-editor/sql-editor-saved-query.spec.ts
index b666825c30..e27c719b93 100644
--- a/frontend/tests/e2e/sql-editor/sql-editor-saved-query.spec.ts
+++ b/frontend/tests/e2e/sql-editor/sql-editor-saved-query.spec.ts
@@ -194,7 +194,7 @@ test.describe("Multi-select delete shows the dedicated confirm dialog (BYT-9631)
test("deleting two checked saved queries uses the multi-select dialog, not the non-empty-folder prompt", async () => {
test.setTimeout(120_000);
- await sqlEditor.gotoHome();
+ await sqlEditor.gotoSavedQueries();
await page.waitForTimeout(1000);
const tree = page.getByTestId("saved-query-tree");
@@ -336,7 +336,7 @@ test.describe("Duplicate", () => {
const projectPrefix = env.project;
const urlPromise = page.waitForURL(
(url) => {
- const m = url.pathname.match(/\/sheets\/([0-9a-f-]+)/i);
+ const m = url.pathname.match(/\/savedQueries\/([0-9a-f-]+)/i);
return !!m && m[1] !== sourceUuid;
},
{ timeout: 10_000 },
@@ -345,7 +345,7 @@ test.describe("Duplicate", () => {
await dialog.getByRole("button", { name: "Confirm", exact: true }).click();
await urlPromise;
- const newUuid = page.url().match(/\/sheets\/([0-9a-f-]+)/i)?.[1];
+ const newUuid = page.url().match(/\/savedQueries\/([0-9a-f-]+)/i)?.[1];
if (newUuid) {
duplicateSavedQuery = `${projectPrefix}/savedQueries/${newUuid}`;
}
@@ -397,7 +397,7 @@ test.describe("Right-click → Delete prompts for confirmation and removes the s
test.setTimeout(120_000);
const projectId = env.project.split("/").pop()!;
- await sqlEditor.gotoHome();
+ await sqlEditor.gotoSavedQueries();
await page.waitForTimeout(800);
// The saved query appears in the sidebar tree under "Mine" — find
@@ -476,7 +476,7 @@ test.describe("Sidebar search filters the saved query list", () => {
test('typing "needle" hides the non-matching saved query', async () => {
test.setTimeout(120_000);
- await sqlEditor.gotoHome();
+ await sqlEditor.gotoSavedQueries();
await page.waitForTimeout(800);
// Both saved queries visible at baseline.
@@ -539,7 +539,7 @@ test.describe("Mine / Shared / Draft folders collapse and re-expand", () => {
test("clicking Mine hides its children, clicking again restores them", async () => {
test.setTimeout(120_000);
- await sqlEditor.gotoHome();
+ await sqlEditor.gotoSavedQueries();
await page.waitForTimeout(800);
const child = page.getByTestId("saved-query-tree").getByText(TITLE).first();
diff --git a/frontend/tests/e2e/sql-editor/sql-editor.page.ts b/frontend/tests/e2e/sql-editor/sql-editor.page.ts
index 6ba14f2f28..e10888d2e5 100644
--- a/frontend/tests/e2e/sql-editor/sql-editor.page.ts
+++ b/frontend/tests/e2e/sql-editor/sql-editor.page.ts
@@ -1,4 +1,4 @@
-import { type Page, type Locator } from "@playwright/test";
+import { expect, type Page, type Locator } from "@playwright/test";
// Page object for the React-migrated SQL Editor.
// Replaces the helpers that previously lived alongside the Vue components.
@@ -114,6 +114,20 @@ export class SqlEditorPage {
await this.page.waitForLoadState("networkidle").catch(() => {});
}
+ // Home with the Saved queries pane open. The aside remembers the last
+ // visited tab per project in localStorage, so a session that ends on the
+ // Schema pane reopens there; specs that read the saved-query tree must not
+ // depend on that history.
+ async gotoSavedQueries() {
+ await this.gotoHome();
+ // One tree per folder (Mine, Shared, Draft); any of them proves the pane.
+ const tree = this.page.getByTestId("saved-query-tree").first();
+ if (!(await tree.isVisible({ timeout: 2000 }).catch(() => false))) {
+ await this.gutterSavedQueryTab.click();
+ }
+ await expect(tree).toBeVisible({ timeout: 10_000 });
+ }
+
async gotoWithDb(projectId: string, instanceId: string, dbName: string) {
// Direct DB URL avoids stale editor state from prior navigations.
await this.page.goto(
diff --git a/frontend/tests/e2e/workspace-setup/workspace-setup.spec.ts b/frontend/tests/e2e/workspace-setup/workspace-setup.spec.ts
index bcb95b5a87..e23e08b9f6 100644
--- a/frontend/tests/e2e/workspace-setup/workspace-setup.spec.ts
+++ b/frontend/tests/e2e/workspace-setup/workspace-setup.spec.ts
@@ -57,9 +57,6 @@ const openWizard = async (page: Page) => {
const choice = (page: Page, title: string) =>
page.locator("label", { hasText: title }).getByRole("radio");
-const nextStep = (page: Page) =>
- page.getByRole("region", { name: "Next step" });
-
const projectNames = async () =>
((await server.api.listProjects()).projects ?? []).map(({ name }) => name);
@@ -118,7 +115,8 @@ test("first-run setup: skip, no project, own instance, then the sample", async (
await expect(page.getByText(/Bytebase Cloud/)).toHaveCount(0);
await page.getByRole("button", { name: "I'll do this later" }).click();
- await page.waitForURL(/\/projects\?/);
+ // Leaving setup without a project lands on the workspace landing (#21594).
+ await page.waitForURL(/\/landing/);
expect(await projectNames()).toEqual(projectsBefore);
});
@@ -137,7 +135,8 @@ test("first-run setup: skip, no project, own instance, then the sample", async (
await page.getByText("2–10", { exact: true }).click();
await page.getByRole("button", { name: "Finish", exact: true }).click();
- await page.waitForURL(/\/projects\?/);
+ // Leaving setup without a project lands on the workspace landing (#21594).
+ await page.waitForURL(/\/landing/);
expect(await projectNames()).toEqual(projectsBefore);
});
@@ -181,10 +180,13 @@ test("first-run setup: skip, no project, own instance, then the sample", async (
await page.getByRole("button", { name: "Finish", exact: true }).click();
- await page.waitForURL(new RegExp(`/projects/${chosenId}$`));
+ // An own-instance setup finishes on the project's instances page, where
+ // the connect control carries the "Connect the instance" intro (#21594).
+ await page.waitForURL(new RegExp(`/projects/${chosenId}/instances`));
await expect(
- nextStep(page).getByRole("link", { name: "Connect an instance" })
+ page.getByRole("button", { name: "Connect instance" })
).toBeVisible();
+ await expect(page.getByText("Connect the instance")).toBeVisible();
});
await test.step("the sample path recovers from a create whose answer was lost and leads with the goal", async () => {
@@ -214,13 +216,13 @@ test("first-run setup: skip, no project, own instance, then the sample", async (
// The retry takes that project as its own and prepares the sample.
await page.getByRole("button", { name: "Try again" }).click();
- await page.waitForURL(new RegExp(`/projects/${chosenId}$`));
- await expect(nextStep(page).getByRole("link").first()).toHaveText(
- "Query a database"
- );
+ // The sample path finishes on the project's databases page; once the
+ // sample instance has synced, the intro leads with the query goal chosen
+ // above (#21594).
+ await page.waitForURL(new RegExp(`/projects/${chosenId}/databases`));
await expect(
- nextStep(page).getByRole("link", { name: "Change a database" })
- ).toBeVisible();
+ page.getByText("Database ready to query").first()
+ ).toBeVisible({ timeout: 90_000 });
expect((await projectNames()).sort()).toEqual(
[...projectsBefore, `projects/${chosenId}`].sort()
);
diff --git a/frontend/tests/e2e/workspace/workspace-general-settings.spec.ts b/frontend/tests/e2e/workspace/workspace-general-settings.spec.ts
index 92166a013d..8adadfaa7b 100644
--- a/frontend/tests/e2e/workspace/workspace-general-settings.spec.ts
+++ b/frontend/tests/e2e/workspace/workspace-general-settings.spec.ts
@@ -8,11 +8,11 @@
//
// Covers:
// - W1 wording + policy→UI: the retitled label and its description render
-// in the SQL Editor settings section, and the checkbox reflects the LIVE
-// workspace DATA_QUERY policy in both states (checked = export allowed
+// in the SQL Editor settings section, and the switch reflects the LIVE
+// workspace DATA_QUERY policy in both states (on = export allowed
// without approval = disableExport:false).
-// - W2 UI→policy wiring: unchecking + Update persists disableExport:true
-// (verified via the API, not just the UI), and re-checking + Update
+// - W2 UI→policy wiring: switching off + Update persists disableExport:true
+// (verified via the API, not just the UI), and switching on + Update
// restores it — both directions of the `checked={!disableExport}`
// inversion in SQLEditorSection.tsx.
//
@@ -57,15 +57,15 @@ async function setQueryDataPolicy(
});
}
-// The checkbox lives inside the FormField title span next to the label text
-// (SQLEditorSection.tsx renders `<Checkbox/>{label}<FeatureBadge/>` in one
+// The switch lives inside the FormField title span next to the label text
+// (SQLEditorSection.tsx renders `<Switch/>{label}<FeatureBadge/>` in one
// inline-flex span), so scope by that span rather than by accessible name —
// the label text is a sibling, not an aria label.
-function exportCheckbox() {
+function exportSwitch() {
return page
.locator("span", { hasText: EXPORT_LABEL })
.first()
- .getByRole("checkbox");
+ .getByRole("switch");
}
async function gotoGeneralSettings(): Promise<void> {
@@ -102,7 +102,7 @@ test.afterAll(async () => {
});
test.describe("data-export policy control wording and wiring", () => {
- test("the retitled checkbox and its description render, reflecting the live policy in both states (W1)", async () => {
+ test("the retitled switch and its description render, reflecting the live policy in both states (W1)", async () => {
// Known state first (own your fixtures): export allowed without approval.
await setQueryDataPolicy({ ...originalQueryDataPolicy, disableExport: false });
await gotoGeneralSettings();
@@ -114,23 +114,23 @@ test.describe("data-export policy control wording and wiring", () => {
/In projects that allow access grants, users can still click "Request export"/
)
).toBeVisible();
- await expect(exportCheckbox()).toBeChecked();
+ await expect(exportSwitch()).toBeChecked();
- // Flip the policy via API → a fresh load shows the checkbox unchecked.
+ // Flip the policy via API → a fresh load shows the switch off.
await setQueryDataPolicy({ ...originalQueryDataPolicy, disableExport: true });
await gotoGeneralSettings();
- await expect(exportCheckbox()).not.toBeChecked();
+ await expect(exportSwitch()).not.toBeChecked();
});
- test("unchecking + Update persists disableExport, re-checking restores it (W2)", async () => {
+ test("switching off + Update persists disableExport, switching on restores it (W2)", async () => {
// Start from export-allowed so the test owns its precondition.
await setQueryDataPolicy({ ...originalQueryDataPolicy, disableExport: false });
await gotoGeneralSettings();
- await expect(exportCheckbox()).toBeChecked();
+ await expect(exportSwitch()).toBeChecked();
- // Uncheck → the dirty bar's Update commits the policy.
- await exportCheckbox().click();
- await expect(exportCheckbox()).not.toBeChecked();
+ // Switch off → the dirty bar's Update commits the policy.
+ await exportSwitch().click();
+ await expect(exportSwitch()).not.toBeChecked();
await page.getByRole("button", { name: "Update", exact: true }).click();
await expect(
page.getByText("Configuration is updated.").first()
@@ -139,9 +139,9 @@ test.describe("data-export policy control wording and wiring", () => {
.poll(readDisableExport, { timeout: 10_000 })
.toBe(true);
- // Re-check → Update → the policy returns to export-without-approval.
- await exportCheckbox().click();
- await expect(exportCheckbox()).toBeChecked();
+ // Switch on → Update → the policy returns to export-without-approval.
+ await exportSwitch().click();
+ await expect(exportSwitch()).toBeChecked();
await page.getByRole("button", { name: "Update", exact: true }).click();
await expect
.poll(readDisableExport, { timeout: 10_000 })
diff --git a/frontend/tests/e2e/workspace/workspace-mcp-policy.spec.ts b/frontend/tests/e2e/workspace/workspace-mcp-policy.spec.ts
index f54d88cd75..4ec87b49c7 100644
--- a/frontend/tests/e2e/workspace/workspace-mcp-policy.spec.ts
+++ b/frontend/tests/e2e/workspace/workspace-mcp-policy.spec.ts
@@ -151,15 +151,19 @@ test.describe("MCP access policy capability ladder", () => {
// The chip names the policy without an "In force" label, and the audit
// fact belongs to the section description rather than to the current state.
await expect(page.getByText("In force")).toHaveCount(0);
+ await expect(page.getByText(COPY.policy.audit)).toHaveCount(1);
await expect(
- page.getByText(/^MCP policy denials are streamed to stdout/)
- ).toHaveCount(0);
- await expect(page.getByText(COPY.policy.description)).toBeVisible();
+ page.getByText(
+ COPY.policy.description
+ .replace("{{bound}}", COPY.policy.bound)
+ .replace("{{audit}}", COPY.policy.audit)
+ )
+ ).toBeVisible();
// Pinned as a literal, not read from the locale: this description carries
// the page's only audit disclosure, so the claim has to survive a copy edit
// that keeps the sentence and drops the clause.
await expect(
- page.getByText(/policy refusals are streamed to stdout when audit logging/)
+ page.getByText(/MCP operations are recorded in Bytebase audit logs/)
).toBeVisible();
// Connect a client carries the authentication clause; nothing repeats it