diff options
Diffstat (limited to 'files/puppet/modules/pixelated/files/functional-tests/page_objects/tag_list.py')
-rw-r--r-- | files/puppet/modules/pixelated/files/functional-tests/page_objects/tag_list.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/tag_list.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/tag_list.py new file mode 100644 index 0000000..bc152da --- /dev/null +++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/tag_list.py @@ -0,0 +1,66 @@ +# +# Copyright (c) 2015 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see <http://www.gnu.org/licenses/>. + +from base_page_object import BasePageObject + +from selenium.webdriver.common.by import By + + +class TagList(BasePageObject): + def __init__(self, context, timeout=10): + self._locators = { + 'inbox': 'li#tag-inbox', + 'trash': 'li#tag-trash', + 'draft': 'li#tag-draft', + 'sent': 'li#tag-sent' + } + super(TagList, self).__init__(context, timeout) + + def go_to_trash(self): + self._trash_tag().click() + + def go_to_drafts(self): + self._draft_tag().click() + + def go_to_inbox(self): + self._inbox_tag().click() + + def go_to_sent(self): + self._sent_tag().click() + + def go_to_mailbox(self, mailbox): + self._go_to_mailbox(mailbox).click() + + def _go_to_mailbox(self, mailbox): + if not self._locators.has_key(mailbox): + # user created tag + return self._find_element_by_css_locator('#tag-%s' % mailbox) + return self._find_element_by_css_locator(self._locators[mailbox]) + + def _trash_tag(self): + return self._find_element_by_css_locator(self._locators['trash']) + + def _draft_tag(self): + return self._find_element_by_css_locator(self._locators['draft']) + + def _inbox_tag(self): + return self._find_element_by_css_locator(self._locators['inbox']) + + def _inbox_tag(self): + return self._find_element_by_css_locator(self._locators['sent']) + + def is_pixelated_loaded(self): + self.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, self._locators['inbox'])) |