-
Notifications
You must be signed in to change notification settings - Fork 23
test(ui): add ui testing for the console plugin 'Policies' page #815
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
base: main
Are you sure you want to change the base?
Conversation
testsuite/tests/singlecluster/ui/console_plugin/policies/test_dns_policy.py
Outdated
Show resolved
Hide resolved
468bdf7 to
19edea7
Compare
azgabur
left a comment
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.
WIP review, will check test cases later
testsuite/tests/singlecluster/ui/console_plugin/policies/conftest.py
Outdated
Show resolved
Hide resolved
testsuite/tests/singlecluster/ui/console_plugin/policies/conftest.py
Outdated
Show resolved
Hide resolved
19edea7 to
0e1f739
Compare
testsuite/tests/singlecluster/ui/console_plugin/policies/test_auth_policy.py
Outdated
Show resolved
Hide resolved
0e1f739 to
1e16b14
Compare
testsuite/tests/singlecluster/ui/console_plugin/policies/dnstls/test_tls_policy.py
Outdated
Show resolved
Hide resolved
testsuite/tests/singlecluster/ui/console_plugin/policies/test_rate_limit_policy.py
Outdated
Show resolved
Hide resolved
1e16b14 to
6162e37
Compare
6162e37 to
2af45e9
Compare
testsuite/tests/singlecluster/ui/console_plugin/policies/dnstls/test_dns_policy.py
Show resolved
Hide resolved
2af45e9 to
82a8003
Compare
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.
DnsPolicy and TlsPolicy tests require separate Gateway as they attach to a specific Gateway + TlsPolicy needs different listener. I would separate the ui tests similrly that is now in singlecluster module. gateway tests which test dns/tls and gateway attachment tests, these should have gateway module scoped. And others which can keep the session gateway created in tests/conftest.py This can be achieved just by having module gateway with conftest simillar to that in gateway/conftest in singlecluster. This can also be a root problem of the errors Alex seen #815 (comment)
Makefile
Outdated
| @ touch .make-poetry-sync-no-dev | ||
|
|
||
| .make-playwright-install: .make-poetry-sync-no-dev | ||
| @if poetry run playwright install --check >/dev/null 2>&1; then \ |
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.
Hmm 🤔
error: unknown option '--check'
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.
My mistake, I thought that flag checked whether the Playwright browsers were already installed, and since make ui didn’t throw errors I assumed it worked 😅 I’ve removed it now 👍
| @pytest.fixture(scope="module") | ||
| def authorization(): | ||
| """Override parent authorization fixture - prevents unnecessary resource creation""" | ||
| return None | ||
|
|
||
|
|
||
| @pytest.fixture(scope="module") | ||
| def rate_limit(): | ||
| """Override parent rate limit fixture- prevents unnecessary resource creation""" | ||
| return None |
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.
I think instead of removing these fixtures you can override commit fixture to not do anything. You can than later use these fixtures in tests.
| assert list_page.is_policy_listed(policy_name), f"AuthPolicy '{policy_name}' not found in list" | ||
|
|
||
| # Verify AuthPolicy created via UI enforces as expected | ||
| response = client.get("/get") |
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.
Missing wait_for_ready before attempting request. Maybe the wait can be UI-based? There are columns "Accepted" and "Enforced".
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.
The policy is already being waited on inside create_yaml():
self.page.wait_for_selector("text=AuthPolicy has been accepted", timeout=60000)
If you would like I can add a wait for enforced too?
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.
Update - in new changes i have added a wait for enforced too
testsuite/tests/singlecluster/ui/console_plugin/policies/dnstls/test_dns_policy.py
Show resolved
Hide resolved
|
|
||
|
|
||
| @pytest.mark.parametrize("create_method", ["form", "yaml"]) | ||
| def test_tls_policy_ui(request, navigator, cluster, blame, gateway, cluster_issuer, create_method, client): |
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.
TlsPolicy tests requires presence of DnsPolicy as well. As well has Gateway having TLS listener. These are missing in this test. These could be made using API
82a8003 to
68c7124
Compare
testsuite/tests/singlecluster/ui/console_plugin/policies/dnstls/test_dns_policy.py
Outdated
Show resolved
Hide resolved
68c7124 to
9e8a99a
Compare
9e8a99a to
b44fe87
Compare
Signed-off-by: emmaaroche <eroche@redhat.com>
b44fe87 to
ff26312
Compare
averevki
left a comment
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.
LGTM, nice pages abstraction 👍
Description
This PR adds Playwright-based UI tests for the Policies page of the Kuadrant console plugin. The tests cover creating, listing, and deleting each policy type (Auth, DNS, RateLimit, TLS) within this page and are compatible with both PatternFly v5 and v6.
UI tests for additional console plugin pages and functionality will be introduced in future PRs.
Related issue: #556
Changes
New Features
UI Testing Framework: Added
pytest-playwrightdependency anduipytest marker for browser-based testingPage Objects:
Added reusable page object classes under
testsuite/page_objects/to model the console plugin’s Policies views:nav_bar.pyandnavigator.pyfor console navigationauth_policy.py,dns_policy.py,rate_limit_policy.py,tls_policy.py, along with the shared base classpolicies.pyTests:
Added under
testsuite/tests/singlecluster/ui/console_plugin/policies/:test_auth_policy.py- UI test for creating (YAML), listing, and deleting an AuthPolicytest_rate_limit_policy.py- UI test for creating (YAML), listing, and deleting a RateLimitPolicytest_dns_policy.py- UI tests for creating (form/YAML), listing, and deleting a DNSPolicytest_tls_policy.py- UI tests for creating (form/YAML), listing, and deleting a TLSPolicyconftest.py- Test configuration with browser setup, login automation, and console plugin enablement checksInfrastructure Changes
Makefileandconfig/settings.local.yaml.tplto support UI testingVerification steps
Run the UI tests:
Run the UI tests and see browser session happening during the test:
make ui flags="--headed --slowmo 1000"These tests require:
playwright install