class HostsDeleteActionDialog(HostsActionCommonDialog): title = Text( "//h4[text()='Delete Hosts - The following hosts are about to be changed']" )
class table_row(ParametrizedView): PARAMETERS = ('rowid', ) ROOT = ParametrizedLocator('.//tr[@data-test={rowid|quote}]') col1 = Text('./td[2]')
class BarView(View): widget = Text('//h3[@id="switchabletesting-2"]')
class GCEProviderForm(View): google_project_id = TextInput(id='compute_resource_project') client_email = TextInput(id='compute_resource_email') certificate_path = TextInput(id='compute_resource_key_path') load_zones = Text("//*[contains(@id,'test_connection_button')]")
class PXEDatastoreForm(View): title = Text('//div[@id="main-content"]//h1') provider = BootstrapSelect(id='ems_id') is_displayed = displayed_not_implemented
class c2(View): # noqa ROOT = ".c2" w = Text(".lookmeup")
class compute_profiles(SatTab): TAB_NAME = 'Compute profiles' table = SatTable('.//table', column_widgets={ 'Compute profile': Text('./a'), })
class provisioning(Tab): # noqa results = SummaryTable(title='Results') plays = SummaryTable(title='Plays') details = SummaryTable(title='Details') credentials = SummaryTable(title='Credentials') standart_output = Text('.//div[@id="provisioning"]//pre')
class CustomReportFormCommon(CloudIntelReportsView): report_title = Text("#explorer_title_text") menu_name = Input("name") title = Input("title") base_report_on = BootstrapSelect("chosen_model") report_fields = ReportsMultiBoxSelect( move_into="Move selected fields down", move_from="Move selected fields up", available_items="available_fields", chosen_items="selected_fields") cancel_after = BootstrapSelect("chosen_queue_timeout") @View.nested class consolidation(WaitTab): # noqa column1 = BootstrapSelect("chosen_pivot1") column2 = BootstrapSelect("chosen_pivot2") column3 = BootstrapSelect("chosen_pivot3") @View.nested class formatting(WaitTab): # noqa page_size = BootstrapSelect("pdf_page_size") @View.nested class styling(WaitTab): # noqa pass @View.nested class filter(WaitTab): # noqa filter_show_costs = BootstrapSelect("cb_show_typ") filter_owner = BootstrapSelect("cb_owner_id") filter_provider = BootstrapSelect("cb_provider_id") filter_project = BootstrapSelect("cb_entity_id") filter_tag_cat = BootstrapSelect("cb_tag_cat") filter_tag_value = BootstrapSelect("cb_tag_value") interval = BootstrapSelect("cb_interval") interval_size = BootstrapSelect("cb_interval_size") interval_end = BootstrapSelect("cb_end_interval_offset") primary_record_filter = Button("contains", "Record Filter") secondary_display_filter = Button("contains", "Display Filter") @View.nested class primary_filter(ExpressionEditor): # noqa def child_widget_accessed(self, widget): if self.parent.primary_record_filter.is_displayed: self.parent.primary_record_filter.click() @View.nested class secondary_filter(ExpressionEditor): # noqa def child_widget_accessed(self, widget): if self.parent.secondary_display_filter.is_displayed: self.parent.secondary_display_filter.click() @View.nested class summary(WaitTab): # noqa sort_by = BootstrapSelect("chosen_sort1") sort_order = BootstrapSelect("sort_order") show_breaks = BootstrapSelect("sort_group") sort_by_2 = BootstrapSelect("chosen_sort2") row_limit = BootstrapSelect("row_limit") @View.nested class charts(WaitTab): # noqa chart_type = BootstrapSelect("chosen_graph") chart_mode = BootstrapSelect("chart_mode") values_to_show = BootstrapSelect("chosen_count") sum_other_values = Checkbox("chosen_other") @View.nested class timeline(WaitTab): # noqa based_on = BootstrapSelect("chosen_tl") position = BootstrapSelect("chosen_position") cancel_button = Button("Cancel")
class ServiceEditForm(MyServicesView): title = Text('#explorer_title_text') name = Input(name='name') description = Input(name='description')
class SetOwnershipForm(MyServicesView): title = Text('#explorer_title_text') select_owner = BootstrapSelect('user_name') select_group = BootstrapSelect('group_name')
class ServiceRetirementForm(MyServicesView): title = Text('#explorer_title_text') retirement_date = Calendar('retirementDate') retirement_warning = BootstrapSelect('retirement_warn')
class visibility(View): # noqa title = Text('//*[@id="ab_form"]/h3[2]') define_exp = Text( locator='//*[@id="form_visibility_expression_div"]//a/button') expression = ExpressionEditor()
class enablement(View): # noqa title = Text('//*[@id="ab_form"]/div[1]/h3') define_exp = Text( locator='//*[@id="form_enablement_expression_div"]//a/button') expression = ExpressionEditor() disabled_text = Input(id="disabled_text")
class details(View): # noqa region = Text('.//p[normalize-space(text())="Region:"]/span') zone = Text('.//p[normalize-space(text())="Zone:"]/span') appliance = Text('.//p[normalize-space(text())="Appliance:"]/span')
class ContentViews(View): ROOT = ".//li[@data-name='Content Views']" content_views = SatTable('.//table', column_widgets={'Content View': Text('./a')})
class c1(View): # noqa ROOT = ".c1" w = Text(".lookmeup")
class VirtWhoConfigStatus(View): ROOT = ".//li[@data-name='Virt-who Configs Status']" config_status = Table('.//table') latest_config = Text(".//div[@class='ca']")
class c3(View): # noqa ROOT = ".c3" w = Text(".lookmeup")
class DashboardView(BaseLoggedInView): title = Text("//h1[text()='Overview']") manage = ActionsDropdown("//div[@class='btn-group']") refresh = AutoRefresh() searchbox = Search() @property def is_displayed(self): return self.browser.wait_for_element(self.title, exception=False) is not None def search(self, query): """Return whole dashboard view as a result of a search :param str query: search query to type into search field. :return: all view widgets values :rtype: dict """ self.searchbox.search(query) return self.read() @View.nested class DiscoveredHosts(View): ROOT = ".//li[@data-name='Discovered Hosts']" hosts = Table('.//table') hosts_count = Text(".//a[@data-id='aid_discovered_hosts']") @View.nested class HostConfigurationStatus(View): ROOT = ".//li[@data-name='Host Configuration Status for All']" status_list = ItemValueList() total_count = TotalCount() @View.nested class TaskStatus(View): ROOT = ".//li[@data-name='Task Status']" states = SatTable( './/table', column_widgets={'No. of Tasks': Text('./a')}, ) def fill(self, values): if 'state' not in values or 'result' not in values: raise ValueError( 'both state and result values have to be provided') self.states.row( state=values['state'], result=values['result'])['No. of Tasks'].widget.click() @View.nested class LatestJobs(View): ROOT = ".//li[@data-name='Latest Jobs']" jobs = SatTable('.//table') @View.nested class HostConfigurationChart(View): ROOT = ".//li[@data-name='Host Configuration Chart for All']" chart = PieChart(".//div[@class='host-configuration-chart']") @View.nested class ContentViews(View): ROOT = ".//li[@data-name='Content Views']" content_views = SatTable('.//table', column_widgets={'Content View': Text('./a')}) @View.nested class SyncOverview(View): ROOT = ".//li[@data-name='Sync Overview']" syncs = Table('.//table') @View.nested class HostSubscription(View): ROOT = ".//li[@data-name='Host Subscription Status']" subscriptions = SatTable('.//table', column_widgets={0: Text('./a')}) def fill(self, values): if 'type' not in values: raise ValueError('You need provide subscription task type') self.subscriptions.row( (0, 'contains', str(values['type'])))[0].widget.click() @View.nested class SubscriptionStatus(View): ROOT = ".//li[@data-name='Subscription Status']" subscriptions = SatTable('.//table') @View.nested class LatestErrata(View): ROOT = ".//li[@data-name='Latest Errata']" erratas = SatTable('.//table') @View.nested class NewHosts(View): ROOT = ".//li[@data-name='New Hosts']" hosts = Table('.//table') @View.nested class HostCollections(View): ROOT = ".//li[@data-name='Host Collections']" collections = SatTable('.//table') @View.nested class LatestFailedTasks(View): ROOT = ".//li[@data-name='Latest Warning/Error Tasks']" tasks = SatTable('.//table', column_widgets={'Name': Text('./a')}) def fill(self, values): if 'name' not in values: raise ValueError('You need provide name of the task') self.tasks.row(name=values['name'])['Name'].widget.click() @View.nested class VirtWhoConfigStatus(View): ROOT = ".//li[@data-name='Virt-who Configs Status']" config_status = Table('.//table') latest_config = Text(".//div[@class='ca']")
class ResourceProviderCreateView(BaseLoggedInView): name = TextInput(id='compute_resource_name') description = TextInput(id='compute_resource_description') submit = Text('//input[@name="commit"]') provider = FilteredDropdown(id='s2id_compute_resource_provider') provider_content = ConditionalSwitchableView(reference='provider') @provider_content.register('Docker') class DockerProviderForm(View): url = TextInput(id='compute_resource_url') user = TextInput(id='compute_resource_user') password = TextInput(id='compute_resource_password') email = TextInput(id='compute_resource_email') @provider_content.register('EC2') class EC2ProviderForm(View): http_proxy = TextInput(id='compute_resource_http_proxy_id') access_key = TextInput(id='compute_resource_user') secret_key = TextInput(id='compute_resource_password') load_regions = Text("//*[contains(@id,'test_connection_button')]") region = FilteredDropdown(id='s2id_compute_resource_region') def after_fill(self, was_change): self.load_regions.click() @provider_content.register('Google') class GCEProviderForm(View): google_project_id = TextInput(id='compute_resource_project') client_email = TextInput(id='compute_resource_email') certificate_path = TextInput(id='compute_resource_key_path') load_zones = Text("//*[contains(@id,'test_connection_button')]") @provider_content.register('Libvirt') 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') @provider_content.register('RHEL OpenStack Platform') class OpenStackProviderForm(View): url = TextInput(id='compute_resource_url') user = TextInput(id='compute_resource_user') password = TextInput(id='compute_resource_password') domain = TextInput(id='compute_resource_domain') @provider_content.register('Rackspace') class RackspaceProviderForm(View): url = TextInput(id='compute_resource_url') user = TextInput(id='compute_resource_user') api_key = TextInput(id='compute_resource_password') region = Select(id='compute_resource_region') @provider_content.register('VMware') class VMwareProviderForm(View): vcenter = TextInput(id='compute_resource_server') user = TextInput(id='compute_resource_user') password = TextInput(id='compute_resource_password') display_type = Select(id='compute_resource_display_type') vnc_console_passwords = Checkbox( id='compute_resource_set_console_password') enable_caching = Checkbox(id='compute_resource_caching_enabled') load_datacenters = Text("//*[contains(@id,'test_connection_button')]") def after_fill(self, was_change): self.load_datacenters.click() @provider_content.register('RHV') class RHVProviderForm(View): url = TextInput(id='compute_resource_url') user = TextInput(id='compute_resource_user') password = TextInput(id='compute_resource_password') api4 = Checkbox(id='compute_resource_use_v4') certification_authorities = TextInput(id='compute_resource_public_key') @View.nested class datacenter(View): load_datacenters = Text( "//a[contains(@id,'test_connection_button')]") value = FilteredDropdown(id='s2id_compute_resource_uuid') def before_fill(self, values=None): self.load_datacenters.click() @property def is_displayed(self): return self.browser.wait_for_element(self.name, exception=False) is not None
class DiscoveredHosts(View): ROOT = ".//li[@data-name='Discovered Hosts']" hosts = Table('.//table') hosts_count = Text(".//a[@data-id='aid_discovered_hosts']")
class PXESystemImageTypeForm(View): title = Text('//div[@id="main-content"]//h1') name = Input(id='name') type = BootstrapSelect(id='provision_type') is_displayed = displayed_not_implemented
class ButtonGroupForm(ServicesCatalogView): title = Text('#explorer_title_text') btn_group_text = Input(name='name') btn_group_hvr_text = Input(name='description') btn_image = FonticonPicker('button_icon')
class ServiceEditForm(MyServicesView): title = Text(locator='//li[@class="active"]') name = Input(name='name') description = Input(name='description')
class OrganizationEditView(BaseLoggedInView): breadcrumb = BreadCrumb() submit = Text("//form[contains(@id, 'edit')]//input[@name='commit']") cancel = Text("//a[text()='Cancel']") @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Organizations' and self.breadcrumb.read().startswith('Edit ')) @View.nested class primary(SatVerticalTab): name = TextInput(id='organization_name') label = TextInput(id='organization_label') default_system_sla = FilteredDropdown(id='organization_service_level') description = TextInput(id='organization_description') @View.nested class users(SatVerticalTab): all_users = Checkbox(id='organization_ignore_types_user') resources = MultiSelect(id='ms-organization_user_ids') @View.nested class capsules(SatVerticalTab): all_capsules = Checkbox(id='organization_ignore_types_smartproxy') resources = MultiSelect(id='ms-organization_smart_proxy_ids') @View.nested class subnets(SatVerticalTab): all_subnets = Checkbox(id='organization_ignore_types_subnet') resources = MultiSelect(id='ms-organization_subnet_ids') @View.nested class compute_resources(SatVerticalTab): TAB_NAME = 'Compute Resources' all_resources = Checkbox( id='organization_ignore_types_computeresource') resources = MultiSelect(id='ms-organization_compute_resource_ids') @View.nested class media(SatVerticalTab): all_medias = Checkbox(id='organization_ignore_types_medium') resources = MultiSelect(id='ms-organization_medium_ids') @View.nested class provisioning_templates(SatVerticalTab): TAB_NAME = 'Provisioning Templates' all_templates = Checkbox( id='organization_ignore_types_provisioningtemplate') resources = MultiSelect(id='ms-organization_provisioning_template_ids') @View.nested class partition_tables(SatVerticalTab): TAB_NAME = 'Partition Tables' all_ptables = Checkbox(id='organization_ignore_types_ptable') resources = MultiSelect(id='ms-organization_ptable_ids') @View.nested class domains(SatVerticalTab): all_domains = Checkbox(id='organization_ignore_types_domain') resources = MultiSelect(id='ms-organization_domain_ids') @View.nested class realms(SatVerticalTab): all_realms = Checkbox(id='organization_ignore_types_realm') resources = MultiSelect(id='ms-organization_realm_ids') @View.nested class environments(SatVerticalTab): all_environments = Checkbox(id='organization_ignore_types_environment') resources = MultiSelect(id='ms-organization_environment_ids') @View.nested class host_groups(SatVerticalTab): TAB_NAME = 'Host Groups' all_hostgroups = Checkbox(id='organization_ignore_types_hostgroup') resources = MultiSelect(id='ms-organization_hostgroup_ids') @View.nested class locations(SatVerticalTab): resources = MultiSelect(id='ms-organization_location_ids') @View.nested class parameters(SatVerticalTab): resources = CustomParameter(id='global_parameters_table')
class nested(View): ROOT = '#bogus' t = Text('.lookmeup')
class LoginPage(View): flash = FlashMessages('div#flash_text_div') class details(View): # noqa region = Text('.//p[normalize-space(text())="Region:"]/span') zone = Text('.//p[normalize-space(text())="Zone:"]/span') appliance = Text('.//p[normalize-space(text())="Appliance:"]/span') change_password = Text('.//a[normalize-space(.)="Update password"]') back = Text('.//a[normalize-space(.)="Back"]') username = Input(name='user_name') password = Input(name='user_password') new_password = Input(name='user_new_password') verify_password = Input(name='user_verify_password') login = Button('Login') def show_update_password(self): if not self.new_password.is_displayed: self.change_password.click() def hide_update_password(self): if self.new_password.is_displayed: self.back.click() def login_admin(self, **kwargs): username = conf.credentials['default']['username'] password = conf.credentials['default']['password'] cred = Credential(principal=username, secret=password) from cfme.configure.access_control import User user = User(credential=cred, name='Administrator') return self.log_in(user, **kwargs) def submit_login(self, method='click_on_login'): if method == 'click_on_login': self.login.click() elif method == 'press_enter_after_password': self.browser.send_keys(Keys.ENTER, self.password) elif method == '_js_auth_fn': self.browser.execute_script('miqAjaxAuth();') else: raise ValueError('Unknown method {}'.format(method)) if self.flash.is_displayed: self.flash.assert_no_error() def log_in(self, user, method='click_on_login'): if not user: username = conf.credentials['default']['username'] password = conf.credentials['default']['password'] cred = Credential(principal=username, secret=password) from cfme.configure.access_control import User user = User(credential=cred) user.name = 'Administrator' self.fill({ 'username': user.credential.principal, 'password': user.credential.secret, }) self.submit_login(method) logged_in_view = self.browser.create_view(BaseLoggedInPage) if logged_in_view.logged_in and user.name is None: name = logged_in_view.current_fullname self.logger.info( 'setting the appliance.user.name to %r because it was not specified', name) user.name = name self.extra.appliance.user = user def update_password(self, username, password, new_password, verify_password=None, method='click_on_login'): self.show_update_password() self.fill({ 'username': username, 'password': password, 'new_password': new_password, 'verify_password': verify_password if verify_password is not None else new_password }) self.submit_login(method) def logged_in_as_user(self, user): return False @property def logged_in_as_current_user(self): return False @property def current_username(self): return None @property def current_fullname(self): return None @property def logged_in(self): return not self.logged_out @property def logged_out(self): return self.username.is_displayed and self.password.is_displayed and self.login.is_displayed @property def is_displayed(self): return self.logged_out
class FooView(View): widget = Text('//h3[@id="switchabletesting-1"]')
class HostsChangeOpenscapCapsule(HostsActionCommonDialog): title = Text( "//h4[text()='Change OpenSCAP Capsule - The following hosts are about to be changed']" ) policy = Select(id='smart_proxy_id')