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

removing updated value and takes default value #1643

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions airgun/entities/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,26 @@ def refresh_applicability(self, entity_name):
self.browser.plugin.ensure_page_safe()
view.dropdown.item_select('Refresh applicability')

def update_variable_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)
# Index [5] essentially refers to the button used to edit the value. The same index is then applied to either 'Yes' or 'No' options to update the value
view.ansible.variables.table.row(name=key)[5].widget.click()
Gauravtalreja1 marked this conversation as resolved.
Show resolved Hide resolved
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()

def del_variable_value(self, entity_name):
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()

def read_variable_value(self, entity_name, key):
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
value = view.ansible.variables.table.row(name=key)['Value'].read()
return value


@navigator.register(NewHostEntity, 'NewDetails')
class ShowNewHostDetails(NavigateStep):
Expand Down
18 changes: 14 additions & 4 deletions airgun/views/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,20 +513,30 @@ 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={
'Name': Text('.//a'),
'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"]'),
Comment on lines +530 to +533
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why changing the buttons order here?
and could you add some descriptions about change to this locators in the description?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Locators 6 and 7 are not supported, and there is no column for the edit, submit, or cancel buttons. Based on the index, these buttons correspond to key 5. To enable editing, I added the edit locator under key 5. For submitting the value, I created another variable with the same key (5) but for the submit action. However, combining them does not work—I tried that as well.

},
)
table1 = Table(
locator='.//table[contains(@class, "pf-c-table")]',
column_widgets={
5: Button(locator='.//button[@aria-label="Submit editing override button"]'),
},
)
pagination = PF4Pagination()
Expand Down
Loading