Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c84abfab
Commit
c84abfab
authored
Aug 13, 2015
by
cahrens
Committed by
Andy Armstrong
Aug 14, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bok choy tests for dynamic updating after team changes.
parent
a24e3cb0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
39 deletions
+99
-39
common/test/acceptance/pages/lms/teams.py
+63
-5
common/test/acceptance/tests/lms/test_teams.py
+36
-34
No files found.
common/test/acceptance/pages/lms/teams.py
View file @
c84abfab
...
...
@@ -45,6 +45,42 @@ class TeamsPage(CoursePage):
""" View the Browse tab of the Teams page. """
self
.
q
(
css
=
BROWSE_BUTTON_CSS
)
.
click
()
def
verify_team_count_in_first_topic
(
self
,
expected_count
):
"""
Verify that the team count on the first topic card in the topic list is correct
(browse topics page).
"""
self
.
wait_for
(
lambda
:
self
.
q
(
css
=
'.team-count'
)[
0
]
.
text
==
"0 Teams"
if
expected_count
==
0
else
"1 Team"
,
description
=
"Team count text on topic is wrong"
)
def
verify_topic_team_count
(
self
,
expected_count
):
""" Verify the number of teams listed on the topic page (browse teams within topic). """
self
.
wait_for
(
lambda
:
len
(
self
.
q
(
css
=
'.team-card'
))
==
expected_count
,
description
=
"Expected number of teams is wrong"
)
def
verify_my_team_count
(
self
,
expected_count
):
""" Verify the number of teams on 'My Team'. """
# Click to "My Team" and verify that it contains the expected number of teams.
self
.
q
(
css
=
MY_TEAMS_BUTTON_CSS
)
.
click
()
self
.
wait_for
(
lambda
:
len
(
self
.
q
(
css
=
'.team-card'
))
==
expected_count
,
description
=
"Expected number of teams is wrong"
)
def
click_all_topics
(
self
):
""" Click on the "All Topics" breadcrumb """
self
.
q
(
css
=
'a.nav-item'
)
.
filter
(
text
=
'All Topics'
)[
0
]
.
click
()
def
click_specific_topic
(
self
,
topic
):
""" Click on the breadcrumb for a specific topic """
self
.
q
(
css
=
'a.nav-item'
)
.
filter
(
text
=
topic
)[
0
]
.
click
()
class
MyTeamsPage
(
CoursePage
,
PaginatedUIMixin
):
"""
...
...
@@ -284,10 +320,14 @@ class TeamPage(CoursePage, PaginatedUIMixin):
"""Verifies that team leave link is present"""
return
self
.
q
(
css
=
'.leave-team-link'
)
.
present
def
click_leave_team_link
(
self
):
def
click_leave_team_link
(
self
,
remaining_members
=
0
):
""" Click on Leave Team link"""
self
.
q
(
css
=
'.leave-team-link'
)
.
first
.
click
()
self
.
wait_for_ajax
()
self
.
wait_for
(
lambda
:
self
.
join_team_button_present
,
description
=
"Join Team button did not become present"
)
self
.
wait_for_capacity_text
(
remaining_members
)
@property
def
team_members
(
self
):
...
...
@@ -303,10 +343,29 @@ class TeamPage(CoursePage, PaginatedUIMixin):
"""Returns the username of team member"""
return
self
.
q
(
css
=
'.page-content-secondary .tooltip-custom'
)
.
text
[
0
]
def
click_join_team_button
(
self
):
def
click_join_team_button
(
self
,
total_members
=
1
):
""" Click on Join Team button"""
self
.
q
(
css
=
'.join-team .action-primary'
)
.
first
.
click
()
self
.
wait_for_ajax
()
self
.
wait_for
(
lambda
:
not
self
.
join_team_button_present
,
description
=
"Join Team button did not go away"
)
self
.
wait_for_capacity_text
(
total_members
)
def
wait_for_capacity_text
(
self
,
num_members
,
max_size
=
10
):
""" Wait for the team capacity text to be correct. """
self
.
wait_for
(
lambda
:
self
.
team_capacity_text
==
self
.
format_capacity_text
(
num_members
,
max_size
),
description
=
"Team capacity text is not correct"
)
def
format_capacity_text
(
self
,
num_members
,
max_size
):
""" Helper method to format the expected team capacity text. """
return
'{num_members} / {max_size} {members_text}'
.
format
(
num_members
=
num_members
,
max_size
=
max_size
,
members_text
=
'Member'
if
num_members
==
max_size
else
'Members'
)
@property
def
join_team_message
(
self
):
...
...
@@ -317,7 +376,6 @@ class TeamPage(CoursePage, PaginatedUIMixin):
@property
def
join_team_button_present
(
self
):
""" Returns True if Join Team button is present else False """
self
.
wait_for_ajax
()
return
self
.
q
(
css
=
'.join-team .action-primary'
)
.
present
@property
...
...
common/test/acceptance/tests/lms/test_teams.py
View file @
c84abfab
...
...
@@ -113,6 +113,12 @@ class TeamsTabBase(UniqueCourseTest):
]
map
(
assert_team_equal
,
expected_teams
,
team_card_names
,
team_card_descriptions
)
def
verify_my_team_count
(
self
,
expected_number_of_teams
):
""" Verify the number of teams shown on "My Team". """
# We are doing these operations on this top-level page object to avoid reloading the page.
self
.
teams_page
.
verify_my_team_count
(
expected_number_of_teams
)
@ddt.ddt
@attr
(
'shard_5'
)
...
...
@@ -530,35 +536,6 @@ class BrowseTeamsWithinTopicTest(TeamsTabBase):
self
.
browse_teams_page
.
go_to_page
(
1
)
self
.
verify_on_page
(
1
,
teams
,
'Showing 1-10 out of 20 total'
,
True
)
@ddt.data
(
[
'Moderator'
,
False
]
[
'Community TA'
,
False
],
[
'Administrator'
,
False
]
)
def
test_create_team
(
self
,
role
,
should_join_team
):
"""
Scenario: Team cards correctly reflect membership of the team.
Given I am enrolled in a course with a team configuration and a topic
containing one team
And I add myself to the team
When I visit the Teams page for that topic
Then I should see the correct page header
And I should see the team for that topic
And I should see that the team card shows my membership
When I visit the My Teams page
"""
teams
=
self
.
create_teams
(
self
.
topic
,
1
)
self
.
browse_teams_page
.
visit
()
self
.
verify_page_header
()
self
.
verify_teams
(
self
.
browse_teams_page
,
teams
)
self
.
create_membership
(
self
.
user_info
[
'username'
],
teams
[
0
][
'id'
])
self
.
browser
.
refresh
()
self
.
browse_teams_page
.
wait_for_ajax
()
self
.
assertEqual
(
self
.
browse_teams_page
.
team_cards
[
0
]
.
find_element_by_css_selector
(
'.member-count'
)
.
text
,
'1 / 10 Members'
)
def
test_navigation_links
(
self
):
"""
Scenario: User should be able to navigate to "browse all teams" and "search team description" links.
...
...
@@ -720,6 +697,9 @@ class CreateTeamTest(TeamsTabBase):
And I click Create button
Then I should see the page for my team
And I should see the message that says "You are member of this team"
And the new team should be added to the list of teams within the topic
And the number of teams should be updated on the topic card
And if I switch to "My Team", the newly created team is displayed
"""
self
.
verify_and_navigate_to_create_team_page
()
...
...
@@ -733,6 +713,16 @@ class CreateTeamTest(TeamsTabBase):
self
.
assertEqual
(
team_page
.
team_description
,
'The Avengers are a fictional team of superheroes.'
)
self
.
assertEqual
(
team_page
.
team_user_membership_text
,
'You are a member of this team.'
)
# Verify the new team was added to the topic list
self
.
teams_page
.
click_specific_topic
(
"Example Topic"
)
self
.
teams_page
.
verify_topic_team_count
(
1
)
self
.
teams_page
.
click_all_topics
()
self
.
teams_page
.
verify_team_count_in_first_topic
(
1
)
# Verify that if one switches to "My Team" without reloading the page, the newly created team is shown.
self
.
verify_my_team_count
(
1
)
def
test_user_can_cancel_the_team_creation
(
self
):
"""
Scenario: The user should be able to cancel the creation of new team.
...
...
@@ -741,6 +731,7 @@ class CreateTeamTest(TeamsTabBase):
Then I should see the Create Team header and form
When I click Cancel button
Then I should see teams list page without any new team.
And if I switch to "My Team", it shows no teams
"""
self
.
assertEqual
(
self
.
browse_teams_page
.
get_pagination_header_text
(),
'Showing 0 out of 0 total'
)
...
...
@@ -750,6 +741,11 @@ class CreateTeamTest(TeamsTabBase):
self
.
assertTrue
(
self
.
browse_teams_page
.
is_browser_on_page
())
self
.
assertEqual
(
self
.
browse_teams_page
.
get_pagination_header_text
(),
'Showing 0 out of 0 total'
)
self
.
teams_page
.
click_all_topics
()
self
.
teams_page
.
verify_team_count_in_first_topic
(
0
)
self
.
verify_my_team_count
(
0
)
@attr
(
'shard_5'
)
@ddt.ddt
...
...
@@ -887,11 +883,7 @@ class TeamPageTest(TeamsTabBase):
"""
self
.
assertEqual
(
self
.
team_page
.
team_capacity_text
,
'{num_members} / {max_size} {members_text}'
.
format
(
num_members
=
num_members
,
max_size
=
max_size
,
members_text
=
'Member'
if
num_members
==
max_size
else
'Members'
)
self
.
team_page
.
format_capacity_text
(
num_members
,
max_size
)
)
self
.
assertEqual
(
self
.
team_page
.
team_location
,
'Afghanistan'
)
self
.
assertEqual
(
self
.
team_page
.
team_language
,
'Afar'
)
...
...
@@ -980,6 +972,7 @@ class TeamPageTest(TeamsTabBase):
Then there should be no Join Team button and no message
And I should see the updated information under Team Details
And I should see New Post button
And if I switch to "My Team", the team I have joined is displayed
"""
self
.
_set_team_configuration_and_membership
(
create_membership
=
False
)
self
.
team_page
.
visit
()
...
...
@@ -989,6 +982,10 @@ class TeamPageTest(TeamsTabBase):
self
.
assertFalse
(
self
.
team_page
.
join_team_message_present
)
self
.
assert_team_details
(
num_members
=
1
,
is_member
=
True
)
# Verify that if one switches to "My Team" without reloading the page, the newly created team is shown.
self
.
teams_page
.
click_all_topics
()
self
.
verify_my_team_count
(
1
)
def
test_already_member_message
(
self
):
"""
Scenario: User should see `You are already in a team` if user is a
...
...
@@ -1042,6 +1039,7 @@ class TeamPageTest(TeamsTabBase):
Then user should be removed from team
And I should see Join Team button
And I should not see New Post button
And if I switch to "My Team", the team I have left is not displayed
"""
self
.
_set_team_configuration_and_membership
()
self
.
team_page
.
visit
()
...
...
@@ -1050,3 +1048,7 @@ class TeamPageTest(TeamsTabBase):
self
.
team_page
.
click_leave_team_link
()
self
.
assert_team_details
(
num_members
=
0
,
is_member
=
False
)
self
.
assertTrue
(
self
.
team_page
.
join_team_button_present
)
# Verify that if one switches to "My Team" without reloading the page, the old team no longer shows.
self
.
teams_page
.
click_all_topics
()
self
.
verify_my_team_count
(
0
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment