test(dashboard): align CSS-contract + onboarding tests with current contracts
Two long-standing test failures, root-caused and fixed.
terminal-mobile-keyboard-layout.test.ts (2 tests)
CSS structure changed: the desktop terminal modal moved its initial
width/height into companion `:not([style*="width"])` /
`:not([style*="height"])` rules so persisted resize values can win
over the default. The tests still searched the base block. Updated
the helpers to extract from each rule explicitly, asserting:
width: min(1800px, …) in the :not([style*="width"]) rule
max-width: calc(100vw - …) in the base rule
85vh somewhere in the :not([style*="height"]) rule
min-height + max-height: calc(100dvh - 40px) in the base rule
Same constraints, just reflecting the current selector layout.
ModelOnboardingModal.test.tsx (2 tests)
Component refactor (commit f3d918997) made the "what GitHub unlocks"
feature list conditional on `!isGitHubReady`, so the test that mocks
`authenticated: true` no longer sees "Import issues as tasks". And
the gh-CLI optional explanation copy was rewritten to "OAuth from
the dashboard is optional" instead of "OAuth integration in
Settings → Authentication is optional". Updated:
- "shows connected state": assert the new connected-state
sentence ("GitHub is connected — issue imports …") instead of
the now-hidden feature list line.
- "explains gh CLI auth": use getAllByText for the two-place
"GitHub CLI is already authenticated" copy and match the
current "OAuth from the dashboard is optional" sentence.
Also adds the missing `afterEach` import to silence its TS error.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import { render, screen, fireEvent, waitFor, act, within } from "@testing-library/react";
|
||||
import { ModelOnboardingModal } from "../ModelOnboardingModal";
|
||||
import type { AuthProvider } from "../../api";
|
||||
@@ -1182,7 +1182,14 @@ describe("ModelOnboardingModal", () => {
|
||||
|
||||
await navigateToGitHubStep();
|
||||
|
||||
expect(screen.getByText(/Import issues as tasks/)).toBeTruthy();
|
||||
// The "what GitHub unlocks" feature list is intentionally hidden when
|
||||
// GitHub is already connected — the modal renders a confirmation
|
||||
// sentence and the Disconnect control instead.
|
||||
expect(
|
||||
screen.getByText(
|
||||
/GitHub is connected — issue imports and pull request tracking are available/,
|
||||
),
|
||||
).toBeTruthy();
|
||||
expect(screen.getByTestId("onboarding-auth-status-github")).toBeTruthy();
|
||||
expect(screen.getByText("✓ Connected")).toBeTruthy();
|
||||
expect(screen.getByRole("button", { name: "Disconnect" })).toBeTruthy();
|
||||
@@ -1199,8 +1206,17 @@ describe("ModelOnboardingModal", () => {
|
||||
|
||||
await navigateToGitHubStep();
|
||||
|
||||
expect(screen.getByText(/GitHub CLI is already authenticated/)).toBeTruthy();
|
||||
expect(screen.getByText(/OAuth integration in Settings → Authentication is optional/)).toBeTruthy();
|
||||
// The new component renders the "GitHub CLI is already authenticated"
|
||||
// copy in two places: the top-level description sentence and inside
|
||||
// the optional-OAuth explanation block. Both are valid; just confirm
|
||||
// at least one match (use getAllByText since there are two).
|
||||
expect(
|
||||
screen.getAllByText(/GitHub CLI is already authenticated/).length,
|
||||
).toBeGreaterThan(0);
|
||||
// The optional-OAuth panel describes that dashboard OAuth is optional.
|
||||
expect(
|
||||
screen.getByText(/OAuth from the dashboard is optional/),
|
||||
).toBeTruthy();
|
||||
expect(screen.queryByTestId("onboarding-github-connect-cta")).toBeNull();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user