-
Notifications
You must be signed in to change notification settings - Fork 65
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
No blank cv/french view #991
base: master
Are you sure you want to change the base?
Changes from 4 commits
4e365ef
daf0f03
3d5c881
b33e81d
11627cd
bc9d0a4
ce63985
1cd34ef
ef2219d
5ab088d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import time | ||
from widgetastic.widget import ( | ||
Checkbox, | ||
ConditionalSwitchableView, | ||
|
@@ -12,6 +13,8 @@ | |
from widgetastic_patternfly import BreadCrumb, Button, Tab, TabWithDropdown | ||
from widgetastic_patternfly4.navigation import Navigation | ||
from widgetastic_patternfly4.ouia import Dropdown | ||
from widgetastic_patternfly4.ouia import PatternflyTable | ||
from widgetastic_patternfly4.ouia import Button as PF4Button | ||
|
||
from airgun.utils import get_widget_by_name, normalize_dict_values | ||
from airgun.widgets import ( | ||
|
@@ -383,6 +386,71 @@ class add_tab(AddTab): | |
) | ||
|
||
|
||
class NewAddRemoveResourcesView(View): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add doc string for a class which would help to understand added functionality. |
||
searchbox = PF4Search() | ||
type = Dropdown( | ||
locator='.//div[contains(@class, "All repositories") or' | ||
' contains(@aria-haspopup="listbox")]' | ||
) | ||
Status = Dropdown( | ||
locator='.//div[contains(@class, "All") or contains(@aria-haspopup="listbox")]' | ||
) | ||
add_repo = PF4Button('OUIA-Generated-Button-secondary-2') | ||
sambible marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These "generated" locators may not be very stable, is there any alternative, like label? |
||
# Need to add kebab menu | ||
table = PatternflyTable( | ||
component_id='OUIA-Generated-Table-4', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same, can you use some better locator? |
||
column_widgets={ | ||
0: Checkbox(locator='.//input[@type="checkbox"]'), | ||
'Type': Text('.//a'), | ||
'Name': Text('.//a'), | ||
'Product': Text('.//a'), | ||
'Sync State': Text('.//a'), | ||
'Content': Text('.//a'), | ||
'Status': Text('.//a'), | ||
}, | ||
) | ||
|
||
def search(self, value): | ||
"""Search for specific available resource and return the results""" | ||
self.searchbox.search(value) | ||
# Tried following ways to wait for table to be displayed, only sleep worked | ||
# Might need a before/after fill | ||
wait_for( | ||
lambda: self.table.is_displayed is True, | ||
timeout=60, | ||
delay=1, | ||
) | ||
time.sleep(3) | ||
sambible marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.table.wait_displayed() | ||
return self.table.read() | ||
|
||
def add(self, value): | ||
"""Associate specific resource""" | ||
self.search(value) | ||
next(self.table.rows())[0].widget.fill(True) | ||
self.add_repo.click() | ||
|
||
def fill(self, values): | ||
"""Associate resource(s)""" | ||
if not isinstance(values, list): | ||
values = list((values,)) | ||
for value in values: | ||
self.add(value) | ||
|
||
def remove(self, value): | ||
"""Unassign some resource(s). | ||
:param str or list values: string containing resource name or a list of | ||
such strings. | ||
""" | ||
self.search(value) | ||
next(self.table.rows())[0].widget.fill(True) | ||
self.remove_button.click() | ||
|
||
def read(self): | ||
"""Read all table values from both resource tables""" | ||
return self.table.read() | ||
|
||
|
||
class TemplateEditor(View): | ||
"""Default view for template entity editor that can be present for example | ||
on provisioning template of partition table pages. It contains from | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather name this differently
read_french_lang()
, here you are not checking this could be part of the test.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This is just a read in french without any assertion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yeah, that does make more sense. good suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sambible Good to add doc string which would describe functionality