From d12b4916b74a52e27e879061eecafbbaacf2da8a Mon Sep 17 00:00:00 2001 From: amol patil Date: Fri, 15 Nov 2024 14:01:42 +0530 Subject: [PATCH] removing updated value with default --- airgun/entities/host_new.py | 16 ++++++++++++++++ airgun/views/host_new.py | 18 ++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/airgun/entities/host_new.py b/airgun/entities/host_new.py index 9ae802b1c..f248cbfbb 100644 --- a/airgun/entities/host_new.py +++ b/airgun/entities/host_new.py @@ -975,6 +975,22 @@ def refresh_applicability(self, entity_name): self.browser.plugin.ensure_page_safe() view.dropdown.item_select('Refresh applicability') + def read_update_value(self, entity_name, key, value): + view = self.navigate_to(self, 'NewDetails', entity_name=entity_name) + wait_for(lambda: view.ansible.variables.table.is_displayed, timeout=10) + view.ansible.variables.table.row(name=key)[5].widget.click() + view.ansible.variables.table.row(name=key)['Value'].click() + view.ansible.variables.table.row(name=key)['Value'].widget.fill(value) + view.ansible.variables.table1.row(name=key)[5].widget.click() + return view.ansible.variables.table.row(name=key)['Value'].read() + + def read_delete_value(self, entity_name, key): + view = self.navigate_to(self, 'NewDetails', entity_name=entity_name) + view.ansible.variables.actions.click() + view.ansible.variables.delete.click() + view.ansible.variables.confirm.click() + return view.ansible.variables.table.row(name=key)['Value'].read() + @navigator.register(NewHostEntity, 'NewDetails') class ShowNewHostDetails(NavigateStep): diff --git a/airgun/views/host_new.py b/airgun/views/host_new.py index 6632386be..2b314f9d5 100644 --- a/airgun/views/host_new.py +++ b/airgun/views/host_new.py @@ -513,6 +513,10 @@ class roles(Tab): class variables(Tab): TAB_NAME = 'Variables' ROOT = './/div[@class="ansible-host-detail"]' + + actions = Button(locator='//tbody/tr/td[7]//button') + delete = Button(locator='//button[@role="menuitem"]') + confirm = Button(locator='//button[@data-ouia-component-id="btn-modal-confirm"]') table = Table( locator='.//table[contains(@class, "pf-c-table")]', column_widgets={ @@ -520,15 +524,21 @@ class variables(Tab): 'Ansible role': Text('./span'), 'Type': Text('./span'), # the next field can also be a form group - 'Value': Text('./span'), + 'Value': TextInput(locator='//textarea[contains(@class, "pf-c-form")]'), 'Source attribute': Text('./span'), # The next 2 buttons are hidden by default, but appear in this order - 5: Button(locator='.//button[@aria-label="Cancel editing override button"]'), - 6: Button(locator='.//button[@aria-label="Submit override button"]'), + 6: Button(locator='.//button[@aria-label="Cancel editing override button"]'), + 7: Button(locator='.//button[@aria-label="Submit override button"]'), # Clicking this button hides it, and displays the previous 2 - 7: Button(locator='.//button[@aria-label="Edit override button"]'), + 5: Button(locator='.//button[@aria-label="Edit override button"]'), }, ) + table1 = Table( + locator='.//table[contains(@class, "pf-c-table")]', + column_widgets={ + 5: Button(locator='.//button[@aria-label="Submit editing override button"]'), + } + ) pagination = PF4Pagination() @View.nested