class errata(SatTab): lce_filter = Select( locator='.//select[@ng-model="selectedErrataOption"]') searchbox = Search() apply_selected = ActionsDropdown( ".//span[contains(@class, 'btn-group')]") recalculate = Button('Recalculate') table = SatTable( './/table', column_widgets={ 0: Checkbox(locator="./input[@type='checkbox']"), 'Id': Text('./a'), } ) def search(self, query, lce=None): """Apply available filters before proceeding with searching and automatically set proper search mask if errata id instead of errata title was passed. :param str query: search query to type into search field. Both errata id (RHEA-2012:0055) and errata title (Sea_Erratum) are supported. :param str optional lce: filter by lifecycle environment :return: list of dicts representing table rows :rtype: list """ if lce is not None: self.lce_filter.fill(lce) if re.search(r'\w{4}-\d{4}:\d{4}', query): query = 'id = {}'.format(query) self.searchbox.search(query) return self.table.read()
class ComputeResourceGenericImageCreateView(BaseLoggedInView): """A Generic Compute Resource Image create view.""" breadcrumb = BreadCrumb() name = TextInput(id='image_name') operating_system = FilteredDropdown(id='image_operatingsystem_id') architecture = FilteredDropdown(id='image_architecture_id') username = TextInput(id='image_username') user_data = Checkbox(id='image_user_data') password = TextInput(id='image_password') image = FilteredDropdown(id='image_uuid') submit = Text('//input[@name="commit"]') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element( self.breadcrumb, exception=False, ensure_page_safe=True, timeout=10) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Compute Resources' and self.breadcrumb.locations[2] == 'Images' and self.breadcrumb.read() == 'Create image')
class CreateDiscoveredReposView(View): """View which represent Discovered Repository section in Repository Discovery procedure. """ searchbox = Search() table = SatTable( locator=".//table", column_widgets={ 0: Checkbox(locator=".//input[@ng-change='itemSelected(urlRow)']") }, ) create_action = Text("//button[contains(., 'Create Selected')]") def fill(self, values): """Select necessary repo/repos to be added to new or existing product""" if not isinstance(values, list): values = list((values, )) for value in values: self.table.row(discovered_repository__contains=value)[0].fill(True) self.create_action.click() def read(self): return self.table.read()
class add_tab(AddTab): table = SatSubscriptionsTable( locator=".//table", column_widgets={0: Checkbox(locator=".//input[@type='checkbox']")})
class LibvirtProviderForm(View): url = TextInput(id='compute_resource_url') display_type = Select(id='compute_resource_display_type') console_passwords = Checkbox( id='compute_resource_set_console_password')
class schema(WaitTab): # noqa schema_title = Text('//div[@class="form_div"]/h3') @ParametrizedView.nested class fields(ParametrizedView): # noqa PARAMETERS = ('name', ) # Points to the <tr> ROOT = ParametrizedLocator( './/input[starts-with(@id, "fields_name_") and @value={name|quote}]/../..') ALL_FIELDS = './/input[starts-with(@name, "fields_name_")]' @cached_property def row_id(self): attr = self.browser.get_attribute( 'id', './td/input[starts-with(@id, "fields_name_")', parent=self) return int(attr.rsplit('_', 1)[-1]) name = Input(name=ParametrizedString('fields_name_{@row_id}')) type = BootstrapSelect(ParametrizedString('fields_aetype_{@row_id}')) data_type = BootstrapSelect(ParametrizedString('fields_datatype_{@row_id}')) default_value = Input(name=ParametrizedString('fields_default_value_{@row_id}')) display_name = Input(name=ParametrizedString('fields_display_name_{@row_id}')) description = Input(name=ParametrizedString('fields_description_{@row_id}')) substitute = Checkbox(name=ParametrizedString('fields_substitute_{@row_id}')) collect = Input(name=ParametrizedString('fields_collect_{@row_id}')) message = Input(name=ParametrizedString('fields_message_{@row_id}')) on_entry = Input(name=ParametrizedString('fields_on_entry_{@row_id}')) on_exit = Input(name=ParametrizedString('fields_on_exit_{@row_id}')) on_error = Input(name=ParametrizedString('fields_on_error_{@row_id}')) max_retries = Input(name=ParametrizedString('fields_max_retries_{@row_id}')) max_time = Input(name=ParametrizedString('fields_max_time_{@row_id}')) def delete(self): if self.browser.product_version < '5.10': xpath = './/img[@alt="Click to delete this field from schema"]' else: xpath = './/a[@title="Click to delete this field from schema"]' self.browser.click(xpath, parent=self) try: del self.row_id except AttributeError: pass @classmethod def all(cls, browser): result = [] for e in browser.elements(cls.ALL_FIELDS): result.append((browser.get_attribute('value', e), )) return result add_field = VersionPicker({ Version.lowest(): Text('//img[@alt="Equal green"]'), '5.10': Text('//div[@id="class_fields_div"]//i[contains(@class, "fa-plus")]') }) name = Input(name='field_name') type = BootstrapSelect('field_aetype') data_type = BootstrapSelect('field_datatype') default_value = Input(name='field_default_value') display_name = Input(name='field_display_name') description = Input(name='field_description') substitute = Checkbox(name='field_substitute') collect = Input(name='field_collect') message = Input(name='field_message') on_entry = Input(name='field_on_entry') on_exit = Input(name='field_on_exit') on_error = Input(name='field_on_error') max_retries = Input(name='field_max_retries') max_time = Input(name='field_max_time') finish_add_field = VersionPicker({ Version.lowest(): Text('//img[@alt="Add this entry"]'), '5.10': Text('//a[@title="Add this entry"]') }) save_button = Button('Save') reset_button = Button('Reset') cancel_button = Button('Cancel')
class inventory(View): # noqa localhost = Checkbox(id="inventory_localhost") target_machine = Checkbox(id="inventory_event_target") specific_hosts = Checkbox(id="inventory_manual") hosts = Input(name="hosts")
class subnets(SatVerticalTab): all_subnets = Checkbox(id='organization_ignore_types_subnet') resources = MultiSelect(id='ms-organization_subnet_ids')
class users(SatVerticalTab): all_users = Checkbox(id='organization_ignore_types_user') resources = MultiSelect(id='ms-organization_user_ids')
class email_options(View): # noqa # Email Options send_if_empty = Checkbox("send_if_empty") send_txt = Checkbox("send_txt") send_csv = Checkbox("send_csv") send_pdf = Checkbox("send_pdf")
class email(View): # noqa # Email emails_send = Checkbox("send_email_cb") from_email = TextInput(name="from") to_emails = AlertEmail()
class charts(Tab): # noqa chart_type = BootstrapSelect("chosen_graph") chart_mode = BootstrapSelect("chart_mode") values_to_show = BootstrapSelect("chosen_count") sum_other_values = Checkbox("chosen_other")
class report(Tab): # noqa TAB_NAME = 'Report' event_details = Table("//div[@id='bottlenecks_report_div']/table") event_groups = BootstrapSelect('tl_report_fl_grp1') show_host_events = Checkbox(locator='//input[@name="tl_report_hosts"]') time_zone = BootstrapSelect("tl_report_tz")
class summary(Tab): # noqa TAB_NAME = 'Summary' event_groups = BootstrapSelect('tl_summ_fl_grp1') show_host_events = Checkbox(locator='//input[@name="tl_summ_hosts"]') time_zone = BootstrapSelect("tl_summ_tz") chart = TimelinesChart(locator='//div/*[@class="timeline-pf-chart"]')
class Nested2(View): input2 = Checkbox(id="input2")
class environments(SatVerticalTab): all_environments = Checkbox(id='organization_ignore_types_environment') resources = MultiSelect(id='ms-organization_environment_ids')
class host_groups(SatVerticalTab): TAB_NAME = 'Host Groups' all_hostgroups = Checkbox(id='organization_ignore_types_hostgroup') resources = MultiSelect(id='ms-organization_hostgroup_ids')
class modal(View): # noqa tree = ManageIQTree('automate_treebox') include_domain = Checkbox(id='include_domain_prefix_chk') apply = Button('Apply') cancel = Button('Cancel')
class capsules(SatVerticalTab): all_capsules = Checkbox(id='organization_ignore_types_smartproxy') resources = MultiSelect(id='ms-organization_smart_proxy_ids')
class compute_resources(SatVerticalTab): TAB_NAME = 'Compute Resources' all_resources = Checkbox( id='organization_ignore_types_computeresource') resources = MultiSelect(id='ms-organization_compute_resource_ids')
class SmartClassParameterContent(View): ROOT = ParametrizedLocator('{@locator}') key = TextInput(locator=".//input[contains(@name, '[key]')]") description = TextInput( locator=".//textarea[contains(@name, '[description]')]") puppet_environment = TextInput( locator=".//input[contains(@name, '[environment_classes]')]") puppet_class = TextInput( locator=".//input[contains(@name, '[puppetclass_id]')]") override = Checkbox( locator=".//input[contains(@name, '[override]') and @type!='hidden']") parameter_type = Select( locator=".//select[contains(@name, '[parameter_type]')]") default_value = TextInputHidden( locator=".//textarea[contains(@name, '[default_value]')]") omit = Checkbox( locator=".//input[contains(@name, '[omit]') and @type!='hidden']") hidden = Checkbox( locator= ".//input[contains(@name, '[hidden_value]') and @type!='hidden']") def __init__(self, parent, locator, logger=None): View.__init__(self, parent, logger=logger) self.locator = locator @View.nested class optional_input_validators(View): expander = Text( ".//h2[contains(@data-target, '#optional_input_validators_')]") required = Checkbox( locator= ".//input[contains(@name, '[required]') and @type!='hidden']") validator_type = Select( locator=".//select[contains(@name, '[validator_type]')]") validator_rule = TextInput( locator=".//input[contains(@name, '[validator_rule]')]") def __init__(self, parent, logger=None): View.__init__(self, parent, logger=logger) if 'collapsed' in self.browser.classes(self.expander): self.expander.click() self.browser.wait_for_element(self.validator_type, visible=True) @View.nested class prioritize_attribute_order(View): order = TextInput(locator="//textarea[@id='order']") merge_overrides = Checkbox( locator=".//input[contains(@id, 'merge_overrides')]") merge_default = Checkbox( locator=".//input[contains(@id, 'merge_default')]") avoid_duplicates = Checkbox( locator=".//input[contains(@id, 'avoid_duplicates')]") @View.nested class matchers(View): table = SatTable( ".//table[contains(@class, 'white-header')]", column_widgets={ 'Attribute type': MatcherAttribute(), 'Value': TextInputHidden(locator=".//textarea[contains(@id, 'value')]"), 'Omit': Checkbox( locator= ".//input[contains(@name, '[omit]') and @type!='hidden']"), }, ) add_new_matcher = Text( ".//a[contains(@data-original-title, 'add a new matcher')]") def fill(self, values): """Add and fill all matchers provided Example:: [ { 'Attribute type': { 'matcher_attribute_type': 'os', 'matcher_attribute_value': 'x86' }, 'Value': 'newvalue' }, { 'Attribute type': { 'matcher_attribute_type': 'fqdn', 'matcher_attribute_value': 'myhost.com' }, 'Value': 'newvalue2' } ] """ for matcher_value in values: self.add_new_matcher.click() self.table[-1].fill(matcher_value)
class media(SatVerticalTab): all_medias = Checkbox(id='organization_ignore_types_medium') resources = MultiSelect(id='ms-organization_medium_ids')
class properties(Tab): # noqa instance_type = SummaryFormItem('Properties', 'Instance Type') boot_disk_size = SummaryFormItem('Properties', 'Boot Disk Size ') is_preemtible = Checkbox(name='hardware__is_preemptible')
class provisioning_templates(SatVerticalTab): TAB_NAME = 'Provisioning Templates' all_templates = Checkbox( id='organization_ignore_types_provisioningtemplate') resources = MultiSelect(id='ms-organization_provisioning_template_ids')
class roles(SatTab): admin = Checkbox(id='user_admin') resources = MultiSelect(id='ms-user_role_ids')
class partition_tables(SatVerticalTab): TAB_NAME = 'Partition Tables' all_ptables = Checkbox(id='organization_ignore_types_ptable') resources = MultiSelect(id='ms-organization_ptable_ids')
class list_remove_tab(ListRemoveTab): table = SatSubscriptionsTable( locator=".//table", column_widgets={0: Checkbox(locator=".//input[@type='checkbox']")})
class domains(SatVerticalTab): all_domains = Checkbox(id='organization_ignore_types_domain') resources = MultiSelect(id='ms-organization_domain_ids')
class UserInputForm(View): advanced = Checkbox(locator=".//input[contains(@id, 'advanced')]") options = TextInput( locator=".//textarea[contains(@name, '[options]')]") description = TextInput( locator=".//textarea[contains(@name, '[description]')]")
class realms(SatVerticalTab): all_realms = Checkbox(id='organization_ignore_types_realm') resources = MultiSelect(id='ms-organization_realm_ids')