Exemple #1
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.

import pom
from pom import ui
from selenium.webdriver.common.by import By

from stepler.horizon.app import ui as _ui


@ui.register_ui(field_username=ui.TextField(By.NAME, 'username'),
                field_password=ui.TextField(By.NAME, 'password'),
                button_submit=ui.Button(By.CSS_SELECTOR, '#loginBtn'))
class FormLogin(_ui.Form):
    """Form to login user."""


@ui.register_ui(form_login=FormLogin(By.CSS_SELECTOR, 'form'),
                label_alert_message=ui.UI(By.CSS_SELECTOR, 'div.alert-danger'),
                label_error_message=ui.UI(By.CSS_SELECTOR, 'div.error'),
                modal=_ui.initiated_ui.Modal(By.CLASS_NAME, 'modal-backdrop'))
class PageLogin(pom.Page):
    """Page to login user."""

    url = "/auth/login"
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    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

from ..base import PageBase


@ui.register_ui(label_name=ui.UI(By.CSS_SELECTOR, 'dd:nth-of-type(1)'))
class Info(ui.Block):
    """Image info table."""


@ui.register_ui(info_image=Info(By.CSS_SELECTOR,
                                'div.detail dl.dl-horizontal:nth-of-type(1)'))
class PageImage(PageBase):
    """Image page."""

    url = "/project/images/{id}/"
from selenium.webdriver.common.by import By

from horizon_autotests.app import ui as _ui

from .tab_volumes import FormCreateSnapshot


@ui.register_ui(
    checkbox=_ui.CheckBox(By.CSS_SELECTOR, 'input[type="checkbox"]'),
    dropdown_menu=_ui.DropdownMenu())
class RowSnapshot(_ui.Row):
    """Volume snapshot row of volume snapshots table."""


@ui.register_ui(
    link_next=ui.UI(By.CSS_SELECTOR, 'a[href^="?snapshot_marker="]'),
    link_prev=ui.UI(By.CSS_SELECTOR, 'a[href^="?prev_snapshot_marker="]'))
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'),
Exemple #4
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

from whale.decapod_ui.app.pages import base
from whale.decapod_ui.app import ui as _ui


@ui.register_ui(label_login=ui.UI(By.CSS_SELECTOR, "div.name"),
                maximize_icon=ui.UI(
                    By.XPATH,
                    './/span[@class="glyphicon glyphicon-triangle-right"]'),
                button_execute_config=ui.Button(By.CSS_SELECTOR,
                                                'button.btn.btn-success'),
                button_edit_config=ui.Button(
                    By.XPATH, './/button[contains(@class, "btn-primary") and '
                    'contains(text(), "Edit")]'),
                button_view_config=ui.Button(
                    By.XPATH, './/button[contains(@class, "btn-primary") and '
                    'contains(text(), "View")]'),
                button_delete_config=ui.Button(By.CSS_SELECTOR,
                                               'button.btn.btn-danger'))
class RowConfiguration(ui.Row):
    """Row of configuration."""
Exemple #5
0
# 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

from stepler.horizon.app import ui as _ui

from ..base import PageBase
from ..instances.page_instances import FormLaunchInstance


@ui.register_ui(
    item_create_volume=ui.UI(By.XPATH, './/a[contains(., "Create Volume")]'),
    item_update_metadata=ui.UI(By.XPATH,
                               './/a[contains(., "Update Metadata")]'),
    item_delete=ui.UI(By.XPATH, './/a[contains(., "Delete Image")]'),
    item_edit=ui.UI(By.XPATH, './/a[contains(., "Edit Image")]'),
)
class DropdownMenu(_ui.DropdownMenu):
    """Dropdown menu for image row."""


@ui.register_ui(checkbox=_ui.CheckBox(By.CSS_SELECTOR,
                                      'input[type="checkbox"]'),
                dropdown_menu=DropdownMenu(),
                link_image=ui.Link(By.CSS_SELECTOR, 'td a'))
class RowImage(_ui.Row):
    """Row with image in images table."""
#    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

from stepler.horizon.app import ui as _ui


@ui.register_ui(item_update_volume_status=ui.UI(
    By.CSS_SELECTOR, '*[id*="action_update_status"]'),
                item_migrate_volume=ui.UI(By.CSS_SELECTOR,
                                          '[id$="action_migrate"]'))
class DropdownMenu(_ui.DropdownMenu):
    """Dropdown menu for admin volume row."""


@ui.register_ui(checkbox=_ui.CheckBox(By.CSS_SELECTOR,
                                      'input[type="checkbox"]'),
                dropdown_menu=DropdownMenu())
class RowVolume(_ui.Row):
    """Row of admin volume."""


class TableVolumes(_ui.Table):
    """Admin volumes table."""
Exemple #7
0
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
    row_xpath = ".//div[contains(@ng-repeat, 'container')]"
    @property
    @ui.wait_for_presence
    def value(self):
        """Value of radio buttons group."""
        return self.webelement.find_element(
            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


class TableAvailableSources(_ui.Table):
    """Available sources table."""