Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[1LP][RFR] Replace usage of entity.check() with entity.ensure_checked. Part 1. #9669

Merged
merged 9 commits into from
Jan 14, 2020

Conversation

prichard77
Copy link
Contributor

@prichard77 prichard77 commented Nov 25, 2019

Purpose or Intent

  • Updating tests and framework to use entity ensure_checked() instead of entity.check(). ensure_checked() is an enhancement to check() functionality that accounts for the checked state of an entity when selecting it.

PRT Run

{{ pytest: --use-provider rhv42 --use-provider rhos13 --long-running cfme/tests/cloud_infra_common/test_policy_simulation.py::test_policy_simulation_ui cfme/tests/cloud/test_instance_power_control.py::test_power_on_or_off_multiple cfme/tests/cloud_infra_common/test_vm_instance_analysis.py::test_ssa_multiple_vms cfme/tests/infrastructure/test_host.py::test_multiple_host_good_creds }}

@prichard77 prichard77 changed the title [WIP] Replace usage of entity.check() with entity.ensure_checked. [WIPTEST] Replace usage of entity.check() with entity.ensure_checked. Jan 6, 2020
@dajoRH dajoRH added WIP-testing and removed WIP labels Jan 6, 2020
@prichard77 prichard77 changed the title [WIPTEST] Replace usage of entity.check() with entity.ensure_checked. [WIPTEST] Replace usage of entity.check() with entity.ensure_checked. Part 1. Jan 7, 2020
@dajoRH dajoRH changed the title [WIPTEST] Replace usage of entity.check() with entity.ensure_checked. Part 1. [WIP] Replace usage of entity.check() with entity.ensure_checked. Part 1. Jan 9, 2020
@prichard77 prichard77 changed the title [WIP] Replace usage of entity.check() with entity.ensure_checked. Part 1. [WIPTEST] Replace usage of entity.check() with entity.ensure_checked. Part 1. Jan 9, 2020
@dajoRH dajoRH added WIP-testing and removed WIP labels Jan 9, 2020
@@ -318,7 +318,7 @@ def power_control_from_cfme(self, *args, **kwargs):
raise ItemNotFound(
'Failed to find instance in table: {}'.format(self.name)
)
row.check()
row.ensure_checked()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have only been able to test this by changing the surrounding code so line 321 would be executed. IT tested fine, but there is not a specific test in PRT that covers this update.

@@ -643,7 +643,8 @@ def prerequisite(self):
def step(self, *args, **kwargs):
# click the checkbox of every object in the filtered collection
for entity in self.obj.all():
self.prerequisite_view.entities.get_entity(name=entity.name, surf_pages=True).check()
self.prerequisite_view.entities.get_entity(name=entity.name,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is covered by cfme/tests/cloud_infra_common/test_policy_simulation.py::test_policy_simulation_ui and will be added to PRT.

@@ -266,7 +266,8 @@ class Edit(CFMENavigateStep):
prerequisite = NavigateToSibling('All')

def step(self, *args, **kwargs):
self.prerequisite_view.entities.get_entity(name=self.obj.name, surf_pages=True).check()
self.prerequisite_view.entities.get_entity(name=self.obj.name,
surf_pages=True).ensure_checked()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't found a usage of this. It is the normal implementation of ensure_checked() that has been tested elsewhere.

@@ -289,7 +290,8 @@ class EditTags(CFMENavigateStep):
prerequisite = NavigateToSibling('All')

def step(self, *args, **kwargs):
self.prerequisite_view.entities.get_entity(name=self.obj.name, surf_pages=True).check()
self.prerequisite_view.entities.get_entity(name=self.obj.name,
surf_pages=True).ensure_checked()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't found a usage of this. It is the normal implementation of ensure_checked() that has been tested elsewhere.

@@ -744,7 +744,7 @@ def refresh_provider_relationships_ui(self, from_list_view=False, wait=0, delay=
if from_list_view:
view = navigate_to(self, 'All')
entity = view.entities.get_entity(name=self.name, surf_pages=True)
entity.check()
entity.ensure_checked()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't found a usage of this. It is the normal implementation of ensure_checked() that has been tested elsewhere.

view.entities.get_entity(name=testing_instance.name).check()
view.entities.get_entity(name=testing_instance2.name).check()
view.entities.get_entity(name=testing_instance.name).ensure_checked()
view.entities.get_entity(name=testing_instance2.name).ensure_checked()
Copy link
Contributor Author

@prichard77 prichard77 Jan 11, 2020

Choose a reason for hiding this comment

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

Tested and will be part of PRT.

@@ -971,7 +971,7 @@ def test_ssa_multiple_vms(ssa_multiple_vms, soft_assert, appliance, compare_linu
view.toolbar.view_selector.select('List View')
view.paginator.set_items_per_page(1000)
for ssa_vm in ssa_multiple_vms:
view.entities.get_entity(name=ssa_vm.name, surf_pages=True).check()
view.entities.get_entity(name=ssa_vm.name, surf_pages=True).ensure_checked()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tested and I am adding to PRT.

@@ -90,7 +90,7 @@ def navigate_and_select_quads(provider):
view: the provider nodes view, quadicons already selected"""
hosts_view = navigate_to(provider, 'ProviderNodes')
assert hosts_view.is_displayed
[h.check() for h in hosts_view.entities.get_all()]
[h.ensure_checked() for h in hosts_view.entities.get_all()]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been tested with cfme/tests/infrastructure/test_host.py::test_multiple_host_good_creds and the test will be added to PRT.

@prichard77
Copy link
Contributor Author

Something seems to be wrong with my PRT format. It's not running what I expect. Output doesn't tell me what is wrong , so I'll just keep trying until it works or I give up.

@prichard77
Copy link
Contributor Author

I have updated the format of my PRT command a couple times. I'll get some assistance debugging this on Monday. Am marking RFR to possibly get this looked at while trying to figure out the PRT issue. I also added comments about the testing of each update.

@prichard77 prichard77 changed the title [WIPTEST] Replace usage of entity.check() with entity.ensure_checked. Part 1. [RFR] Replace usage of entity.check() with entity.ensure_checked. Part 1. Jan 11, 2020
Copy link
Contributor

@john-dupuy john-dupuy left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for this PR 👍

@john-dupuy john-dupuy changed the title [RFR] Replace usage of entity.check() with entity.ensure_checked. Part 1. [1LP][RFR] Replace usage of entity.check() with entity.ensure_checked. Part 1. Jan 13, 2020
@mshriver mshriver merged commit 741be7d into ManageIQ:master Jan 14, 2020
spusateri pushed a commit to spusateri/integration_tests that referenced this pull request Jan 27, 2020
…. Part 1. (ManageIQ#9669)

* Replace check() with ensure_checked() in test_multiple_host_good_creds

* Remove pytest mark used for testing

* Update test_power_on_or_off_multiple to use ensure_checked()

* Replace entity.check() with entity.ensure_checked() in refresh_provider_relationships_ui

* Replace check() with ensure_checked() in cfme/tests/cloud_infra_common/test_vm_instance_analysis.py

* Replace check() with ensure_checked() in power_control_from_cfme

* Replace check() with ensure_checked() in PolicySimulationOnCollection

* Replace check() with ensure_checked() in Edit

* Replace check() with ensure_checked() in EditTags
@prichard77 prichard77 deleted the replaceCheck branch March 10, 2020 18:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants