~ubuntu-branches/ubuntu/vivid/horizon/vivid-proposed

« back to all changes in this revision

Viewing changes to openstack_dashboard/test/integration_tests/pages/settings/settingspage.py

  • Committer: Package Import Robot
  • Author(s): Corey Bryant, Corey Bryant, James Page
  • Date: 2015-02-16 13:50:29 UTC
  • mfrom: (0.10.1) (1.2.6)
  • Revision ID: package-import@ubuntu.com-20150216135029-m632ppq5etw9te0c
Tags: 1:2015.1~b2-0ubuntu1
[ Corey Bryant ]
* New upstream release.
  - d/control: Align with upstream dependencies.
  - d/p/embedded-xstatic.patch: Refreshed. Code moved to new files.
  - d/p/fix-requirements.patch: Added to drop selenium dependency.

[ James Page ]
* d/bundle-xstatic.sh: Use --system flag when generating xstatic
  assets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
2
 
#    not use this file except in compliance with the License. You may obtain
3
 
#    a copy of the License at
4
 
#
5
 
#         http://www.apache.org/licenses/LICENSE-2.0
6
 
#
7
 
#    Unless required by applicable law or agreed to in writing, software
8
 
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9
 
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10
 
#    License for the specific language governing permissions and limitations
11
 
#    under the License.
12
 
 
13
 
from selenium.webdriver.common import by
14
 
 
15
 
from openstack_dashboard.test.integration_tests.pages import basepage
16
 
from openstack_dashboard.test.integration_tests.pages.settings import \
17
 
    changepasswordpage
18
 
from openstack_dashboard.test.integration_tests.regions import forms
19
 
 
20
 
 
21
 
class SettingsPage(basepage.BasePage):
22
 
    DEFAULT_LANGUAGE = "en"
23
 
    DEFAULT_TIMEZONE = "UTC"
24
 
    DEFAULT_PAGESIZE = "20"
25
 
    DEFAULT_SETTINGS = {
26
 
        "language": DEFAULT_LANGUAGE,
27
 
        "timezone": DEFAULT_TIMEZONE,
28
 
        "pagesize": DEFAULT_PAGESIZE
29
 
    }
30
 
 
31
 
    SETTINGS_FORM_FIELDS = ("language", "timezone", "pagesize")
32
 
 
33
 
    _settings_form_locator = (by.By.CSS_SELECTOR, 'div#user_settings_modal')
34
 
    _change_password_tab_locator = (by.By.CSS_SELECTOR,
35
 
                                    'a[href*="/settings/password/"]')
36
 
 
37
 
    def __init__(self, driver, conf):
38
 
        super(SettingsPage, self).__init__(driver, conf)
39
 
        self._page_title = "User Settings"
40
 
 
41
 
    @property
42
 
    def settings_form(self):
43
 
        src_elem = self._get_element(*self._settings_form_locator)
44
 
        return forms.FormRegion(self.driver, self.conf, src_elem,
45
 
                                self.SETTINGS_FORM_FIELDS)
46
 
 
47
 
    @property
48
 
    def changepassword(self):
49
 
        return changepasswordpage.ChangePasswordPage(self.driver, self.conf)
50
 
 
51
 
    @property
52
 
    def change_password_tab(self):
53
 
        return self._get_element(*self._change_password_tab_locator)
54
 
 
55
 
    def change_language(self, lang=DEFAULT_LANGUAGE):
56
 
        self.settings_form.language.value = lang
57
 
        self.settings_form.submit.click()
58
 
 
59
 
    def change_timezone(self, timezone=DEFAULT_TIMEZONE):
60
 
        self.settings_form.timezone.value = timezone
61
 
        self.settings_form.submit.click()
62
 
 
63
 
    def change_pagesize(self, size=DEFAULT_PAGESIZE):
64
 
        self.settings_form.pagesize.value = size
65
 
        self.settings_form.submit.click()
66
 
 
67
 
    def return_to_default_settings(self):
68
 
        self.change_language()
69
 
        self.change_timezone()
70
 
        self.change_pagesize()
71
 
 
72
 
    def go_to_change_password_page(self):
73
 
        self.change_password_tab.click()
74
 
        return changepasswordpage.ChangePasswordPage(self.driver, self.conf)