Skip to content

[Testing E2E] Add Test Scenario for Admin Billing Page#44

Merged
jinnaWan merged 9 commits into
mainfrom
CB-82
Apr 28, 2025
Merged

[Testing E2E] Add Test Scenario for Admin Billing Page#44
jinnaWan merged 9 commits into
mainfrom
CB-82

Conversation

@jinnaWan
Copy link
Copy Markdown
Collaborator

Summary

test-result_admin_billing

Frontend:

  • Send correct utc time to backend when using custom date filter

Backend:

  • (All transactions endpoint)Change date to format in Bangkok datetime string

Testing:

  • Add test scenario for admin billing page

@jinnaWan jinnaWan requested review from Copilot and nut1414 April 27, 2025 16:42
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 end‐to‐end test scenarios for the Admin Billing page, updates datetime utilities with additional formatting options, and enhances frontend components with data-testid attributes for better testability.

  • Updated datetime utils with new functions (format_date, date_only parameters, month-related formatting).
  • Added comprehensive E2E tests for Admin Billing page covering transactions and filtering.
  • Enhanced frontend components (AdminBillingPage, RangePicker, BillingStatsVisualizer, etc.) with proper test identifiers and minor UI improvements.

Reviewed Changes

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

Show a summary per file
File Description
test/e2e/utils/datetime_utils.py Added new datetime formatting functions and extended existing ones.
test/e2e/scenarios/test_admin_billing.py Introduced multiple E2E test scenarios for admin billing functionality.
test/e2e/pages/admin/admin_billing_page.py Updated locator usage and added test IDs for improved stability.
test/e2e/data/models.py Added models for admin billing data structures.
frontend/src/utils/dateTime.ts Added convertToUTC helper and updated date formatting in hooks.
frontend/src/pages/Admin/AdminBillingPage.tsx Modified rendering of date and instance name with test ID additions.
frontend/src/hooks/Admin/useAdminBilling.ts Updated date handling to convert to UTC before formatting.
frontend/src/constant/CurrencyConstant.ts Revised currency format function.
Others (RangePicker, BillingStatsVisualizer, etc.) Added missing data-testid attributes and refined UI components.
backend/src/core/service/admin.py Modified transaction response to use Bangkok timezone formatted strings.
backend/src/core/models/admin.py Updated admin transaction model datetime fields to string.
Files not reviewed (2)
  • backend/test_certificate/tmp/lxd.crt: Language not supported
  • backend/test_certificate/tmp/lxd.key: Language not supported

@jinnaWan
Copy link
Copy Markdown
Collaborator Author

@nut1414 pls help review. i was going to make reusable table action class but it seem to be too much pain, so i gave up lol.

Comment thread frontend/src/components/Admin/BillingStatsVisualizer.tsx Outdated
amount=transaction.amount,
created_at=transaction.created_at,
last_updated_at=transaction.last_updated_at
created_at=DateTimeUtils.to_bkk_string(transaction.created_at),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why are we changing it back to bkk string again?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

when testing, the time is still in utc somehow so i convert it in the backend, frontend just display it without formatting anything.

@jinnaWan jinnaWan merged commit 735a131 into main Apr 28, 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