Skip to content

Commit

Permalink
Merge branch '6.16.z' of https://github.com/SatelliteQE/airgun into A…
Browse files Browse the repository at this point in the history
…llHostsManageErrata
  • Loading branch information
sambible committed Sep 12, 2024
2 parents a7687f5 + 0005b5f commit cd43ff9
Show file tree
Hide file tree
Showing 18 changed files with 374 additions and 272 deletions.
212 changes: 0 additions & 212 deletions .github/workflows/auto_branching.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/dispatch_release.yml

This file was deleted.

3 changes: 3 additions & 0 deletions airgun/entities/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import time

from airgun.entities.base import BaseEntity
from airgun.navigation import NavigateStep, navigator
from airgun.utils import retry_navigation
Expand All @@ -17,6 +19,7 @@ def read(self, widget_name):
view = self.navigate_to(self, 'All')
if widget_name not in view.widget_names:
raise ValueError('Provide correct widget name to be read')
time.sleep(3)
return getattr(view, widget_name).read()

def read_all(self):
Expand Down
12 changes: 8 additions & 4 deletions airgun/entities/discoveryrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ def read(self, entity_name, widget_names=None):
return view.read(widget_names=widget_names)

def read_all(self):
"""Reads the whole discovery rules table.
"""Reads the entire discovery rules page
:return: list of table rows, each row is dict,
attribute as key with correct value
:return:
1) list of table rows, each row is dict, attribute as key with correct value
2) After deleting the rule, the page context is displayed
"""
view = self.navigate_to(self, 'All')
return view.table.read()
if view.table.is_displayed:
return view.table.read()
elif view.page_info.is_displayed:
return view.page_info.read()

def update(self, entity_name, values):
"""Update existing Discovery rule
Expand Down
9 changes: 9 additions & 0 deletions airgun/entities/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def create(self, values):
def get_register_command(self, values=None, full_read=None):
"""Get curl command generated on Register Host page"""
view = self.navigate_to(self, 'Register')
self.browser.plugin.ensure_page_safe()
if values is not None:
if ('advanced.repository_gpg_key_url' in values) or ('advanced.repository' in values):
view.wait_displayed()
Expand All @@ -64,6 +65,7 @@ def get_register_command(self, values=None, full_read=None):
view.repository_gpg_key_url.fill(values['advanced.repository_gpg_key_url'])
view.repository_list_confirm.click()
view = self.navigate_to(self, 'Register')
self.browser.plugin.ensure_page_safe()
view.fill(values)
if view.general.activation_keys.read():
self.browser.click(view.generate_command)
Expand All @@ -82,6 +84,13 @@ def search(self, value):
view = self.navigate_to(self, 'All')
return view.search(value)

def new_ui_button(self):
"""Click New UI button and return the browser URL"""
view = self.navigate_to(self, 'All')
view.new_ui_button.click()
view.wait_displayed()
return self.browser.url

def reset_search(self):
"""This function loads a HostsView and clears the searchbox."""
view = HostsView(self.browser)
Expand Down
32 changes: 30 additions & 2 deletions airgun/entities/job_invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
JobInvocationCreateView,
JobInvocationStatusView,
JobInvocationsView,
NewJobInvocationStatusView,
)


Expand All @@ -30,9 +31,10 @@ def search(self, value):
view = self.navigate_to(self, 'All')
return view.search(value)

def read(self, entity_name, host_name, widget_names=None):
def read(self, entity_name, host_name, widget_names=None, new_ui=False):
"""Read values for scheduled or already executed job"""
view = self.navigate_to(self, 'Job Status', entity_name=entity_name, host_name=host_name)
nav_step = 'Job Status' if not new_ui else 'Job Status New UI'
view = self.navigate_to(self, nav_step, entity_name=entity_name, host_name=host_name)
return view.read(widget_names=widget_names)

def wait_job_invocation_state(self, entity_name, host_name, expected_state='succeeded'):
Expand Down Expand Up @@ -124,3 +126,29 @@ def prerequisite(self, *args, **kwargs):
def step(self, *args, **kwargs):
self.parent.search(f'host = {kwargs.get("host_name")}')
self.parent.table.row(description=kwargs.get('entity_name'))['Description'].widget.click()


@navigator.register(JobInvocationEntity, 'Job Status New UI')
class NewJobStatus(NavigateStep):
"""Navigate to the new job invocation details page.
Note: `Show Experimental Labs` setting must be enabled.
Args:
entity_name: name of the job
host_name: name of the host to which job was applied
"""

VIEW = NewJobInvocationStatusView

def prerequisite(self, *args, **kwargs):
return self.navigate_to(
self.obj,
'Job Status',
entity_name=kwargs.get('entity_name'),
host_name=kwargs.get('host_name'),
)

def step(self, *args, **kwargs):
self.parent.new_ui.click()
self.view.browser.plugin.ensure_page_safe()
self.view.wait_displayed()
Loading

0 comments on commit cd43ff9

Please sign in to comment.