def submit(self, modal_absent=True): """Submit form.""" submit_button = ui.Button(*self.submit_locator) submit_button.container = self submit_button.click() if modal_absent: self._modal.wait_for_absence()
def cancel(self, modal_absent=True): """Cancel form.""" cancel_button = ui.Button(*self.cancel_locator) cancel_button.container = self cancel_button.click() if modal_absent: self._modal.wait_for_absence()
def _click_button_by_locator(self, locator, modal_absent=True, modal_timeout=None): """Find button by locator and click it.""" button = ui.Button(*locator) button.container = self button.click() if modal_absent: self._modal.wait_for_absence(timeout=modal_timeout)
# See the License for the specific language governing permissions and # limitations under the License. from pom import ui from selenium.webdriver.common.by import By from horizon_autotests.app import ui as _ui @ui.register_ui(field_name=ui.TextField(By.NAME, 'name')) class FormCreateKeypair(_ui.Form): """Form to create keypair.""" @ui.register_ui( button_delete_keypair=ui.Button(By.CSS_SELECTOR, '[id*="action_delete"]'), checkbox=_ui.CheckBox(By.CSS_SELECTOR, 'input[type="checkbox"]')) class RowKeypair(_ui.Row): """Row of keypair in keypairs table.""" class TableKeypairs(_ui.Table): """Keypairs table.""" columns = {'name': 2} row_cls = RowKeypair @ui.register_ui(field_name=ui.TextField(By.NAME, 'name'), field_public_key=ui.TextField(By.NAME, 'public_key')) class FormImportKeypair(_ui.Form):
from pom import ui from selenium.webdriver.common.by import By from stepler.horizon.app import ui as _ui from .base import PageBase @ui.register_ui(field_volumes=ui.IntegerField(By.NAME, 'volumes'), field_key_pairs=ui.IntegerField(By.NAME, 'key_pairs'), field_instances=ui.IntegerField(By.NAME, 'instances')) class FormUpdateDefaults(_ui.Form): """Form to update defaults.""" @ui.register_ui( button_update_defaults=ui.Button(By.ID, 'quotas__action_update_defaults'), form_update_defaults=FormUpdateDefaults(By.CSS_SELECTOR, '[action*="update_defaults"]'), label_key_pairs=ui.UI(By.XPATH, '//tr[@id="quotas__row__key_pairs"]/td[2]'), label_volumes=ui.UI(By.XPATH, '//tr[@id="quotas__row__volumes"]/td[2]'), label_instances=ui.UI(By.XPATH, '//tr[@id="quotas__row__instances"]/td[2]')) class PageDefaults(PageBase): """Defaults page.""" url = "/admin/defaults/" navigate_items = "Admin", "System", "Defaults"
checkbox=_ui.CheckBox(By.CSS_SELECTOR, 'input[type="checkbox"]'), dropdown_menu=_ui.DropdownMenu()) class RowNamespace(_ui.Row): """Row with namespace in namespaces table.""" class TableNamespaces(_ui.Table): """Namespaces table.""" columns = {'name': 2} row_cls = RowNamespace @ui.register_ui( field_namespace_json=ui.TextField(By.NAME, 'direct_input'), combobox_namespace_source=_ui.combobox_by_label( "Namespace Definition Source")) class FormImportNamespace(_ui.Form): """Form to create namespace.""" @ui.register_ui( button_import_namespace=ui.Button(By.ID, 'namespaces__action_import'), form_import_namespace=FormImportNamespace(By.ID, 'create_metadata_form'), table_namespaces=TableNamespaces(By.ID, 'namespaces')) class PageMetadataDefinitions(PageBase): """Metadata definitions page.""" url = "/admin/metadata_defs/" navigate_items = 'Admin', 'System', 'Metadata Definitions'
@ui.register_ui(field_metadata_name=ui.UI(By.CSS_SELECTOR, '[ng-bind$="item.leaf.name"]'), field_metadata_value=ui.TextField( By.CSS_SELECTOR, '[ng-model$="item.leaf.value"]')) class RowMetadata(_ui.Row): """Row of added metadata.""" class ListMetadata(ui.List): """List of added metadata.""" row_cls = RowMetadata row_xpath = './li[contains(@ng-repeat, "item in existingList")]' @ui.register_ui(button_add_metadata=ui.Button(By.CSS_SELECTOR, '[ng-click*="addCustom"]'), field_metadata_name=ui.TextField(By.NAME, 'customItem'), existing_metadata_filter=ui.TextField( By.CSS_SELECTOR, '[ng-model="ctrl.filterText.existing"]'), button_delete_metadata=ui.Button(By.CSS_SELECTOR, 'a.btn > span.fa-minus'), list_metadata=ListMetadata(By.CSS_SELECTOR, 'ul[ng-form$="metadataForm"]')) class FormUpdateMetadata(_ui.Form): """Form to update image metadata.""" submit_locator = By.CSS_SELECTOR, '.btn[ng-click$="modal.save()"]' cancel_locator = By.CSS_SELECTOR, '.btn[ng-click$="modal.cancel()"]' class FormUpdateImage(FormImage):
"""Dropdown menu of floating IP.""" @ui.register_ui(checkbox=_ui.CheckBox(By.CSS_SELECTOR, 'input[type="checkbox"]'), dropdown_menu=DropdownMenu()) class RowFloatingIP(_ui.Row): """Row with floating ip.""" class TableFloatingIPs(_ui.Table): """Table with floating IPs.""" columns = {'ip_address': 2, 'mapped_fixed_ip_address': 3} row_cls = RowFloatingIP @ui.register_ui(combobox_port=ui.ComboBox(By.NAME, 'instance_id')) class FormAssociate(_ui.Form): """Form to associate.""" @ui.register_ui( button_allocate_ip=ui.Button(By.ID, 'floating_ips__action_allocate'), form_allocate_ip=FormAllocateIP(By.ID, 'associate_floating_ip_form'), form_associate=FormAssociate(By.CSS_SELECTOR, '[action*="floating_ips/associate"]'), table_floating_ips=TableFloatingIPs(By.ID, 'floating_ips')) class TabFloatingIPs(_ui.Tab): """Floating IPs tab."""
@ui.register_ui(checkbox=_ui.CheckBox(By.CSS_SELECTOR, 'input[type="checkbox"]'), dropdown_menu=_ui.DropdownMenu()) class RowBackup(_ui.Row): """Volume backup row of volume backups table.""" transit_statuses = ('Creating', ) @ui.register_ui(link_next=ui.UI(By.CSS_SELECTOR, 'a[href^="?backup_marker="]'), link_prev=ui.UI(By.CSS_SELECTOR, 'a[href^="?prev_backup_marker="]')) class TableBackups(_ui.Table): """Volume backups table.""" columns = { 'name': 2, 'description': 3, 'size': 4, 'status': 5, 'volume_name': 6 } row_cls = RowBackup @ui.register_ui(button_delete_backups=ui.Button( By.ID, 'volume_backups__action_delete'), table_backups=TableBackups(By.ID, 'volume_backups')) class TabBackups(_ui.Tab): """Volume backups tab."""
class CellMovie(ui.Block): """Cell of movie row.""" @property def value(self): """Cell value.""" def _clean_html(raw_html): return re.sub(r'<.*?>', '', raw_html) return _clean_html(super(CellMovie, self).value).strip() @ui.register_ui(link_poster=ui.Link(By.CSS_SELECTOR, 'td.posterColumn > a'), link_title=ui.Link(By.CSS_SELECTOR, 'td.titleColumn > a'), label_year=ui.Link(By.CSS_SELECTOR, 'td.titleColumn > .secondaryInfo'), button_your_rating=ui.Button(By.CSS_SELECTOR, 'td.ratingColumn .unseen'), button_watch_list=ui.Button(By.CSS_SELECTOR, 'td.watchlistColumn .standalone')) class RowMovie(ui.Row): """Row with movie.""" cell_cls = CellMovie class TableMovies(ui.Table): """Table of movies.""" row_cls = RowMovie columns = { 'poster': 1, 'title': 2,
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from pom import ui from selenium.webdriver.common.by import By @ui.register_ui( button_toggle=ui.Button(By.CSS_SELECTOR, '.dropdown-toggle'), item_default=ui.UI(By.CSS_SELECTOR, 'button:nth-of-type(1), a:nth-of-type(1)'), item_delete=ui.UI(By.CSS_SELECTOR, '[id$="action_delete"]'), item_edit=ui.UI(By.CSS_SELECTOR, '[id$="action_edit"]')) class DropdownMenu(ui.Block): """Dropdown menu.""" def __init__(self, *args, **kwgs): """Constructor. It has predefined selector. """ super(DropdownMenu, self).__init__(*args, **kwgs) self.locator = By.CSS_SELECTOR, '.btn-group'
@ui.register_ui(field_confirm_password=ui.TextField(By.NAME, 'confirm_password'), field_password=ui.TextField(By.NAME, 'password')) class FormChangePassword(_ui.Form): """Form to change user password.""" @ui.register_ui(field_name=ui.TextField(By.NAME, 'name'), combox_project=_ui.combobox_by_label("Primary Project")) class FormUpdateUser(_ui.Form): """Form to update user.""" @ui.register_ui(button_submit=ui.Button(By.CSS_SELECTOR, '.btn.btn-danger')) class FormSubmit(_ui.Form): """Form to submit.""" @ui.register_ui(button_create_user=ui.Button(By.ID, 'users__action_create'), button_delete_users=ui.Button(By.ID, 'users__action_delete'), button_filter_users=ui.Button(By.ID, 'users__action_filter'), field_filter_users=ui.TextField(By.NAME, 'users__filter__q'), form_change_password=FormChangePassword( By.ID, 'change_user_password_form'), form_create_user=FormCreateUser(By.ID, 'create_user_form'), form_update_user=FormUpdateUser(By.ID, 'update_user_form'), form_submit=FormSubmit(By.CSS_SELECTOR, 'div.modal-content'), table_users=TableUsers(By.ID, 'users')) class PageUsers(PageBase):
@ui.register_ui(checkbox=_ui.CheckBox(By.CSS_SELECTOR, 'input[type="checkbox"]'), dropdown_menu=DropdownMenu()) class RowNetwork(_ui.Row): """Row with network in networks table.""" class TableNetworks(_ui.Table): """Networks table.""" columns = {'name': 2, 'shared': 4} row_cls = RowNetwork @ui.register_ui(button_next=ui.Button(By.CSS_SELECTOR, '.button-next'), checkbox_create_subnet=_ui.CheckBox(By.NAME, 'with_subnet'), checkbox_shared=_ui.CheckBox(By.NAME, 'shared'), field_gateway_ip=ui.TextField(By.NAME, 'gateway_ip'), field_name=ui.TextField(By.NAME, 'net_name'), field_network_address=ui.TextField(By.NAME, 'cidr'), field_subnet_name=ui.TextField(By.NAME, 'subnet_name')) class FormCreateNetwork(_ui.Form): """Form to create network.""" submit_locator = By.CSS_SELECTOR, '.btn.btn-primary.button-final' cancel_locator = By.CSS_SELECTOR, '.btn.btn-default.cancel' @ui.register_ui(button_next=ui.Button(By.CSS_SELECTOR, '.button-next'), field_name=ui.TextField(By.NAME, 'subnet_name'),
"""Row with host aggregate in host aggregates table.""" class TableHostAggregates(_ui.Table): """Host aggregates table.""" columns = {'name': 2} row_cls = RowHostAggregate @ui.register_ui(field_name=ui.TextField(By.NAME, 'name')) class FormCreateHostAggregate(_ui.Form): """Form to create host aggregate.""" submit_locator = By.CSS_SELECTOR, 'input[type="submit"]' @ui.register_ui( button_create_host_aggregate=ui.Button(By.ID, 'host_aggregates__action_create'), button_delete_host_aggregates=ui.Button(By.ID, 'host_aggregates__action_delete'), form_create_host_aggregate=FormCreateHostAggregate( By.CSS_SELECTOR, '[action*="aggregates/create"]'), table_host_aggregates=TableHostAggregates(By.ID, 'host_aggregates')) class PageHostAggregates(PageBase): """Host aggregates Page.""" url = "/admin/aggregates/" navigate_items = 'Admin', 'System', 'Host Aggregates'
By.XPATH, 'label[contains(@class, "active")]').text @value.setter @ui.wait_for_presence def value(self, val): """Set value of radio buttons group.""" self.webelement.find_element(By.XPATH, 'label[text()="{}"]'.format(val)).click() @ui.register_ui(label_alert=ui.UI(By.CSS_SELECTOR, 'span.invalid')) class CellAvailable(_ui.Cell): """Cell.""" @ui.register_ui(button_add=ui.Button(By.CSS_SELECTOR, 'button.btn.btn-default')) class RowAvailable(_ui.Row): """Row with available item.""" cell_cls = CellAvailable @ui.register_ui(button_remove=ui.Button(By.CSS_SELECTOR, 'button.btn.btn-default')) class RowAllocated(_ui.Row): """Row with allocated item.""" cell_cls = CellAvailable class TableAvailableSources(_ui.Table):
label_name=ui.UI(By.CSS_SELECTOR, "div.name"), edit_icon=ui.UI(By.XPATH, './/span[@class="glyphicon edit-icon"]')) class RowCluster(ui.Row): """Row of cluster.""" class ListClusters(ui.List): """List of clusters.""" row_cls = RowCluster row_xpath = './/div[contains(@class, "box")]' @ui.register_ui( field_name=ui.TextField(By.NAME, 'cluster_name')) class FormCreateCluster(_ui.Form): """Form to create cluster.""" @ui.register_ui( button_create_cluster=ui.Button( By.CSS_SELECTOR, "div.main-button > button.btn-primary"), form_create_cluster=FormCreateCluster( By.CSS_SELECTOR, "div.modal-content"), list_clusters=ListClusters(By.CSS_SELECTOR, "div.clusters.row")) class PageClusters(base.PageBase): """Page to management clusters.""" url = "/clusters" page_header_value = "Cluster"
'input[type="checkbox"]'), dropdown_menu=DropdownMenu(), link_instance=ui.Link(By.CSS_SELECTOR, 'td > a')) class RowInstance(_ui.Row): """Row with instance.""" transit_statuses = ('Build', ) class TableInstances(_ui.Table): """Instances table.""" columns = {'name': 4, 'status': 8} row_cls = RowInstance @ui.register_ui(button_delete_instances=ui.Button(By.ID, 'instances__action_delete'), button_filter_instances=ui.Button( By.ID, 'instances__action_filter_admin_instances'), field_filter_instances=ui.TextField( By.NAME, 'instances__filter_admin_instances__q'), combobox_filter_target=ui.ComboBox( By.NAME, 'instances__filter_admin_instances__q_field'), table_instances=TableInstances(By.ID, 'instances')) class PageAdminInstances(PageBase): """Admin instances page.""" url = "/admin/instances/" navigate_items = 'Admin', 'System', "Instances"
@ui.register_ui( field_username=ui.TextField( By.CSS_SELECTOR, '.form-group:nth-of-type(1) > input[type="text"]'), field_project_name=ui.TextField( By.CSS_SELECTOR, '.form-group:nth-of-type(2) > input[type="text"]'), field_project_id=ui.TextField( By.CSS_SELECTOR, '.form-group:nth-of-type(3) > input[type="text"]'), field_auth_url=ui.TextField( By.CSS_SELECTOR, '.form-group:nth-of-type(4) > input[type="text"]')) class FormUserCredentials(_ui.Form): """Form with user credentials.""" @ui.register_ui( button_download_v2_file=ui.Button( By.ID, 'endpoints__action_download_openrc_v2'), button_download_v3_file=ui.Button( By.ID, 'endpoints__action_download_openrc'), button_view_credentials=ui.Button( By.ID, 'endpoints__action_view_credentials'), form_user_credentials=FormUserCredentials(By.CSS_SELECTOR, 'div.modal-content'), label_identity=ui.UI( By.CSS_SELECTOR, 'tr[data-display="keystone"] > td:nth-of-type(2)'), label_volume=ui.UI( By.CSS_SELECTOR, 'tr[data-display="cinder"] > td:nth-of-type(2)')) class TabApiAccess(_ui.Tab): """Api Access tab."""
@ui.register_ui(field_metadata_name=ui.UI(By.CSS_SELECTOR, '[ng-bind$="item.leaf.name"]'), field_metadata_value=ui.TextField( By.CSS_SELECTOR, '[ng-model$="item.leaf.value"]')) class RowMetadata(_ui.Row): """Row of added metadata.""" class ListMetadata(ui.List): """List of added metadata.""" row_cls = RowMetadata row_xpath = './li[contains(@ng-repeat, "item in existingList")]' @ui.register_ui(button_add_metadata=ui.Button(By.CSS_SELECTOR, '[ng-click*="addCustom"]'), field_metadata_name=ui.TextField(By.NAME, 'customItem'), list_metadata=ListMetadata(By.CSS_SELECTOR, 'ul[ng-form$="metadataForm"]')) class FormUpdateMetadata(_ui.Form): """Form to update image metadata.""" submit_locator = By.CSS_SELECTOR, '.btn[ng-click$="modal.save()"]' cancel_locator = By.CSS_SELECTOR, '.btn[ng-click$="modal.cancel()"]' @ui.register_ui(checkbox_protected=_ui.CheckBox(By.NAME, 'protected'), field_name=ui.TextField(By.NAME, 'name')) class FormUpdateImage(_ui.Form): """Form to update image."""
class FormEditProject(_ui.Form): """Form to edit project.""" submit_locator = By.CSS_SELECTOR, 'input.btn.btn-primary' @ui.register_ui( button_add_user=ui.UI(By.CSS_SELECTOR, '.btn.btn-primary')) class FormAvailableMembers(_ui.Form): """Project members form.""" submit_locator = By.CSS_SELECTOR, '.modal-footer .btn.btn-primary' @ui.register_ui( button_create_project=ui.Button(By.ID, 'tenants__action_create'), button_filter_projects=ui.Button(By.CLASS_NAME, 'fa-search'), field_filter_projects=ui.TextField(By.NAME, 'tenants__filter__q'), form_create_project=FormCreateProject(By.CSS_SELECTOR, 'form[action*="identity/create"]'), form_delete_project_confirm=_ui.Form(By.CSS_SELECTOR, 'div.modal-content'), form_edit_project=FormEditProject(By.CLASS_NAME, 'modal-content'), table_projects=TableProjects(By.ID, 'tenants'), form_available_members=FormAvailableMembers(By.CSS_SELECTOR, 'div.modal-content')) class PageProjects(PageBase): """Projects page.""" url = "/identity/" navigate_items = "Identity", "Projects"
from pom import ui from selenium.webdriver.common.by import By from horizon_autotests.app import ui as _ui from .base import PageBase @ui.register_ui(checkbox_public=_ui.CheckBox(By.NAME, 'public'), field_name=ui.TextField(By.NAME, 'name')) class FormCreateContainer(_ui.Form): """Form to create container.""" @ui.register_ui( button_delete_container=ui.Button(By.CSS_SELECTOR, '[ng-click*="deleteContainer"]'), label_created_date=ui.UI(By.CSS_SELECTOR, '.hz-object-timestamp .hz-object-val'), label_objects_count=ui.UI(By.CSS_SELECTOR, '.hz-object-count .hz-object-val'), label_size=ui.UI(By.CSS_SELECTOR, '.hz-object-size .hz-object-val'), link_public_url=ui.Link(By.CSS_SELECTOR, '.hz-object-link a[ng-show*="public_url"]')) class RowContainer(_ui.Row): """Row with container.""" class ListContainers(ui.List): """List of containers.""" row_cls = RowContainer
from pom import ui from selenium.webdriver.common.by import By from stepler.horizon.app import ui as _ui from .base import PageBase @ui.register_ui(checkbox_public=_ui.CheckBox(By.NAME, 'public'), field_name=ui.TextField(By.NAME, 'name')) class FormCreateContainer(_ui.Form): """Form to create container.""" @ui.register_ui( button_delete_container=ui.Button(By.CSS_SELECTOR, '[ng-click*="deleteContainer"]'), label_created_date=ui.UI(By.CSS_SELECTOR, '.hz-object-timestamp .hz-object-val'), label_objects_count=ui.UI(By.CSS_SELECTOR, '.hz-object-count .hz-object-val'), label_size=ui.UI(By.CSS_SELECTOR, '.hz-object-size .hz-object-val'), link_public_url=ui.Link(By.CSS_SELECTOR, '.hz-object-link a[ng-show*="public_url"]')) class RowContainer(_ui.Row): """Row with container.""" class ListContainers(ui.List): """List of containers.""" row_cls = RowContainer
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import os from pom import ui from selenium.webdriver.common.by import By @ui.register_ui( browse_button=ui.Button(By.TAG_NAME, 'button'), field_input=ui.UI(By.TAG_NAME, 'input'), ) class FileField(ui.Block): """Themable file field.""" @property @ui.wait_for_presence def value(self): """Get file path.""" return self.field_input.value @value.setter @ui.wait_for_presence def value(self, value): """Set file to upload."""
from selenium.webdriver.common.by import By from stepler.horizon.app import ui as _ui @ui.register_ui(field_description=ui.TextField(By.NAME, 'description'), field_name=ui.TextField(By.NAME, 'name')) class FormCreateSecurityGroup(_ui.Form): """Form to create security group.""" @ui.register_ui(dropdown_menu=_ui.DropdownMenu()) class RowSecurityGroup(_ui.Row): """Security group row.""" class TableSecurityGroups(_ui.Table): """Security groups table.""" row_cls = RowSecurityGroup @ui.register_ui( button_create_security_group=ui.Button(By.ID, 'security_groups__action_create'), form_create_security_group=FormCreateSecurityGroup( By.ID, 'create_security_group_form'), table_security_groups=TableSecurityGroups(By.ID, 'security_groups')) class TabSecurityGroups(_ui.Tab): """Security groups tab."""
class FormUploadToImage(_ui.Form): """Form to upload volume to image.""" @ui.register_ui(field_new_size=ui.IntegerField(By.NAME, 'new_size')) class FormExtendVolume(_ui.Form): """Form extend volume.""" @ui.register_ui(field_description=ui.TextField(By.NAME, 'description'), field_name=ui.TextField(By.NAME, 'name')) class FormCreateSnapshot(_ui.Form): """Form create volume snapshot.""" @ui.register_ui(detach_volume_button=ui.Button(By.CSS_SELECTOR, '[id$="action_detach"]')) class RowAttachedInstance(_ui.Row): """Row with attached instance to volume.""" class TableAttachedInstances(_ui.Table): """Table of attached instances to volume.""" columns = {'name': 2} row_cls = RowAttachedInstance @ui.register_ui(combobox_instance=_ui.combobox_by_label("Attach to Instance"), table_instances=TableAttachedInstances(By.ID, 'attachments')) class FormManageAttachments(_ui.Form): """Form to manage volume attachments."""
@ui.register_ui(field_new_size=ui.IntegerField(By.NAME, 'new_size')) class FormExtendVolume(_ui.Form): """Form extend volume.""" @ui.register_ui( field_description=ui.TextField(By.NAME, 'description'), field_name=ui.TextField(By.NAME, 'name')) class FormCreateSnapshot(_ui.Form): """Form create volume snapshot.""" @ui.register_ui( detach_volume_button=ui.Button(By.CSS_SELECTOR, '[id$="action_detach"]')) class RowAttachedInstance(_ui.Row): """Row with attached instance to volume.""" class TableAttachedInstances(_ui.Table): """Table of attached instances to volume.""" columns = {'name': 2} row_cls = RowAttachedInstance @ui.register_ui( combobox_instance=_ui.combobox_by_label("Attach to Instance"), table_instances=TableAttachedInstances(By.ID, 'attachments')) class FormManageAttachments(_ui.Form):
@ui.register_ui(dropdown_menu=_ui.DropdownMenu()) class RowQosSpec(_ui.Row): """QoS Spec row of QoS Specs table.""" class TableQosSpecs(_ui.Table): """QoS Specs table.""" columns = {'name': 2} row_cls = RowQosSpec @ui.register_ui(field_consumer=ui.ComboBox(By.NAME, 'consumer'), field_name=ui.TextField(By.NAME, 'name')) class FormCreateQosSpec(_ui.Form): """Form to create QoS Spec.""" @ui.register_ui( button_create_qos_spec=ui.Button(By.ID, 'qos_specs__action_create'), button_create_volume_type=ui.Button(By.ID, 'volume_types__action_create'), form_create_qos_spec=FormCreateQosSpec( By.CSS_SELECTOR, 'form[action*="volume_types/create_qos_spec"]'), form_create_volume_type=FormCreateVolumeType( By.CSS_SELECTOR, 'form[action*="volume_types/create_type"]'), table_qos_specs=TableQosSpecs(By.ID, 'qos_specs'), table_volume_types=TableVolumeTypes(By.ID, 'volume_types')) class TabVolumeTypes(_ui.Tab): """Volume types tab."""
class TableSnapshots(_ui.Table): """Volume snapshots table.""" columns = {'name': 2, 'description': 3, 'size': 4, 'status': 5, 'volume_name': 6} row_cls = RowSnapshot @ui.register_ui( combobox_source=ui.ComboBox(By.NAME, 'snapshot_source'), combobox_type=ui.ComboBox(By.NAME, 'type'), field_description=ui.TextField(By.NAME, 'description'), field_name=ui.TextField(By.NAME, 'name'), field_size=ui.IntegerField(By.NAME, 'size')) class FormCreateVolume(_ui.Form): """Form to create volume from snapshot.""" @ui.register_ui( button_delete_snapshots=ui.Button(By.ID, 'volume_snapshots__action_delete'), form_create_volume=FormCreateVolume(By.CSS_SELECTOR, 'form[action*="volumes/create"]'), form_edit_snapshot=FormCreateSnapshot(By.ID, 'update_snapshot_form'), table_snapshots=TableSnapshots(By.ID, 'volume_snapshots')) class TabSnapshots(_ui.Tab): """Volume snapshots tab."""
columns = {'name': 2} row_cls = RowFlavor @ui.register_ui(field_name=ui.TextField(By.NAME, 'name'), field_ram=ui.IntegerField(By.NAME, 'memory_mb'), field_root_disk=ui.IntegerField(By.NAME, 'disk_gb'), field_vcpus=ui.IntegerField(By.NAME, 'vcpus')) class FormCreateFlavor(_ui.Form): """Form to create flavor.""" submit_locator = By.CSS_SELECTOR, '[type="submit"]' @ui.register_ui(button_add=ui.Button(By.CSS_SELECTOR, '.btn.btn-primary')) class RowProject(_ui.Row): """Row with project.""" class ListProjects(ui.List): """List of projects.""" row_cls = RowProject row_xpath = './ul[contains(@class, "btn-group")]' @ui.register_ui(field_name=ui.TextField(By.NAME, 'name'), label_access=ui.UI(By.CSS_SELECTOR, '[data-target$="update_flavor_access"]'), label_info=ui.UI(By.CSS_SELECTOR,
@ui.register_ui(checkbox=_ui.CheckBox(By.CSS_SELECTOR, 'input[type="checkbox"]'), dropdown_menu=_ui.DropdownMenu()) class RowRules(_ui.Row): """User row of rules table.""" class TableManageRules(_ui.Table): """Manage rules table.""" columns = {'port_range': 5} row_cls = RowRules @ui.register_ui(field_port=ui.TextField(By.NAME, 'port')) class FormAddRules(_ui.Form): """Form to add rules.""" @ui.register_ui(button_add_rule=ui.Button(By.ID, 'rules__action_add_rule'), button_delete_rules=ui.Button(By.ID, 'rules__action_delete'), form_add_rule=FormAddRules(By.ID, 'create_security_group_rule_form'), table_rules=TableManageRules(By.ID, 'rules')) class PageManageRules(PageBase): """Manage rules page.""" url = "/project/security_groups/{id}/"