コード例 #1
0
ファイル: ssui.py プロジェクト: nachandr/cfme_tests
class DetailsMyServiceView(MyServicesView):
    title = Text(locator='//li[@class="active"]')

    @property
    def is_displayed(self):
        return (self.in_myservices and self.title.text
                in {self.context['object'].name, 'Service Details'})

    notification = Notification()
    policy = SSUIDropdown('Policy')
    power_operations = Kebab(
        locator='.//div[contains(@class, "dropdown-kebab-pf") and ./button][1]'
    )
    access_dropdown = SSUIAppendToBodyDropdown('Access')
    remove_service = Button("Remove Service")
    configuration = SSUIDropdown('Configuration')
    lifecycle = SSUIDropdown('Lifecycle')
    console_button = Button(tooltip="HTML5 console",
                            classes=['open-console-button'])
    retirement_state = TextInput(
        locator=".//label[text()='Retirement State']/parent::div/div/input")
    resource_power_status = PowerIcon(
        ".//span/i[contains(@class, 'pficon') and contains("
        "@uib-tooltip,'Power State')]")
    standard_output = Text('.//div[@class="well"]')
コード例 #2
0
class ReplicationGlobalView(ReplicationView):
    """ Replication Global setup View"""
    add_subscription = Button('Add Subscription')
    subscription_table = VanillaTable(
        '//form[@id="form_div"]//table[contains(@class, "table")]',
        column_widgets={
            "Actions":
            Button("Update"),
            10:
            Kebab(
                locator='//td[10]/div[contains(@class, "dropdown-kebab-pf")]')
        })

    @property
    def is_displayed(self):
        return (self.in_region and self.add_subscription.is_displayed)
コード例 #3
0
 class TestView(View):
     kebab_menu = Kebab(id="dropdownKebab")
     kebab_output = Text(locator='//*[@id="kebab_display"]')
コード例 #4
0
ファイル: dashboard.py プロジェクト: nachandr/cfme_tests
        class widgets(ParametrizedView):  # noqa
            PARAMETERS = ('title', )
            ALL_LOCATOR = '//div[starts-with(@id, "w_")]//h2[contains(@class, "card-pf-title")]'
            BLANK_SLATE = './/div[contains(@class, "blank-slate-pf")]//h1'
            CHART = './div/div/div[starts-with(@id, "miq_widgetchart_")]'
            RSS = './div/div[contains(@class, "rss_widget")]'
            RSS_TABLE = './div[./div[contains(@class, "rss_widget")]]/div/table'
            TABLE = './div/table|./div/div/table|.//*/table[contains(@class, "table")]'
            MC = (
                './/div[contains(@class, "mc")]/*[1]|.//div[starts-with(@id, "dd_w") '
                'and contains(@id, "_box")]/*[1]')
            ROOT = ParametrizedLocator(
                './/div[starts-with(@id, "w_") and .//h2[contains(@class, "card-pf-title")'
                ' and normalize-space(.)={title|quote}]]')

            title = Text('.//h2[contains(@class, "card-pf-title")]')
            menu = Kebab(id=ParametrizedString('btn_{@widget_id}'))

            contents = ConditionalSwitchableView(reference='content_type')

            # Unsupported reading yet
            contents.register(None, default=True, widget=Widget())
            contents.register('chart', widget=Widget())

            # Reading supported
            contents.register('table', widget=Table(TABLE))
            contents.register('rss', widget=Table(RSS_TABLE))

            footer = Text('.//div[contains(@class, "card-pf-footer")]')

            @property
            def column(self):
                """Returns the column position of this widget. Numbered from 1!"""
                if self.browser.product_version < "5.10":
                    parent = self.browser.element('..')
                else:
                    parent = self.browser.element('../../..')
                try:
                    parent_id = self.browser.get_attribute('id',
                                                           parent).strip()
                    return int(re.sub(r'^col(\d+)$', '\\1', parent_id))
                except (ValueError, TypeError, AttributeError):
                    raise ValueError(
                        'Could not get the column index of widget')

            @property
            def minimized(self):
                return not self.browser.is_displayed(self.MC)

            @cached_property
            def widget_id(self):
                id_attr = self.browser.get_attribute('id', self)
                return int(id_attr.rsplit('_', 1)[-1])

            @cached_property
            def content_type(self):
                if self.browser.elements(self.BLANK_SLATE):
                    # No data yet
                    return None
                elif self.browser.elements(self.RSS):
                    return 'rss'
                elif self.browser.is_displayed(self.CHART):
                    return 'chart'
                elif self.browser.is_displayed(self.TABLE):
                    return 'table'
                else:
                    return None

            @property
            def blank(self):
                return bool(self.browser.elements(self.BLANK_SLATE))

            @classmethod
            def all(cls, browser):
                return [(browser.text(e), )
                        for e in browser.elements(cls.ALL_LOCATOR)]