Skip to content
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

[6.16.z] Check dynflow console output for host #1570

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions airgun/entities/job_invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
from airgun.entities.base import BaseEntity
from airgun.navigation import NavigateStep, navigator
from airgun.utils import retry_navigation
from airgun.views.dynflowconsole import DynflowConsoleView
from airgun.views.job_invocation import (
JobInvocationCreateView,
JobInvocationStatusView,
JobInvocationsView,
NewJobInvocationStatusView,
)
from airgun.views.task import TaskDetailsView


class JobInvocationEntity(BaseEntity):
Expand Down Expand Up @@ -85,6 +87,22 @@ def read_hostgroups(self):
)
return view.target_hosts_and_inputs.targets.items

def read_dynflow_output(self, entity_name, host_name):
"""Read dynflow console output"""
view = self.navigate_to(self, 'Job Status', entity_name=entity_name, host_name=host_name)
wait_for(lambda: view.overview.hosts_table.is_displayed, timeout=10)
view.overview.hosts_table.row(host=host_name)['Actions'].widget.fill('Host task')
view = TaskDetailsView(self.browser)
wait_for(lambda: view.task.dynflow_console.is_displayed, timeout=10)
view.task.dynflow_console.click()
self.browser.switch_to_window(self.browser.window_handles[1])
console = DynflowConsoleView(self.browser)
wait_for(lambda: console.is_displayed, timeout=100)
result = console.output.read()
self.browser.switch_to_window(self.browser.window_handles[0])
self.browser.close_window(self.browser.window_handles[1])
return result


@navigator.register(JobInvocationEntity, 'All')
class ShowAllJobs(NavigateStep):
Expand Down
15 changes: 15 additions & 0 deletions airgun/views/dynflowconsole.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from widgetastic.widget import Text
from widgetastic_patternfly4 import Pagination as PF4Pagination

from airgun.views.common import BaseLoggedInView


class DynflowConsoleView(BaseLoggedInView):
title = Text("//a[@class='navbar-brand']//img")
output = Text("//div[@class='action']/pre[2]")

pagination = PF4Pagination()

@property
def is_displayed(self):
return self.browser.wait_for_element(self.title, exception=False) is not None
2 changes: 1 addition & 1 deletion airgun/views/job_invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class overview(SatTab):
'.//table',
column_widgets={
'Host': Text('./a'),
'Actions': ActionsDropdown("./div[contains(@class, 'btn-group')]"),
'Actions': ActionsDropdown('.//div[contains(@class, "btn-group")]'),
},
)
total_hosts = Text(
Expand Down
3 changes: 2 additions & 1 deletion airgun/views/task.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from wait_for import wait_for
from widgetastic.widget import Table, Text, View
from widgetastic_patternfly import BreadCrumb
from widgetastic_patternfly import BreadCrumb, Button
from widgetastic_patternfly4 import Pagination as PF4Pagination

from airgun.views.common import BaseLoggedInView, SatTab, SearchableViewMixinPF4
Expand Down Expand Up @@ -97,6 +97,7 @@ class task(SatTab):
progressbar = ProgressBar(locator='//div[contains(@class,"progress-bar")]')
output = TaskReadOnlyEntry(name='Output')
errors = TaskReadOnlyEntryError(name='Errors')
dynflow_console = Button('Dynflow console')

def wait_for_result(self, timeout=60, delay=1):
"""Wait for invocation job to finish"""
Expand Down
Loading