test: add UI tests for OIDC, Plan, and TRLP policies#915
test: add UI tests for OIDC, Plan, and TRLP policies#915emmaaroche merged 1 commit intoKuadrant:mainfrom
Conversation
📝 WalkthroughWalkthroughAdds UI page objects and end-to-end console-plugin tests for TokenRateLimitPolicy, OIDCPolicy and PlanPolicy; makes BasePolicyNewPageYaml enforcement check configurable; fixes TokenRateLimitPolicy.create_instance() to set the model metadata.namespace to the cluster project. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@testsuite/tests/singlecluster/ui/console_plugin/policies/test_plan_policy.py`:
- Around line 44-65: The assertions that check for the child RateLimitPolicy
being created and later deleted are immediate and can race with controller
reconciliation; wrap both checks in an eventual wait/polling loop (e.g., retry
until timeout) using the page helper methods instead of direct asserts: poll
rlp_list_page.is_policy_listed(policy_name) until true after creation and poll
until false after deletion. Use navigator.navigate(RateLimitListPage) to refresh
the page inside the retry, and reuse PlanPolicyListPage/list_page.delete for
delete action; fail only after the timeout so the test is resilient to
reconciliation lag.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a12823d6-78aa-4beb-bc1f-9a8470de62fe
📒 Files selected for processing (9)
testsuite/kuadrant/policy/token_rate_limit.pytestsuite/page_objects/policies/oidc_policy.pytestsuite/page_objects/policies/plan_policy.pytestsuite/page_objects/policies/policies.pytestsuite/page_objects/policies/policies_new_page.pytestsuite/page_objects/policies/token_rate_limit.pytestsuite/tests/singlecluster/ui/console_plugin/policies/test_oidc_policy.pytestsuite/tests/singlecluster/ui/console_plugin/policies/test_plan_policy.pytestsuite/tests/singlecluster/ui/console_plugin/policies/test_token_rate_limit_policy.py
zkraus
left a comment
There was a problem hiding this comment.
Tests are passing for me. Code looks clean and readable.
Review touching on 2 points
- Magic number timeout=60000 -> introduce a shared and documented constant for this withing UI tests
- (if possible) Unify form creating
Limit()in various tests (PlanPolicy vs TokenRateLimitPolicy)
|
@zkraus I agree with your Repeat comment suggestion. Since there are also other existing UI tests from previous PRs that use |
Signed-off-by: emmaaroche <eroche@redhat.com>
7c03a79 to
c654624
Compare
zkraus
left a comment
There was a problem hiding this comment.
Requested changes addressed, new tests are passing.
LGTM.
Description
This PR adds UI tests for
OIDCPolicy,PlanPolicy, andTokenRateLimitPolicywhich are available in the console plugin in OCP versions 4.20+. These tests validate UI functionality without enforcement verification due to more complex setup requirements (OIDC providers, authentication, LLMsim backend). Functional tests already provide enforcement coverage for all three policies.Note: These tests require OCP 4.20+ and will be skipped on older versions.
Changes
New Tests
test_oidc_policy.py: TestsOIDCPolicyCRUD operations via UI and validates child AuthPolicy creation and deletion (main + callback)test_plan_policy.py: TestsPlanPolicyCRUD operations via UI and validates child RateLimitPolicy creation and deletiontest_token_rate_limit_policy.py: TestsTokenRateLimitPolicyCRUD operations via UINew Page Objects
oidc_policy.py: Page object forOIDCPolicycreation and list pagesplan_policy.py: Page object forPlanPolicycreation and list pagestoken_rate_limit.py: Page object forTokenRateLimitPolicycreation and list pagesAdditional Changes
policies.py: Adds navigation tabs and methods for the 3 new policy typespolicies_new_page.py: Addscheck_enforcementflag to skip enforcement validation for policies requiring a more complex setuptoken_rate_limit.py: Adds namespace inTokenRateLimitPolicy.create_instance()metadataVerification steps
Run the new UI policy tests in parallel:
Run all UI tests:
Summary by CodeRabbit
New Features
Bug Fixes
Tests