示例#1
0
 class FilterBlacklistForm(View):
     exclude_hosts = TextInput(
         id='foreman_virt_who_configure_config_blacklist')
     exclude_host_parents = TextInput(
         id='foreman_virt_who_configure_config_exclude_host_parents')
示例#2
0
 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')
示例#3
0
 class CronlineForm(View):
     cron_line = TextInput(id='triggering_cronline')
示例#4
0
class ComputeResourceLibvirtProfileStorageItem(GenericRemovableWidgetItem):
    """Libvirt Compute Resource profile "Storage" item widget"""

    storage_pool = FilteredDropdown(id="pool_name")
    size = TextInput(locator=".//input[contains(@id, 'capacity')]")
    storage_type = FilteredDropdown(id="format_type")
示例#5
0
class ResourceProviderCreateView(BaseLoggedInView):
    breadcrumb = BreadCrumb()
    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('EC2')
    class EC2ProviderForm(View):
        access_key = TextInput(id='compute_resource_user')
        secret_key = TextInput(id='compute_resource_password')

        @View.nested
        class region(View):
            load_regions = Text("//a[contains(@id,'test_connection_button')]")
            value = FilteredDropdown(id='s2id_compute_resource_region')

            def before_fill(self, values=None):
                self.load_regions.click()

        @View.nested
        class http_proxy(View):
            value = FilteredDropdown(id='compute_resource_http_proxy_id')

    @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')

        @View.nested
        class zone(View):
            load_zones = Text("//a[contains(@id,'test_connection_button')]")
            value = FilteredDropdown(id='s2id_compute_resource_zone')

            def before_fill(self, values=None):
                self.load_zones.click()

        @View.nested
        class http_proxy(View):
            value = FilteredDropdown(id='compute_resource_http_proxy_id')

    @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')

        @View.nested
        class datacenter(View):
            load_datacenters = Text(
                "//a[contains(@id,'test_connection_button')]")
            value = FilteredDropdown(id='s2id_compute_resource_datacenter')

            def before_fill(self, values=None):
                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')
        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()

    @View.nested
    class compute_resource(SatTab):
        TAB_NAME = 'Compute Resource'

    @View.nested
    class locations(SatTab):
        resources = MultiSelect(id='ms-compute_resource_location_ids')

    @View.nested
    class organizations(SatTab):
        resources = MultiSelect(id='ms-compute_resource_organization_ids')

    @property
    def is_displayed(self):
        breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb,
                                                          exception=False)
        return (breadcrumb_loaded
                and self.breadcrumb.locations[0] == 'Compute Resources'
                and self.breadcrumb.read() == 'Create Compute Resource')
示例#6
0
 class domain(SatTab):  # noqa
     dns_domain = TextInput(id='domain_name')
     full_name = TextInput(id='domain_fullname')
     dns_capsule = FilteredDropdown(id='domain_dns_id')
示例#7
0
class VolumeEditView(VolumeView):
    is_displayed = displayed_not_implemented

    volume_name = TextInput(name='name')
    save = Button('Save')
示例#8
0
 class default(Tab, DefaultEndpointForm, BeforeFillMixin):  # NOQA
     TAB_NAME = 'Default'
     sec_protocol = BootstrapSelect('default_security_protocol')
     trusted_ca_certificates = TextInput('default_tls_ca_certs')
     api_port = Input('default_api_port')
示例#9
0
 class environment(SatTab):
     name = TextInput(id='environment_name')
示例#10
0
文件: common.py 项目: pondrejk/airgun
 class FactValueForm(View):
     fact_name = TextInput(
         locator=".//input[contains(@name, '[fact_name]')]")
     description = TextInput(
         locator=".//textarea[contains(@name, '[description]')]")
示例#11
0
文件: common.py 项目: pondrejk/airgun
 class VariableValueForm(View):
     variable_name = TextInput(
         locator=".//input[contains(@name, '[variable_name]')]")
     description = TextInput(
         locator=".//textarea[contains(@name, '[description]')]")
示例#12
0
文件: common.py 项目: pondrejk/airgun
 class UserInputForm(View):
     advanced = Checkbox(locator=".//input[contains(@id, 'advanced')]")
     options = TextInput(
         locator=".//textarea[contains(@name, '[options]')]")
     description = TextInput(
         locator=".//textarea[contains(@name, '[description]')]")
示例#13
0
    class job(SatTab):
        job_category = TextInput(name='job_template[job_category]')
        description_format = TextInput(id='job_template_description_format')
        provider_type = FilteredDropdown(id='job_template_provider_type')
        timeout = TextInput(id='job_template_execution_timeout_interval')
        add_template_inputs = Text("//a[@data-association='template_inputs']")
        add_foreign_input_set = Text(
            "//a[@data-association='foreign_input_sets']")

        @View.nested
        class template_input(View):
            ROOT = "//div[contains(@class, 'template_inputs')]" \
                   "/following-sibling::div[1]"
            name = TextInput(locator=".//input[contains(@name, '[name]')]")
            required = Checkbox(locator=".//input[contains(@id, 'required')]")
            input_type = SatSelect(
                locator=".//select[contains(@name, '[input_type]')]")

            input_content = ConditionalSwitchableView(reference='input_type')

            @input_content.register('User input')
            class UserInputForm(View):
                advanced = Checkbox(
                    locator=".//input[contains(@id, 'advanced')]")
                options = TextInput(
                    locator=".//textarea[contains(@name, '[options]')]")
                description = TextInput(
                    locator=".//textarea[contains(@name, '[description]')]")

            @input_content.register('Fact value')
            class FactValueForm(View):
                fact_name = TextInput(
                    locator=".//input[contains(@name, '[fact_name]')]")
                description = TextInput(
                    locator=".//textarea[contains(@name, '[description]')]")

            @input_content.register('Variable value')
            class VariableValueForm(View):
                variable_name = TextInput(
                    locator=".//input[contains(@name, '[variable_name]')]")
                description = TextInput(
                    locator=".//textarea[contains(@name, '[description]')]")

            @input_content.register('Puppet parameter')
            class PuppetParameterForm(View):
                puppet_class_name = TextInput(
                    locator=".//input[contains(@name, '[puppet_class_name]')]")
                puppet_parameter_name = TextInput(
                    locator=".//input[contains("
                            "@name, '[puppet_parameter_name]')]")
                description = TextInput(
                    locator=".//textarea[contains(@name, '[description]')]")

            def before_fill(self, values=None):
                self.parent.add_template_inputs.click()

        @View.nested
        class foreign_input(View):
            ROOT = "//div[contains(@class, 'foreign_input')]" \
                   "/following-sibling::div[1]"
            target_template = Select(
                locator=".//select[contains(@name, '[target_template_id]')]")
            include_all = Checkbox(
                locator=".//input[contains(@id, 'include_all')]")
            include = TextInput(
                locator=".//input[contains(@name, '[include]')]")
            exclude = TextInput(
                locator=".//input[contains(@name, '[exclude]')]")

            def before_fill(self, values=None):
                self.parent.add_foreign_input_set.click()

        value = TextInput(
            id='job_template_effective_user_attributes_value')
        current_user = Checkbox(
            id='job_template_effective_user_attributes_current_user')
        overridable = Checkbox(
            id='job_template_effective_user_attributes_overridable')
示例#14
0
 class template(SatTab):
     name = TextInput(id='job_template_name')
     default = Checkbox(id='job_template_default')
     template_editor = View.nested(TemplateEditor)
     audit = TextInput(id='job_template_audit_comment')
 class TestForm6(TestForm5):
     input6 = TextInput(id='input')
 class TestForm(View):
     h3 = Text('.//h3')
     input1 = TextInput(name='input1')
     input2 = Checkbox(id='input2')
     input3 = ColourInput(id='colourinput')
     fileinput = FileInput(id='fileinput')
class Pagination(View):
    """Represents the Patternfly pagination.

    https://www.patternfly.org/v4/documentation/react/components/pagination
    """

    ROOT = ParametrizedLocator("{@locator}")
    _first = GenericLocatorWidget(".//button[contains(@data-action, 'first')]")
    _previous = GenericLocatorWidget(".//button[contains(@data-action, 'previous')]")
    _next = GenericLocatorWidget(".//button[contains(@data-action, 'next')]")
    _last = GenericLocatorWidget(".//button[contains(@data-action, 'last')]")
    _options = Dropdown()
    _items = Text(".//span[@class='pf-c-options-menu__toggle-text']")
    _current_page = TextInput(locator=".//input[@aria-label='Current page']")
    _total_pages = Text(".//div[@class='pf-c-pagination__nav-page-select']/span")

    def __init__(self, parent, locator, logger=None):
        View.__init__(self, parent=parent, logger=logger)
        self.locator = locator

    @property
    def is_first_disabled(self):
        return "pf-m-disabled" in self.browser.classes(self._first)

    def first_page(self):
        self._first.click()

    @property
    def is_previous_disabled(self):
        return "pf-m-disabled" in self.browser.classes(self._previous)

    def previous_page(self):
        self._previous.click()

    @property
    def is_next_disabled(self):
        return "pf-m-disabled" in self.browser.classes(self._next)

    def next_page(self):
        self._next.click()

    @property
    def is_last_disabled(self):
        return "pf-m-disabled" in self.browser.classes(self._last)

    def last_page(self):
        self._last.click()

    @property
    def current_page(self):
        return int(self._current_page.value)

    @property
    def total_pages(self):
        # example "of 6 pages"
        return int(self._total_pages.text.strip().split()[1])

    @property
    def displayed_items(self):
        items_string = self._items.text
        # example "1 - 20 of 523 items"
        first_num, last_num = items_string.split("of")[0].split("-")
        return int(first_num.strip()), int(last_num.strip())

    @property
    def total_items(self):
        items_string = self._items.text
        return int(items_string.split("of")[1].split()[0])

    @property
    def per_page_options(self):
        return self._options.items

    def set_per_page(self, count):
        # convert a possible int to string
        value = str(count)
        value_per_page = "{} per page".format(value)
        items = self._options.items
        if value_per_page in items:
            self._options.item_select(value_per_page)
        elif value in items:
            self._options.item_select(value)
        else:
            raise ValueError(
                "count '{}' is not a valid option in the pagination dropdown".format(count)
            )

    def __iter__(self):
        self.first_page()
        self._page_counter = 0
        return self

    def __next__(self):
        if self._page_counter < self.total_pages:
            self._page_counter += 1
            if self._page_counter > 1:
                self.next_page()
            return self._page_counter
        else:
            raise StopIteration

    def next(self):
        # For sake Python 2 compatibility
        return self.__next__()
 class TestForm(View):
     table = Table('#with-thead')
     table1 = Table(
         '#rowcolspan_table',
         column_widgets={'Last Name': TextInput(locator='./input')})
示例#19
0
 class RetirementDateSelectionView(View):
     datetime_select = TextInput(id='retirement_date_datepicker')
 class TestForm1(View):
     table1 = Table('#rowcolspan_table',
                    column_widgets={
                        'First Name': TextInput(locator='./input'),
                        'Last Name': TextInput(locator='./input')
                    })
示例#21
0
 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')
 class MyView(View):
     table = MyTable('#dynamic',
                     column_widgets={
                         'First Name': TextInput(locator='./input'),
                         'Last Name': TextInput(locator='./input'),
                     })
示例#23
0
class ComputeResourceRHVProfileNetworkItem(GenericRemovableWidgetItem):
    """RHV Compute Resource profile "Network interface" item widget"""

    name = TextInput(locator=".//input[contains(@id, 'name')]")
    network = FilteredDropdown(id="network")
    interface_type = FilteredDropdown(id="interface")
        class Nested1(View):
            input1 = TextInput(name='input1')

            class Nested2(View):
                input2 = Checkbox(id='input2')
示例#25
0
 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 TestForm(View):
     my_value = 3
     header = Text(ParametrizedString('.//h{header}'))
     header_cls = Text(ParametrizedString('.//h{@my_value}'))
     input = TextInput(name=ParametrizedString('input{input}'))
示例#27
0
 class FutureExecutionForm(View):
     start_at = TextInput(id='triggering_start_at_raw')
     start_before = TextInput(id='triggering_start_before_raw')
 class TestForm2(View):
     caption = View.include(TestForm1)
     input1 = TextInput(name='input1')
     input2 = Checkbox(id='input2')
示例#29
0
 class RepeatMonthlyForm(View):
     at_days = TextInput(id='triggering_days')
     at_hours = FilteredDropdown(id='triggering_time_time_4i')
     at_minutes = FilteredDropdown(id='triggering_time_time_5i')
示例#30
0
 class FilterWhitelistForm(View):
     filter_hosts = TextInput(
         id='foreman_virt_who_configure_config_whitelist')
     filter_host_parents = TextInput(
         id='foreman_virt_who_configure_config_filter_host_parents')