-
Notifications
You must be signed in to change notification settings - Fork 165
[1LP][RFR] Add test_infrastructure_hosts_viewing #10197
Conversation
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.
Awesome use of parametrization @prichard77 -- nice test case! Couple of small questions and the manual file needs rebase I think.
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.
One small comment, otherwise LGTM!
@@ -15,14 +15,20 @@ | |||
from cfme.common.candu_views import HostInfraUtilizationView | |||
from cfme.common.host_views import HostAddView | |||
from cfme.common.host_views import HostDetailsView | |||
from cfme.common.host_views import HostDevicesView |
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.
Might be time to just import the whole module...... optional though, and could get you into some circular imports.
Co-authored-by: john-dupuy <[email protected]>
@test_requirements.infra_hosts | ||
@pytest.mark.parametrize("table,row,view", HOST_DETAIL_ROWS, | ||
ids=[rel[1] for rel in HOST_DETAIL_ROWS]) | ||
def test_infrastructure_hosts_viewing(appliance, setup_provider, host, table, row, view): |
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.
What is the purpose of the table
parameter here? The navigation destinations select this automatically, I think it only would have been necessary if you were interacting with the summary table widgets directly within the test.
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.
Yep. I forgot to remove when I created the navigation. Removing.
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.
But wait. I used this to check that the value was not '0'. Might need to keep it.
if row not in ["Operating System", "Networks", "Print or export"]: | ||
view = navigate_to(host, "Details") | ||
pytest.skip(f"No row item present for {row}") | ||
view = navigate_to(host, row) | ||
if row == "Print or export": | ||
handle_extra_tabs(view) | ||
assert view.is_displayed |
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.
This got a bit screwed up by the suggestion merged as 333b964
if row not in ["Operating System", "Networks", "Print or export"]: | |
view = navigate_to(host, "Details") | |
pytest.skip(f"No row item present for {row}") | |
view = navigate_to(host, row) | |
if row == "Print or export": | |
handle_extra_tabs(view) | |
assert view.is_displayed | |
@request.addfinalizer | |
def _finalizer(): | |
if row == "Print or export": | |
handle_extra_tabs(view) | |
try: | |
if row not in ["Operating System", "Networks", "Print or export"]: | |
view = navigate_to(host, "Details") | |
if view.entities.summary(table).get_text_of(row) == '0': | |
pytest.skip(f"No items present for host relationship {row}") | |
view = navigate_to(host, row) | |
except TimedOutError: | |
pytest.fail('Timed out navigating to host relationship {row}') | |
I'll get some clarification in sync on Thursday. I could implement what I believe you are saying in chat by also adding an explicit click just before the assertion, but this doesn't make much sense to me. If navigating_to() the destination doesn't change the view then it would fail on is_displayed before I could assert that the original view is_displayed. I must be misunderstanding something about what you are asking.
|
I detected some fixture changes in commit 3233094 The local fixture
Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃 |
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.
Nice work asserting against the redirection (or lack thereof) behavior all within one test!
Purpose or Intent
PRT Run
{{ pytest: cfme/tests/infrastructure/test_host.py::test_infrastructure_hosts_viewing }}