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

[1LP][RFR] Automating basic VMRC Console Test #9703

Merged
merged 1 commit into from
Jan 14, 2020

Conversation

kedark3
Copy link
Contributor

@kedark3 kedark3 commented Dec 2, 2019

Purpose or Intent

  • Adding new tests VMRC Test automation is added.

Note: This PR is built on top of work from #9701 and #9595, please review those first so that I can rebase this.

PRT Run

{{pytest: cfme/tests/infrastructure/test_vmrc_console.py}}

izapolsk: REQUIRES #9764 9764

@kedark3 kedark3 force-pushed the vmrc_automation_tests branch 3 times, most recently from b25e835 to f5a966a Compare December 2, 2019 15:33
@dajoRH dajoRH changed the title [WIPTEST]Automating basic VMRC Console Test [WIP]Automating basic VMRC Console Test Dec 4, 2019
@kedark3 kedark3 force-pushed the vmrc_automation_tests branch from f5a966a to 9a47309 Compare December 5, 2019 19:11
@kedark3 kedark3 changed the title [WIP]Automating basic VMRC Console Test [WIPTEST]Automating basic VMRC Console Test Dec 5, 2019
@kedark3 kedark3 force-pushed the vmrc_automation_tests branch 4 times, most recently from 3efd7e4 to a842229 Compare December 5, 2019 22:37
@kedark3 kedark3 changed the title [WIPTEST]Automating basic VMRC Console Test [RFr]Automating basic VMRC Console Test Dec 5, 2019
@kedark3 kedark3 changed the title [RFr]Automating basic VMRC Console Test [RFR]Automating basic VMRC Console Test Dec 5, 2019
@dajoRH dajoRH removed the WIP-testing label Dec 5, 2019
@valaparthvi
Copy link
Contributor

Restarting the PRT, 510 run resulted in Invalid.

@kedark3 kedark3 force-pushed the vmrc_automation_tests branch from a842229 to e54efb8 Compare December 6, 2019 13:50
@@ -237,7 +237,8 @@ def switch_to_appliance(self):
def switch_to_console(self):
"""Switch focus to console tab/window."""
logger.info("Switching to console: window handle = {}".format(self.console_handle))
self.browser.selenium.switch_to.window(self.console_handle)
if (self.console_handle and self.console_handle in self.browser.selenium.window_handles):
self.browser.selenium.switch_to_window(self.console_handle)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case of VMRC Console, the browser window for console is short-lived, hence it becomes important to check if the console_handle exists in available selenium.window_handles before attempting to switch to console or close the windw, hence this check.

Copy link
Contributor

@valaparthvi valaparthvi left a comment

Choose a reason for hiding this comment

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

LGTM! Will wait on PRT results to move to 1LP.

else:
vm.open_console(console='VMRC Console', invokes_alert=True)
request.addfinalizer(vm.vm_console.close_console_window)
request.addfinalizer(appliance.server.logout)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious, why do you need to explicitly logout here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@valaparthvi without a logout, it was not getting enough time between previous provider removal and next provider addition, neither it would refresh the VMs page to reflect new provider, so logging out seemed best move to avoid unpredictable failures.

@@ -435,7 +435,6 @@ def _fill_smartstate_endpoint_dicts(self, provider_attributes):

def _fill_vmrc_console_endpoint_dicts(self, provider_attributes):
"""Fills dicts with VMRC console endpoint data

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove this change? Kinda seems irrelevant to the PR.

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 guess it got introduced during rebase.

@kedark3 kedark3 force-pushed the vmrc_automation_tests branch 3 times, most recently from 0c94df2 to fcfff67 Compare December 6, 2019 15:56
@jawatts jawatts added the test-automation To be applied on PR's which are automating existing manual cases label Dec 6, 2019
vm.open_console(console='VM Console', invokes_alert=True)
assert vm.vm_console, 'VMConsole object should be created'
request.addfinalizer(vm.vm_console.close_console_window)
except ValueError:
Copy link
Contributor

@jawatts jawatts Dec 6, 2019

Choose a reason for hiding this comment

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

Required If the VM console fails to launch here, we are giving a fast positive. Going to discuss a workaround offline on Monday

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the window handle different in 5.10 vs 5.11? Just a thought.

Copy link
Contributor Author

@kedark3 kedark3 Dec 10, 2019

Choose a reason for hiding this comment

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

I think Window Handles are Selenium thing and should have nothing to do with CFME version. Good question though, I will check.

@ganeshhubale
Copy link
Member

@kedark3 @valaparthvi I can see in report, tests passed for 5.10 but on PRT. But status of 5.10 is Invalid.

@@ -252,7 +253,7 @@ def wait_for_connect(self, timeout=30):

def close_console_window(self):
"""Attempt to close Console window at the end of test."""
if self.console_handle is not None:
if (self.console_handle and self.console_handle in self.browser.selenium.window_handles):
Copy link
Contributor

Choose a reason for hiding this comment

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

and has high priority. you don't need braces here

@kedark3 kedark3 force-pushed the vmrc_automation_tests branch from fcfff67 to 4e43e81 Compare December 11, 2019 12:19
@dajoRH dajoRH changed the title [RFR]Automating basic VMRC Console Test [WIP]Automating basic VMRC Console Test Dec 11, 2019
@izapolsk izapolsk force-pushed the vmrc_automation_tests branch from 6510614 to f3f0503 Compare December 12, 2019 17:36
@izapolsk izapolsk force-pushed the vmrc_automation_tests branch from f3f0503 to b528905 Compare December 12, 2019 17:38
@izapolsk izapolsk changed the title [WIP]Automating basic VMRC Console Test [WIPTEST]Automating basic VMRC Console Test Dec 12, 2019
@kedark3 kedark3 changed the title [WIPTEST]Automating basic VMRC Console Test [RFR]Automating basic VMRC Console Test Jan 9, 2020
@kedark3
Copy link
Contributor Author

kedark3 commented Jan 9, 2020

@mshriver @john-dupuy Tests are now passing in PRT thanks to @izapolsk . Kindly review and let me know if we can merge it. 510z passed but PRT seems to be stuck, cfme.log indicate test was passed.

@dajoRH dajoRH removed the WIP-testing label Jan 9, 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.

Some small comments, thanks for this PR @kedark3 👍

cfme/common/vm.py Outdated Show resolved Hide resolved
try:
view.browser.IGNORE_SUBSEQUENT_ALERTS = True
# Click console button given by type
view.toolbar.access.item_select(console, handle_alert=invokes_alert)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the name change from handle_alert to invokes_alert? I would keep it consistent as handle_alert

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 not being changed in the PR, its been like that always. And to me it makes sense because, when I am calling it like:
vm.open_console(console='VM Console', invokes_alert=True)
it reads like, open VM console and that console invokes_alert. I think we can keep it as is unless you insist.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine with me, if you like it then we can keep it as is.

cfme/tests/infrastructure/test_vmrc_console.py Outdated Show resolved Hide resolved
cfme/tests/infrastructure/test_vmrc_console.py Outdated Show resolved Hide resolved
@kedark3 kedark3 force-pushed the vmrc_automation_tests branch from ad4ed14 to bb734c9 Compare January 10, 2020 13:33
@dajoRH
Copy link
Contributor

dajoRH commented Jan 10, 2020

I detected some fixture changes in commit bb734c9

The global fixture configure_console_vmrc is used in the following files:

  • cfme/tests/infrastructure/test_vmrc_console.py
    • test_vmrc_console

Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃

@john-dupuy john-dupuy changed the title [RFR]Automating basic VMRC Console Test [1LP][RFR] Automating basic VMRC Console Test Jan 10, 2020
@jawatts jawatts self-assigned this Jan 14, 2020
@jawatts jawatts merged commit 0c9c659 into ManageIQ:master Jan 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lint-ok test-automation To be applied on PR's which are automating existing manual cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants