Skip to content

Conversation

@Redande
Copy link
Contributor

@Redande Redande commented Dec 18, 2025

Summary by CodeRabbit

  • New Features

    • Added an account deletion confirmation page showing a translated message, an icon, and a button to return to the home page.
  • Tests

    • Hardened chatbot conversation tests by wrapping the escape-and-hide sequence in a retrying/assertion helper with an extended timeout to reduce flakiness.
    • Improved Teacher flow test element selection by scoping the Create button lookup to the "Courses:" region for more robust clicks.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

Walkthrough

Adds a new Next.js account-deleted page rendering a confirmation screen, scopes a Create-button lookup in a draft system test, and replaces direct Escape + hidden-state waits with retrying expect(...).toPass(...) wrappers in chatbot conversation tests (15s timeout).

Changes

Cohort / File(s) Change Summary
New account deletion confirmation page
services/main-frontend/src/pages/account-deleted.tsx
Adds a React.FC default export AccountDeletedPage that renders a styled account-deleted confirmation screen using emotion, an Envelope icon, i18n translations (t("message-your-account-has-been-deleted"), t("home-page")), and a Link-wrapped Button to navigate home.
Test: retry-wrapped hidden-state assertion (chatbot)
system-tests/src/tests/chatbot-conversation.spec.ts
Replaces direct Escape + waitFor({ state: "hidden" }) sequences with expect(...).toPass(...) wrappers that perform the Escape key action and the hidden-state wait inside a retryable assertion with a 15s timeout. Applied in two locations.
Test: scoped Create button lookup (draft)
system-tests/src/tests/draft.spec.ts
Changes a direct Create button click to a scoped lookup: find the region labelled "Courses:" then locate the exact-match Create button within that region before clicking, improving selector specificity.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review services/main-frontend/src/pages/account-deleted.tsx for correct i18n keys, accessible semantics (heading/button roles), and Link target.
  • Inspect system-tests/src/tests/chatbot-conversation.spec.ts to confirm toPass wrapper behavior and the 15s timeout is appropriate and doesn’t mask failures.
  • Validate the selector scoping change in system-tests/src/tests/draft.spec.ts doesn’t break other flows.

Possibly related PRs

Suggested reviewers

  • nygrenh

Poem

🐰 I hopped to a page where the mailbox gleams,
An envelope winked under soft sunbeams.
Tests learned to wait and try once more,
The home button led me safe to the door.
A rabbit twirls, and nibble-joy streams. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: adding a new account-deleted confirmation page after account deletion. It matches the primary file addition and aligns with the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-missing-view-after-account-deletion

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot added the feature label Dec 18, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
services/main-frontend/src/pages/account-deleted.tsx (3)

9-10: Simplify component type declaration.

The component doesn't use props or children, so React.PropsWithChildren<unknown> is unnecessary. Consider simplifying:

🔎 Suggested simplification
-const AccountDeletedPage: React.FC<React.PropsWithChildren<unknown>> = () => {
+const AccountDeletedPage: React.FC = () => {

Or simply use a plain function declaration:

-const AccountDeletedPage: React.FC<React.PropsWithChildren<unknown>> = () => {
+const AccountDeletedPage = () => {

19-21: Consider using primaryFont from theme.

As per coding guidelines, if a component uses fonts, prefer theme fonts. The h1 could include the primary font family for consistency.

🔎 Suggested change
 import Button from "@/shared-module/common/components/Button"
-import { baseTheme } from "@/shared-module/common/styles"
+import { baseTheme, primaryFont } from "@/shared-module/common/styles"
           h1 {
             font-size: 2rem;
+            font-family: ${primaryFont};
           }

25-30: Add aria-hidden to decorative icon.

The Envelope icon is decorative since the adjacent text conveys the message. Adding aria-hidden="true" improves screen reader experience.

🔎 Suggested change
         <Envelope
+          aria-hidden="true"
           className={css`
             color: ${baseTheme.colors.green[500]};
             margin-right: 0.5rem;
           `}
         />
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 525ba52 and b90bfa5.

📒 Files selected for processing (1)
  • services/main-frontend/src/pages/account-deleted.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.tsx

⚙️ CodeRabbit configuration file

**/*.tsx: Make sure to use the useTranslation hook for all text that is visible to the user.
If a component uses colors, use colors from the theme if possible. Example: import { baseTheme } from "@/shared-module/common/styles" ... background: ${baseTheme.colors.clear[100]};
If a component uses media queries, use the respondToOrLarger function. Example: import { respondToOrLarger } from "@/shared-module/common/styles/respond" ... ${respondToOrLarger.sm} { ... }
If component sends requests to server, use either useQuery, or useToastMutation hooks, or use hooks wrapping those hooks.
If there is a form of any kind, make sure it uses useForm from react-hook-form, and make sure the form is integrated with the useToastMutation and useQuery hooks.
For loading and error states, use the Spinner and ErrorBanner components from the shared module.
We have better replacements for window.confirm, window.alert, and window.prompt, use the DialogProvider and the useDialog hook from the shared module instead.
For calling the React hooks useMemo and useEffect, don't use the React. prefix.
If a component uses fonts, use fonts from the theme if possible. Example: import { primaryFont } from "@/shared-module/common/styles" ... font-family: ${primaryFont};

Files:

  • services/main-frontend/src/pages/account-deleted.tsx
🧬 Code graph analysis (1)
services/main-frontend/src/pages/account-deleted.tsx (1)
shared-module/packages/common/src/styles/theme.ts (1)
  • baseTheme (11-96)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: code-style
  • GitHub Check: headless_lms
  • GitHub Check: build-and-system-tests
🔇 Additional comments (1)
services/main-frontend/src/pages/account-deleted.tsx (1)

35-44: LGTM!

Good use of the Link component for client-side navigation and proper translation hook usage for the button text. The default export is correct for a Next.js page.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
system-tests/src/tests/chatbot-conversation.spec.ts (1)

100-105: Retry pattern appropriately handles popover closure flakiness.

The toPass() wrapper with retry logic is a good approach for handling unstable popover behavior during viewport resizing for screenshots. However, the 15-second timeout seems generous.

A few minor considerations:

  • If the popover is already closed but the check fails, pressing Escape repeatedly during retries might have unintended side effects (e.g., closing other UI elements)
  • Consider reducing the timeout to 10 seconds if this proves sufficient in practice
  • If flakiness persists, investigate whether the root cause is animation timing or event propagation delays
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b90bfa5 and 9b7be73.

📒 Files selected for processing (1)
  • system-tests/src/tests/chatbot-conversation.spec.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
system-tests/**/*

⚙️ CodeRabbit configuration file

system-tests/**/*: For Playwright system tests, make sure each test that triggers a backend mutation (e.g., clicking a save button) waits for a UI confirmation element that proves the request completed successfully before proceeding. Otherwise, the test might continue before the operation finishes.
Also if someone navigates to a course page, and clicks continue on a dialog straight away, make sure its done with the selectCourseInstanceIfPrompted function.
If someone write a tests that depends on a toast staying on the screen, make sure to use the showNextToastsInfinitely, and showToastsNormally functions. If those are used in conjunction with expectScreenshotsToMatchSnapshots, you should set its argument of dontWaitForSpinnersToDisappear to true.
For dialog interactions, use the helper functions from system-tests/src/utils/dialogs.ts: - Use dismissAlertDialog for alert dialogs - Use respondToConfirmDialog for confirm dialogs (Yes/No) - Use fillPromptDialog for prompt dialogs with input fields
NEVER select elements by auto-generated CSS classes (e.g., .locator(".css-xknul2-TopBar")). Instead, use semantic selectors like data-testid attributes, role selectors, text content, or accessible names. Use page.getByTestId(), page.getByRole(), page.getByText(), or page.getByLabel() instead.

Files:

  • system-tests/src/tests/chatbot-conversation.spec.ts
🧠 Learnings (1)
📚 Learning: 2025-09-30T06:35:05.964Z
Learnt from: akirataguchi115
Repo: rage/secret-project-331 PR: 1561
File: system-tests/src/tests/material-reference.spec.ts:189-200
Timestamp: 2025-09-30T06:35:05.964Z
Learning: In Playwright tests, `.hover()` and other action methods automatically wait for elements to be visible and stable before performing the action. Explicit visibility waits before hover actions are not necessary.

Applied to files:

  • system-tests/src/tests/chatbot-conversation.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build-and-deploy
  • GitHub Check: build-and-system-tests
  • GitHub Check: code-style
  • GitHub Check: headless_lms
🔇 Additional comments (1)
system-tests/src/tests/chatbot-conversation.spec.ts (1)

200-205: Consistent application of retry pattern.

Good consistency with the same pattern applied at lines 100-105. The same considerations about timeout duration and multiple Escape presses apply here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
services/main-frontend/src/pages/account-deleted.tsx (1)

14-22: Consider using theme values for sizing and spacing.

The component uses hardcoded values for font-size (2rem), padding (3rem), and margin (1rem). The baseTheme provides fontSizes and space scales that could be used for consistency across the app.

Example using theme values:
       className={css`
         background-color: ${baseTheme.colors.green[100]};
-        padding: 3rem;
-        margin-bottom: 1rem;
+        padding: ${baseTheme.space[6]};
+        margin-bottom: ${baseTheme.space[4]};

         h1 {
-          font-size: 2rem;
+          font-size: ${baseTheme.fontSizes[5]};
         }
       `}

Note: Adjust the scale indices based on your theme's actual values.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a37337f and 64ab2dd.

📒 Files selected for processing (1)
  • services/main-frontend/src/pages/account-deleted.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.tsx

⚙️ CodeRabbit configuration file

**/*.tsx: Make sure to use the useTranslation hook for all text that is visible to the user.
If a component uses colors, use colors from the theme if possible. Example: import { baseTheme } from "@/shared-module/common/styles" ... background: ${baseTheme.colors.clear[100]};
If a component uses media queries, use the respondToOrLarger function. Example: import { respondToOrLarger } from "@/shared-module/common/styles/respond" ... ${respondToOrLarger.sm} { ... }
If component sends requests to server, use either useQuery, or useToastMutation hooks, or use hooks wrapping those hooks.
If there is a form of any kind, make sure it uses useForm from react-hook-form, and make sure the form is integrated with the useToastMutation and useQuery hooks.
For loading and error states, use the Spinner and ErrorBanner components from the shared module.
We have better replacements for window.confirm, window.alert, and window.prompt, use the DialogProvider and the useDialog hook from the shared module instead.
For calling the React hooks useMemo and useEffect, don't use the React. prefix.
If a component uses fonts, use fonts from the theme if possible. Example: import { primaryFont } from "@/shared-module/common/styles" ... font-family: ${primaryFont};

Files:

  • services/main-frontend/src/pages/account-deleted.tsx
🧬 Code graph analysis (1)
services/main-frontend/src/pages/account-deleted.tsx (1)
shared-module/packages/common/src/styles/theme.ts (1)
  • baseTheme (11-96)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build-and-deploy
  • GitHub Check: build-and-system-tests
  • GitHub Check: headless_lms
  • GitHub Check: code-style
🔇 Additional comments (1)
services/main-frontend/src/pages/account-deleted.tsx (1)

9-42: Implementation looks good.

The component correctly follows the coding guidelines: uses useTranslation for user-facing text, leverages theme colors, and has a clean, straightforward structure appropriate for a confirmation page.

Comment on lines +25 to +30
<Envelope
className={css`
color: ${baseTheme.colors.green[500]};
margin-right: 0.5rem;
`}
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add aria-hidden="true" to decorative icon.

The Envelope icon is decorative within the heading. For better accessibility, mark it as hidden from screen readers since the text already conveys the meaning.

🔎 Apply this diff:
         <Envelope
+          aria-hidden="true"
           className={css`
             color: ${baseTheme.colors.green[500]};
             margin-right: 0.5rem;
           `}
         />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Envelope
className={css`
color: ${baseTheme.colors.green[500]};
margin-right: 0.5rem;
`}
/>
<Envelope
aria-hidden="true"
className={css`
color: ${baseTheme.colors.green[500]};
margin-right: 0.5rem;
`}
/>
🤖 Prompt for AI Agents
In services/main-frontend/src/pages/account-deleted.tsx around lines 25 to 30,
the Envelope icon is decorative but not hidden from assistive technology; add
aria-hidden="true" to the Envelope component (or role="presentation") so screen
readers ignore it while keeping the visible markup unchanged.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
system-tests/src/tests/draft.spec.ts (1)

118-121: Good improvement, but consider applying the same pattern to other Create button clicks.

The scoped selection using getByRole("region") followed by getByRole("button") with exact matching is more robust than the generic selectors used elsewhere in this file.

However, there's an inconsistency:

  • Line 70 uses button:text("Create") (generic, unscoped)
  • Lines 149 and 174 use .getByRole("button", { name: "Create" }).first() (relies on ordering)

Consider applying the same scoped approach to these other Create button clicks for consistency and to avoid potential flakiness if multiple Create buttons exist on those pages.

🔎 View suggested refactor for line 70
-    await page.click(`button:text("Create")`)
+    await page
+      .getByRole("region", { name: "Courses:" })
+      .getByRole("button", { name: "Create", exact: true })
+      .click()
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 64ab2dd and 37c1093.

📒 Files selected for processing (1)
  • system-tests/src/tests/draft.spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
system-tests/**/*

⚙️ CodeRabbit configuration file

system-tests/**/*: For Playwright system tests, make sure each test that triggers a backend mutation (e.g., clicking a save button) waits for a UI confirmation element that proves the request completed successfully before proceeding. Otherwise, the test might continue before the operation finishes.
Also if someone navigates to a course page, and clicks continue on a dialog straight away, make sure its done with the selectCourseInstanceIfPrompted function.
If someone write a tests that depends on a toast staying on the screen, make sure to use the showNextToastsInfinitely, and showToastsNormally functions. If those are used in conjunction with expectScreenshotsToMatchSnapshots, you should set its argument of dontWaitForSpinnersToDisappear to true.
For dialog interactions, use the helper functions from system-tests/src/utils/dialogs.ts: - Use dismissAlertDialog for alert dialogs - Use respondToConfirmDialog for confirm dialogs (Yes/No) - Use fillPromptDialog for prompt dialogs with input fields
NEVER select elements by auto-generated CSS classes (e.g., .locator(".css-xknul2-TopBar")). Instead, use semantic selectors like data-testid attributes, role selectors, text content, or accessible names. Use page.getByTestId(), page.getByRole(), page.getByText(), or page.getByLabel() instead.

Files:

  • system-tests/src/tests/draft.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build-and-deploy
  • GitHub Check: build-and-system-tests
  • GitHub Check: headless_lms
  • GitHub Check: code-style

@nygrenh nygrenh merged commit 195dd3e into master Dec 18, 2025
19 of 20 checks passed
@nygrenh nygrenh deleted the add-missing-view-after-account-deletion branch December 18, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants