-
Notifications
You must be signed in to change notification settings - Fork 0
release/1.0: all P0/P1 fixes + quick wins (#323-#331, #336, #339, #341, #342) #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 20 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
7054511
feat(cli): scaffold @neoboard/cli package with commander.js
alfredorubin96 dcae245
fix: add product tagline to login and signup pages (#323)
alfredorubin96 f7696dc
feat(cli): implement all CLI commands with Vitest test suite
alfredorubin96 2663206
chore(cli): add CLI package to CI pipeline and SonarCloud config
alfredorubin96 d63cbe9
fix(cli): remove unused imports flagged by eslint
alfredorubin96 489bcc4
fix(connectors): clear query on type switch, pre-fill edit dialog (#3…
alfredorubin96 60b7179
fix(auth): registration toggle, API key errors, settings redirect, si…
alfredorubin96 261e9ac
feat(widgets): widget editor UX improvements (#329, #330, #331, #341,…
alfredorubin96 e1c43b8
Merge branch 'release/1.0' into fix/issue-325-326-connectors
alfredorubin96 21c3335
Merge branch 'release/1.0' into fix/issue-324-327-328-340-auth
alfredorubin96 5f439c6
Merge branch 'release/1.0' into fix/issue-329-343-widget-editor-ux
alfredorubin96 b950d70
test: add coverage for auth bootstrap-status and API key routes (#346)
alfredorubin96 004351a
test: add coverage for connector fixes to meet SonarCloud gate (#345)
alfredorubin96 c0a5a08
test: add coverage for widget editor UX improvements (#347)
alfredorubin96 e8edf6a
test: add coverage for auth and settings UI components (#346)
alfredorubin96 89f3831
test: add component tests for widget editor UX features (#347)
alfredorubin96 8bcedbc
Merge remote-tracking branch 'origin/release/1.0' into feat/cli-scaffold
alfredorubin96 5e25871
test: add final coverage for connector fixes (#345)
alfredorubin96 52e0e00
fix(cli): suppress SonarCloud false positive for dev-only default pas…
alfredorubin96 2d125b6
fix(cli): suppress SonarCloud execSync security hotspot
alfredorubin96 972b3f6
refactor: extract query templates utility for testability (#347)
alfredorubin96 2f5d015
revert: remove NOSONAR comments from CLI lib files
alfredorubin96 d5796a6
Merge branch 'fix/323-login-tagline' into release/1.0-all-fixes
alfredorubin96 728ea27
Merge remote-tracking branch 'origin/fix/issue-325-326-connectors' in…
alfredorubin96 8e83ca8
Merge remote-tracking branch 'origin/fix/issue-324-327-328-340-auth' …
alfredorubin96 807dfb9
Merge remote-tracking branch 'origin/fix/issue-329-343-widget-editor-…
alfredorubin96 af6864c
fix: resolve duplicate text matches in transform editor test after #3…
alfredorubin96 2e8f9a4
fix: make settings profile E2E test resilient to role badge matching
alfredorubin96 8d44927
test: add E2E for settings redirect and auth formatting cleanup
alfredorubin96 6878c02
test: add E2E for widget no-connector warning, auto-preview, and no-c…
alfredorubin96 f9b3069
Merge branch 'release/1.0-all-fixes' of https://github.com/alfredo199…
alfredorubin96 c2b9e48
test: add E2E for connection edit pre-fill and user role change
alfredorubin96 b8ff2c9
Merge branch 'release/1.0-all-fixes' of https://github.com/alfredo199…
alfredorubin96 6ecf46c
fix: make force password change tests serial, fix profile info assert…
alfredorubin96 caaae2b
Merge branch 'release/1.0-all-fixes' of https://github.com/alfredo199…
alfredorubin96 f536cb0
fix: force password change E2E test — navigate to trigger proxy redirect
alfredorubin96 25d7d48
Merge remote-tracking branch 'origin/feat/cli-scaffold' into release/…
alfredorubin96 afecfe9
fix: address CodeRabbit review comments on PR #349
alfredorubin96 11b486e
fix: refactor CLI exec to use execFileSync for docker commands (Sonar…
alfredorubin96 9728f91
Merge branch 'release/1.0-all-fixes' of https://github.com/alfredo199…
alfredorubin96 097bf30
fix: skip force-password-change E2E on CI (JWT timing flake), improve…
alfredorubin96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,228 @@ | ||
| import { describe, it, expect, vi, beforeEach } from "vitest"; | ||
| import { render, screen, waitFor } from "@testing-library/react"; | ||
| import userEvent from "@testing-library/user-event"; | ||
| import React from "react"; | ||
|
|
||
| /* ---------- mocks ---------- */ | ||
|
|
||
| const mockPush = vi.fn(); | ||
| const mockSignIn = vi.fn(); | ||
|
|
||
| vi.mock("next-auth/react", () => ({ | ||
| signIn: (...args: unknown[]) => mockSignIn(...args), | ||
| })); | ||
|
|
||
| vi.mock("next/navigation", () => ({ | ||
| useRouter: () => ({ push: mockPush }), | ||
| useSearchParams: () => new URLSearchParams(), | ||
| })); | ||
|
|
||
| vi.mock("next/link", () => ({ | ||
| __esModule: true, | ||
| default: ({ | ||
| href, | ||
| children, | ||
| ...rest | ||
| }: { | ||
| href: string; | ||
| children: React.ReactNode; | ||
| }) => ( | ||
| <a href={href} {...rest}> | ||
| {children} | ||
| </a> | ||
| ), | ||
| })); | ||
|
|
||
| vi.mock("@neoboard/components", () => ({ | ||
| Card: ({ | ||
| children, | ||
| className, | ||
| }: { | ||
| children: React.ReactNode; | ||
| className?: string; | ||
| }) => <div className={className}>{children}</div>, | ||
| CardContent: ({ children }: { children: React.ReactNode }) => ( | ||
| <div>{children}</div> | ||
| ), | ||
| CardDescription: ({ children }: { children: React.ReactNode }) => ( | ||
| <p>{children}</p> | ||
| ), | ||
| CardFooter: ({ | ||
| children, | ||
| className, | ||
| }: { | ||
| children: React.ReactNode; | ||
| className?: string; | ||
| }) => <div className={className}>{children}</div>, | ||
| CardHeader: ({ | ||
| children, | ||
| className, | ||
| }: { | ||
| children: React.ReactNode; | ||
| className?: string; | ||
| }) => <div className={className}>{children}</div>, | ||
| CardTitle: ({ | ||
| children, | ||
| className, | ||
| }: { | ||
| children: React.ReactNode; | ||
| className?: string; | ||
| }) => <h2 className={className}>{children}</h2>, | ||
| Input: (props: React.InputHTMLAttributes<HTMLInputElement>) => ( | ||
| <input {...props} /> | ||
| ), | ||
| Label: ({ | ||
| children, | ||
| htmlFor, | ||
| }: { | ||
| children: React.ReactNode; | ||
| htmlFor?: string; | ||
| }) => <label htmlFor={htmlFor}>{children}</label>, | ||
| Alert: ({ children }: { children: React.ReactNode; variant?: string }) => ( | ||
| <div role="alert">{children}</div> | ||
| ), | ||
| AlertDescription: ({ children }: { children: React.ReactNode }) => ( | ||
| <span>{children}</span> | ||
| ), | ||
| LoadingButton: ({ | ||
| children, | ||
| loading, | ||
| loadingText, | ||
| ...rest | ||
| }: React.ButtonHTMLAttributes<HTMLButtonElement> & { | ||
| loading?: boolean; | ||
| loadingText?: string; | ||
| }) => ( | ||
| <button {...rest} disabled={loading}> | ||
| {loading ? loadingText : children} | ||
| </button> | ||
| ), | ||
| PasswordInput: (props: React.InputHTMLAttributes<HTMLInputElement>) => ( | ||
| <input type="password" {...props} /> | ||
| ), | ||
| })); | ||
|
|
||
| /* ---------- import under test ---------- */ | ||
| import LoginPage from "../page"; | ||
|
|
||
| /* ---------- helpers ---------- */ | ||
|
|
||
| function mockFetchBootstrapStatus(registrationEnabled: boolean) { | ||
| global.fetch = vi.fn().mockResolvedValue({ | ||
| json: () => | ||
| Promise.resolve({ | ||
| data: { bootstrapRequired: false, registrationEnabled }, | ||
| }), | ||
| }); | ||
| } | ||
|
|
||
| /* ---------- tests ---------- */ | ||
|
|
||
| describe("LoginPage", () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| }); | ||
|
|
||
| it("shows the signup link when registration is enabled", async () => { | ||
| mockFetchBootstrapStatus(true); | ||
|
|
||
| render(<LoginPage />); | ||
|
|
||
| await waitFor(() => { | ||
| expect(screen.getByText("Sign up")).toBeDefined(); | ||
| }); | ||
|
|
||
| const signupLink = screen.getByText("Sign up"); | ||
| expect(signupLink.closest("a")).toHaveAttribute("href", "/signup"); | ||
| }); | ||
|
|
||
| it("hides the signup link when registration is disabled", async () => { | ||
| mockFetchBootstrapStatus(false); | ||
|
|
||
| render(<LoginPage />); | ||
|
|
||
| await waitFor(() => { | ||
| expect(screen.queryByText("Sign up")).toBeNull(); | ||
| }); | ||
| }); | ||
|
|
||
| it("shows the signup link by default before fetch completes", () => { | ||
| // Fetch never resolves — default state should show the link | ||
| global.fetch = vi.fn().mockReturnValue(new Promise(() => {})); | ||
|
|
||
| render(<LoginPage />); | ||
|
|
||
| expect(screen.getByText("Sign up")).toBeDefined(); | ||
| }); | ||
|
|
||
| it("keeps the signup link when fetch fails", async () => { | ||
| global.fetch = vi.fn().mockRejectedValue(new Error("Network error")); | ||
|
|
||
| render(<LoginPage />); | ||
|
|
||
| // Default state is registrationEnabled=true, fetch error doesn't change it | ||
| await waitFor(() => { | ||
| expect(global.fetch).toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| expect(screen.getByText("Sign up")).toBeDefined(); | ||
| }); | ||
|
|
||
| it("renders the login form with email and password fields", () => { | ||
| mockFetchBootstrapStatus(true); | ||
|
|
||
| render(<LoginPage />); | ||
|
|
||
| expect(screen.getByLabelText("Email")).toBeDefined(); | ||
| expect(screen.getByLabelText("Password")).toBeDefined(); | ||
| expect(screen.getByText("Sign in")).toBeDefined(); | ||
| }); | ||
|
|
||
| it("renders the NeoBoard title", () => { | ||
| mockFetchBootstrapStatus(true); | ||
|
|
||
| render(<LoginPage />); | ||
|
|
||
| expect(screen.getByText("NeoBoard")).toBeDefined(); | ||
| }); | ||
|
|
||
| it("shows error message when login fails", async () => { | ||
| mockFetchBootstrapStatus(true); | ||
| mockSignIn.mockResolvedValue({ error: "CredentialsSignin" }); | ||
|
|
||
| const user = userEvent.setup(); | ||
| render(<LoginPage />); | ||
|
|
||
| const emailInput = screen.getByLabelText("Email"); | ||
| const passwordInput = screen.getByLabelText("Password"); | ||
| const submitButton = screen.getByText("Sign in"); | ||
|
|
||
| await user.type(emailInput, "test@example.com"); | ||
| await user.type(passwordInput, "wrongpassword"); | ||
| await user.click(submitButton); | ||
|
|
||
| await waitFor(() => { | ||
| expect(screen.getByText("Invalid email or password")).toBeDefined(); | ||
| }); | ||
| }); | ||
|
|
||
| it("redirects to callbackUrl on successful login", async () => { | ||
| mockFetchBootstrapStatus(true); | ||
| mockSignIn.mockResolvedValue({ error: null }); | ||
|
|
||
| const user = userEvent.setup(); | ||
| render(<LoginPage />); | ||
|
|
||
| const emailInput = screen.getByLabelText("Email"); | ||
| const passwordInput = screen.getByLabelText("Password"); | ||
| const submitButton = screen.getByText("Sign in"); | ||
|
|
||
| await user.type(emailInput, "test@example.com"); | ||
| await user.type(passwordInput, "correctpassword"); | ||
| await user.click(submitButton); | ||
|
|
||
| await waitFor(() => { | ||
| expect(mockPush).toHaveBeenCalledWith("/"); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a deterministic selector for the profile role badge.
Line 22 is not actually scoped to the Account section; it’s a page-global
[data-slot='badge']with.first(), which can match the wrong badge and make the test flaky.Suggested fix
And add
data-testid="profile-role-badge"on the role<Badge>inapp/src/app/(dashboard)/settings/profile/page.tsx.🤖 Prompt for AI Agents