Skip to content

[Testing E2E] Add Test Scenario for Admin Credit Page & System Status Page#46

Merged
jinnaWan merged 3 commits into
mainfrom
CB-84
Apr 30, 2025
Merged

[Testing E2E] Add Test Scenario for Admin Credit Page & System Status Page#46
jinnaWan merged 3 commits into
mainfrom
CB-84

Conversation

@jinnaWan
Copy link
Copy Markdown
Collaborator

UwU

@jinnaWan jinnaWan requested review from Copilot and nut1414 April 29, 2025 07:43
@jinnaWan
Copy link
Copy Markdown
Collaborator Author

jinnaWan commented Apr 29, 2025

@nut1414 pls help review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new end-to-end test scenario for the Admin Credit page, updates the corresponding page object, and modernizes the use of test IDs in both the backend test code and the frontend components.

  • Added E2E test scenario in test/e2e/scenarios/test_admin_credit.py
  • Introduced a new AdminCreditPage object in test/e2e/pages/admin/admin_credit_page.py
  • Updated frontend components and hooks to use toast notifications and revised data-testid attributes

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/e2e/scenarios/test_admin_credit.py Added a new E2E test scenario for admin credit operations
test/e2e/pages/admin/admin_credit_page.py Created a new page object to interact with the admin credit page elements
test/e2e/pages/admin/init.py Exported the new AdminCreditPage
frontend/src/pages/Admin/AdminCreditPage.tsx Updated test IDs; removed inline error/success messages; integrated new test IDs
frontend/src/hooks/Admin/useAdminCredit.ts Replaced state-based error/success messages with toast notifications
frontend/src/components/Common/Dropdown.tsx Enhanced test ID handling using the new useTestId hook
Comments suppressed due to low confidence (2)

test/e2e/pages/admin/admin_credit_page.py:21

  • The test ID pattern in this method expects an element ending with '-option-button', but the frontend now provides IDs in the format 'admin-credit-option-{amount}'. Consider updating the lambda to use the correct test ID.
self.get_credit_option = lambda amount: page.get_by_test_id(f"admin-credit-option-{amount}-option-button")

frontend/src/pages/Admin/AdminCreditPage.tsx:56

  • The data-testid 'admin-credits' is assigned to multiple elements (the Dropdown and the InputField), which may lead to ambiguity during tests. Use distinct identifiers for each element to avoid potential conflicts.
data-testid="admin-credits"

@jinnaWan jinnaWan changed the title [Testing E2E] Add Test Scenario for Admin Credit Page [Testing E2E] Add Test Scenario for Admin Credit Page & System Status Page Apr 29, 2025
@jinnaWan jinnaWan merged commit 3438555 into main Apr 30, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants