Exemple #1
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 cases.app.pages.base import PageBase

__all__ = [
    'PageLogin',
]


@ui.register_ui(
    link_facebook_login=ui.Link(
        By.CSS_SELECTOR, '.list-group-item span[class*="facebook-logo"]'),
    link_google_login=ui.Link(
        By.CSS_SELECTOR, '.list-group-item span[class*="google-logo"]'),
    link_amazon_login=ui.Link(
        By.CSS_SELECTOR, '.list-group-item span[class*="amazon-logo"]'),
    link_imdb_login=ui.Link(
        By.CSS_SELECTOR, '.list-group-item span[class*="imdb-logo"]'),
    link_create_account=ui.Link(
        By.CSS_SELECTOR, '.list-group-item.create-account'))
class PageLogin(PageBase):
    """Login IMDB page."""

    url = '/registration/signin'
@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')]"


@ui.register_ui(item_delete=ui.UI(By.CSS_SELECTOR, '.text-danger'))
class DropdownMenu(_ui.DropdownMenu):
    """Dropdown menu for row with object."""
Exemple #3
0
# 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 import config

from .form import Form


@ui.register_ui(item_exit=ui.UI(By.CSS_SELECTOR, 'a[href*="/auth/logout/"]'),
                item_help=ui.Link(By.CSS_SELECTOR, 'a[target="_blank"]'))
class DropdownMenuAccount(ui.Block):
    """Dropdown menu for account settings."""


@ui.register_ui(label_project=ui.UI(By.CSS_SELECTOR, '.context-project'))
class DropdownMenuProject(ui.Block):
    """Dropdown menu for project switching."""
    def item_project(self, name):
        """Get project item from from dropdown list."""
        selector = (
            './/ul[contains(@class, "dropdown-menu")]/li//span[contains('
            '@class, "dropdown-title") and contains(., "{}")]'.format(name))

        item = ui.UI(By.XPATH, selector)
        item.container = self
Exemple #4
0
from ..instances.page_instances import FormLaunchInstance
from ..volumes.tab_volumes import FormCreateVolume


@ui.register_ui(item_create_volume=ui.UI(
    By.CSS_SELECTOR, '[id$="action_create_volume_from_image"]'),
                item_update_metadata=ui.UI(By.CSS_SELECTOR,
                                           '[id$="action_update_metadata"]'))
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."""

    transit_statuses = ('Queued', 'Saving')


class TableImages(_ui.Table):
    """Images table."""

    columns = {'name': 2, 'type': 3, 'status': 4, 'format': 7}
    row_cls = RowImage


@ui.register_ui(checkbox_protected=_ui.CheckBox(By.NAME, 'protected'),
                combobox_disk_format=ui.ComboBox(By.NAME, 'disk_format'),
Exemple #5
0
# See the License for the specific language governing permissions and
# limitations under the License.

import re

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

from cases.app.pages.base import PageBase

__all__ = [
    'PageTopMovies',
]


@ui.register_ui(link_social=ui.Link(By.TAG_NAME, 'a'))
class RowSocial(ui.Row):
    """Social item."""


class ListSocial(ui.List):
    """List of social items."""

    row_cls = RowSocial
    row_xpath = ".//div[contains(@class, 'dropdown-menu-item')]"


class CellMovie(ui.Block):
    """Cell of movie row."""
    @property
    def value(self):
Exemple #6
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 import config

from .form import Form


@ui.register_ui(
    item_exit=ui.UI(By.XPATH, "//a[@href='/auth/logout/']"),
    item_help=ui.Link(By.XPATH, "//a[@href='http://docs.openstack.org']"),
    item_download_rcv3=ui.UI(By.XPATH,
                             "//a[@href='/project/api_access/openrc/']"),
    item_download_rcv2=ui.UI(By.XPATH,
                             "//a[@href='/project/api_access/openrcv2/']"))
class DropdownMenuAccount(ui.Block):
    """Dropdown menu for account settings."""


@ui.register_ui(label_project=ui.UI(By.CSS_SELECTOR, '.context-project'))
class DropdownMenuProject(ui.Block):
    """Dropdown menu for project switching."""
    def item_project(self):
        """Get project item from from dropdown list."""
        return self.webelement.find_elements_by_xpath(
            '//ul[@class="dropdown-menu"]//li')[2]
Exemple #7
0
                                     '*[id*="action_associate"]'),
                item_disassociate=ui.UI(By.CSS_SELECTOR,
                                        '*[id*="action_disassociate"]'),
                item_resize=ui.UI(By.CSS_SELECTOR, '*[id*="action_resize"]'),
                item_edit_instance=ui.UI(By.CSS_SELECTOR,
                                         '*[id*="action_edit"]'),
                item_suspend=ui.UI(By.CSS_SELECTOR, '*[id*="action_suspend"]'),
                item_pause=ui.UI(By.CSS_SELECTOR, '*[id*="action_pause"]'))
class DropdownMenu(_ui.DropdownMenu):
    """Dropdown menu for instance row."""


@ui.register_ui(checkbox=_ui.CheckBox(By.CSS_SELECTOR,
                                      'input[type="checkbox"]'),
                dropdown_menu=DropdownMenu(),
                link_instance=ui.Link(By.CSS_SELECTOR, 'td > a'))
class RowInstance(_ui.Row):
    """Row with instance."""

    transit_statuses = ('Build', 'Resize/Migrate')


class TableInstances(_ui.Table):
    """Instances table."""

    columns = {'name': 2, 'ips': 4, 'size': 5, 'status': 7}
    row_cls = RowInstance

    def value(self):
        """List parameters of instance."""
        return self.webelement.find_elements(By.CLASS_NAME, 'status_up')
Exemple #8
0
# 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 cases.app.pages.base import PageBase

__all__ = [
    'PageMovieDetails',
]


@ui.register_ui(
    label_title=ui.UI(By.CSS_SELECTOR, 'h1[itemprop="name"]'),
    link_year=ui.Link(By.CSS_SELECTOR, '#titleYear > a'),
    label_rating=ui.UI(By.CSS_SELECTOR, '[itemprop="ratingValue"]'))
class PageMovieDetails(PageBase):
    """Page with movie details."""

    url = '/title'
Exemple #9
0
@ui.register_ui(item_suspend_stack=ui.UI(By.CSS_SELECTOR,
                                         '*[id$="action_suspend"]'),
                item_resume_stack=ui.UI(By.CSS_SELECTOR,
                                        '*[id$="action_resume"]'),
                item_change_template=ui.UI(By.CSS_SELECTOR,
                                           '*[id$="action_edit"]'),
                item_delete_stack=ui.UI(By.CSS_SELECTOR,
                                        '*[id$="action_delete"]'))
class DropdownMenu(_ui.DropdownMenu):
    """Dropdown menu for stack row."""


@ui.register_ui(checkbox=_ui.CheckBox(By.CSS_SELECTOR,
                                      'input[type="checkbox"]'),
                dropdown_menu=DropdownMenu(),
                link_stack=ui.Link(By.CSS_SELECTOR,
                                   'td > hz-cell > hz-field > a'))
class RowStack(_ui.Row):
    """Row with stack in stacks table."""


class TableStacks(_ui.Table):
    """Stacks table."""
    columns = {'name': 2, 'status': 6}
    row_cls = RowStack


@ui.register_ui(
    combobox_template_source=_ui.combobox_by_label('Template Source'),
    combobox_env_source=_ui.combobox_by_label('Environment Source'),
    field_template_data=ui.TextField(By.NAME, 'template_data'),
    field_env_data=ui.TextField(By.NAME, 'environment_data'))
Exemple #10
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 whale.decapod_ui.app import ui as _ui


@ui.register_ui(link_clusters=ui.Link(By.CSS_SELECTOR, 'a[href="/clusters"]'),
                link_configurations=ui.Link(By.CSS_SELECTOR,
                                            'a[href="/configurations"]'),
                link_users_management=ui.Link(By.CSS_SELECTOR,
                                              'a[href="/admin"]'))
class Header(ui.Block):
    """Header block."""


@ui.register_ui(link_users=ui.Link(By.CSS_SELECTOR, 'a[href="/admin/users"]'),
                link_roles=ui.Link(By.CSS_SELECTOR, 'a[href="/admin/roles"]'))
class UserManagementHeader(ui.Block):
    """User management header block."""


@ui.register_ui(current_user=ui.Link(By.XPATH,
Exemple #11
0
@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 > hz-cell > hz-field > a'))
class RowImage(_ui.Row):
    """Row with image in images table."""

    transit_statuses = ('Queued', 'Saving')


class TableImages(_ui.Table):
    """Images table."""

    columns = {'name': 4, 'status': 6}
    row_cls = RowImage


@ui.register_ui(
    button_group_protected=_ui.button_group_by_label("Protected"),
Exemple #12
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 whale.decapod_ui.app import ui as _ui


@ui.register_ui(current_user=ui.Link(By.XPATH,
                                     '//div[@class="current-user"]/a[1]'),
                logout=ui.Link(By.XPATH, '//div[@class="current-user"]/a[2]'),
                navigate_menu=_ui.NavigateMenu(
                    By.XPATH, './/ul[@class="col-xs-8 navigation"]/li'))
class PageBase(pom.Page):
    """Base page of user account."""

    url = '/'

    page_header_value = None
    _page_header_selector = '//h1[contains(text(),"{}")]'

    navigate_items = None

    def navigate(self, navigate_items):
        """Open page via navigation menu."""