This repository has been archived by the owner on Aug 20, 2018. It is now read-only.
/
teams.py
61 lines (43 loc) · 1.88 KB
/
teams.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
from page import PageRegion
from pages.base import BasePage
class TeamsPage(BasePage):
_page_title = u'Teams | QMO'
_team_region_locator = (By.CSS_SELECTOR, '.team')
def go_to_teams_page(self):
self.get_relative_path('/teams')
self.is_the_current_page
def open_team_page(self, team_name):
for team in self.teams:
if team.name == team_name:
return team.open_team_page(team_name)
raise Exception(u'There is no team with such name: %s' % team_name)
@property
def teams(self):
return [TeamRegion(self.testsetup, web_element) for web_element
in self.find_elements(*self._team_region_locator)]
class TeamRegion(PageRegion):
_team_avatar_locator = (By.CSS_SELECTOR, '.attachment-team-icon-small')
_team_title_locator = (By.CSS_SELECTOR, '.entry-title > a')
_team_description_locator = (By.CSS_SELECTOR, '#teams-list p')
_team_meta_block_locator = (By.CSS_SELECTOR, '.team-meta')
@property
def name(self):
return self.find_element(*self._team_title_locator).text
def open_team_page(self, team_name):
self.find_element(*self._team_title_locator).click()
from pages.about_team import AboutTeamPage
return AboutTeamPage(self.testsetup, team=team_name)
@property
def is_avatar_displayed(self):
return self.is_element_visible(*self._team_avatar_locator)
@property
def description(self):
return self.find_element(*self._team_description_locator).text
@property
def meta_info(self):
return self.find_element(*self._team_meta_block_locator).text