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
64838f56
Commit
64838f56
authored
Jun 28, 2016
by
Muddasser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conversion of cms/signup.feature to bok-choy
parent
467bc55d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
274 additions
and
108 deletions
+274
-108
cms/djangoapps/contentstore/features/signup.feature
+0
-44
common/test/acceptance/pages/studio/howitworks.py
+0
-17
common/test/acceptance/pages/studio/index.py
+46
-6
common/test/acceptance/pages/studio/login.py
+37
-16
common/test/acceptance/pages/studio/signup.py
+18
-1
common/test/acceptance/tests/studio/test_studio_general.py
+173
-24
No files found.
cms/djangoapps/contentstore/features/signup.feature
deleted
100644 → 0
View file @
467bc55d
@shard_2
Feature
:
CMS.Sign in
In order to use the edX content
As a new user
I want to signup for a student account
Scenario
:
Sign up from the homepage
Given
I visit the Studio homepage
When
I click the link with the text
"Sign Up"
And
I fill in the registration form
And
I press the Create My Account button on the registration form
Then
I should see an email verification prompt
Scenario
:
Login with a valid redirect
Given
I have opened a new course in Studio
And
I am not logged in
And I visit the url "/course/slashes
:
MITx+999+Robot_Super_Course"
And
I should see that the path is
"/signin?next=/course/slashes%3AMITx%2B999%2BRobot_Super_Course"
When
I fill in and submit the signin form
And
I wait for
"2"
seconds
Then I should see that the path is "/course/slashes
:
MITx+999+Robot_Super_Course"
Scenario
:
Login with an invalid redirect
Given
I have opened a new course in Studio
And
I am not logged in
And I visit the url "/signin?next=http
:
//www.google.com/"
When
I fill in and submit the signin form
And
I wait for
"2"
seconds
Then
I should see that the path is
"/home/"
Scenario
:
Login with mistyped credentials
Given
I have opened a new course in Studio
And
I am not logged in
And
I visit the Studio homepage
When
I click the link with the text
"Sign In"
Then
I should see that the path is
"/signin"
And
I should not see a login error message
And
I fill in and submit the signin form incorrectly
Then
I should see a login error message
And
I edit the password field
Then
I should not see a login error message
And
I submit the signin form
And
I wait for
"2"
seconds
Then
I should see that the path is
"/home/"
common/test/acceptance/pages/studio/howitworks.py
deleted
100644 → 0
View file @
467bc55d
"""
Home page for Studio when not logged in.
"""
from
bok_choy.page_object
import
PageObject
from
common.test.acceptance.pages.studio
import
BASE_URL
class
HowitworksPage
(
PageObject
):
"""
Home page for Studio when not logged in.
"""
url
=
BASE_URL
+
"/howitworks"
def
is_browser_on_page
(
self
):
return
self
.
q
(
css
=
'body.view-howitworks'
)
.
present
common/test/acceptance/pages/studio/index.py
View file @
64838f56
"""
"""
Studio
Home page
Studio
Index, home and dashboard pages. These are the starting pages for users.
"""
"""
from
bok_choy.page_object
import
PageObject
from
bok_choy.page_object
import
PageObject
from
common.test.acceptance.pages.studio
import
BASE_URL
from
selenium.webdriver
import
ActionChains
from
selenium.webdriver
import
ActionChains
from
common.test.acceptance.pages.studio
import
BASE_URL
from
common.test.acceptance.pages.studio.login
import
LoginPage
from
common.test.acceptance.pages.studio.signup
import
SignupPage
class
DashboardPage
(
PageObject
):
class
HeaderMixin
(
object
):
"""
Mixin class used for the pressing buttons in the header.
"""
def
click_sign_up
(
self
):
"""
Press the Sign Up button in the header.
"""
next_page
=
SignupPage
(
self
.
browser
)
self
.
q
(
css
=
'.action-signup'
)[
0
]
.
click
()
return
next_page
.
wait_for_page
()
def
click_sign_in
(
self
):
"""
Press the Sign In button in the header.
"""
next_page
=
LoginPage
(
self
.
browser
)
self
.
q
(
css
=
'.action-signin'
)[
0
]
.
click
()
return
next_page
.
wait_for_page
()
class
IndexPage
(
PageObject
,
HeaderMixin
):
"""
"""
Studio Home page
Home page for Studio when not logged in.
"""
"""
url
=
BASE_URL
+
"/"
def
is_browser_on_page
(
self
):
return
self
.
q
(
css
=
'.wrapper-text-welcome'
)
.
visible
class
DashboardPage
(
PageObject
):
"""
Studio Dashboard page with courses.
The user must be logged in to access this page.
"""
url
=
BASE_URL
+
"/course/"
url
=
BASE_URL
+
"/course/"
def
is_browser_on_page
(
self
):
def
is_browser_on_page
(
self
):
...
@@ -79,7 +112,7 @@ class DashboardPage(PageObject):
...
@@ -79,7 +112,7 @@ class DashboardPage(PageObject):
def
is_new_library_form_valid
(
self
):
def
is_new_library_form_valid
(
self
):
"""
"""
I
S
the new library form ready to submit?
I
s
the new library form ready to submit?
"""
"""
return
(
return
(
self
.
q
(
css
=
'.wrapper-create-library .new-library-save:not(.is-disabled)'
)
.
present
and
self
.
q
(
css
=
'.wrapper-create-library .new-library-save:not(.is-disabled)'
)
.
present
and
...
@@ -237,6 +270,13 @@ class DashboardPage(PageObject):
...
@@ -237,6 +270,13 @@ class DashboardPage(PageObject):
return
self
.
q
(
css
=
'#settings-language-value'
)
return
self
.
q
(
css
=
'#settings-language-value'
)
class
HomePage
(
DashboardPage
):
"""
Home page for Studio when logged in.
"""
url
=
BASE_URL
+
"/home/"
class
DashboardPageWithPrograms
(
DashboardPage
):
class
DashboardPageWithPrograms
(
DashboardPage
):
"""
"""
Extends DashboardPage for bok choy testing programs-related behavior.
Extends DashboardPage for bok choy testing programs-related behavior.
...
...
common/test/acceptance/pages/studio/login.py
View file @
64838f56
"""
"""
Login page for Studio.
Login page for Studio.
"""
"""
from
bok_choy.page_object
import
PageObject
from
bok_choy.page_object
import
PageObject
from
bok_choy.promise
import
EmptyPromise
from
bok_choy.promise
import
EmptyPromise
from
common.test.acceptance.pages.studio
import
BASE_URL
from
common.test.acceptance.pages.studio
import
BASE_URL
from
common.test.acceptance.pages.studio.course_page
import
CoursePage
class
Login
Page
(
PageO
bject
):
class
Login
Mixin
(
o
bject
):
"""
"""
Login page for Studio
.
Mixin class used for logging into the system
.
"""
"""
def
fill_field
(
self
,
css
,
value
):
"""
Fill the login form field with the value.
"""
self
.
q
(
css
=
css
)
.
fill
(
value
)
def
login
(
self
,
email
,
password
,
expect_success
=
True
):
"""
Attempt to log in using 'email' and 'password'.
"""
self
.
fill_field
(
'input#email'
,
email
)
self
.
fill_field
(
'input#password'
,
password
)
self
.
q
(
css
=
'button#submit'
)
.
first
.
click
()
# Ensure that we make it to another page
if
expect_success
:
EmptyPromise
(
lambda
:
"signin"
not
in
self
.
browser
.
current_url
,
"redirected from the login page"
)
.
fulfill
()
class
LoginPage
(
PageObject
,
LoginMixin
):
"""
Login page for Studio.
"""
url
=
BASE_URL
+
"/signin"
url
=
BASE_URL
+
"/signin"
def
is_browser_on_page
(
self
):
def
is_browser_on_page
(
self
):
return
self
.
q
(
css
=
'body.view-signin'
)
.
present
return
self
.
q
(
css
=
'body.view-signin'
)
.
visible
def
login
(
self
,
email
,
password
):
"""
Attempt to log in using `email` and `password`.
"""
self
.
q
(
css
=
'input#email'
)
.
fill
(
email
)
class
CourseOutlineSignInRedirectPage
(
CoursePage
,
LoginMixin
):
self
.
q
(
css
=
'input#password'
)
.
fill
(
password
)
"""
self
.
q
(
css
=
'button#submit'
)
.
first
.
click
()
Page shown when the user tries to accesses the course while not signed in.
"""
url_path
=
"course"
# Ensure that we make it to another page
def
is_browser_on_page
(
self
):
EmptyPromise
(
return
self
.
q
(
css
=
'body.view-signin'
)
.
visible
lambda
:
"login"
not
in
self
.
browser
.
current_url
,
"redirected from the login page"
)
.
fulfill
()
common/test/acceptance/pages/studio/signup.py
View file @
64838f56
"""
Signup page for studio
"""
from
bok_choy.page_object
import
PageObject
from
bok_choy.page_object
import
PageObject
from
common.test.acceptance.pages.studio
import
BASE_URL
from
common.test.acceptance.pages.studio
import
BASE_URL
from
common.test.acceptance.pages.studio.utils
import
set_input_value
from
common.test.acceptance.pages.common.utils
import
click_css
class
SignupPage
(
PageObject
):
class
SignupPage
(
PageObject
):
...
@@ -10,4 +16,15 @@ class SignupPage(PageObject):
...
@@ -10,4 +16,15 @@ class SignupPage(PageObject):
url
=
BASE_URL
+
"/signup"
url
=
BASE_URL
+
"/signup"
def
is_browser_on_page
(
self
):
def
is_browser_on_page
(
self
):
return
self
.
q
(
css
=
'body.view-signup'
)
.
present
return
self
.
q
(
css
=
'body.view-signup'
)
.
visible
def
sign_up_user
(
self
,
registration_dictionary
):
"""
Register the user.
"""
for
css
,
value
in
registration_dictionary
.
iteritems
():
set_input_value
(
self
,
css
,
value
)
click_css
(
page
=
self
,
css
=
'#tos'
,
require_notification
=
False
)
click_css
(
page
=
self
,
css
=
'#submit'
,
require_notification
=
False
)
self
.
wait_for_element_absence
(
'#submit'
,
'Submit button is gone.'
)
common/test/acceptance/tests/studio/test_studio_general.py
View file @
64838f56
"""
"""
Acceptance tests for Studio.
Acceptance tests for Studio.
"""
"""
import
uuid
from
bok_choy.web_app_test
import
WebAppTest
from
bok_choy.web_app_test
import
WebAppTest
from
...pages.studio.asset_index
import
AssetIndexPage
from
...pages.studio.auto_auth
import
AutoAuthPage
from
...pages.studio.course_info
import
CourseUpdatesPage
from
...pages.studio.edit_tabs
import
PagesPage
from
...pages.studio.import_export
import
ExportCoursePage
,
ImportCoursePage
from
...pages.studio.howitworks
import
HowitworksPage
from
...pages.studio.index
import
DashboardPage
from
...pages.studio.login
import
LoginPage
from
...pages.studio.users
import
CourseTeamPage
from
...pages.studio.overview
import
CourseOutlinePage
from
...pages.studio.settings
import
SettingsPage
from
...pages.studio.settings_advanced
import
AdvancedSettingsPage
from
...pages.studio.settings_graders
import
GradingPage
from
...pages.studio.signup
import
SignupPage
from
...pages.studio.textbook_upload
import
TextbookUploadPage
from
...fixtures.course
import
XBlockFixtureDesc
from
base_studio_test
import
StudioCourseTest
from
base_studio_test
import
StudioCourseTest
from
common.test.acceptance.fixtures.course
import
CourseFixture
,
XBlockFixtureDesc
from
common.test.acceptance.pages.studio.auto_auth
import
AutoAuthPage
from
common.test.acceptance.pages.studio.course_info
import
CourseUpdatesPage
from
common.test.acceptance.pages.studio.edit_tabs
import
PagesPage
from
common.test.acceptance.pages.studio.import_export
import
ExportCoursePage
,
ImportCoursePage
from
common.test.acceptance.pages.studio.index
import
DashboardPage
,
HomePage
,
IndexPage
from
common.test.acceptance.pages.studio.login
import
LoginPage
,
CourseOutlineSignInRedirectPage
from
common.test.acceptance.pages.studio.overview
import
CourseOutlinePage
from
common.test.acceptance.pages.studio.asset_index
import
AssetIndexPage
from
common.test.acceptance.pages.studio.settings
import
SettingsPage
from
common.test.acceptance.pages.studio.settings_advanced
import
AdvancedSettingsPage
from
common.test.acceptance.pages.studio.settings_graders
import
GradingPage
from
common.test.acceptance.pages.studio.signup
import
SignupPage
from
common.test.acceptance.pages.studio.textbook_upload
import
TextbookUploadPage
from
common.test.acceptance.pages.studio.users
import
CourseTeamPage
from
common.test.acceptance.tests.helpers
import
UniqueCourseTest
class
LoggedOutTest
(
WebAppTest
):
class
LoggedOutTest
(
WebAppTest
):
"""
"""
Smoke test for pages in Studio that are visible when logged out.
Smoke test for pages in Studio that are visible when logged out.
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
super
(
LoggedOutTest
,
self
)
.
setUp
()
super
(
LoggedOutTest
,
self
)
.
setUp
()
self
.
pages
=
[
LoginPage
(
self
.
browser
),
Howitworks
Page
(
self
.
browser
),
SignupPage
(
self
.
browser
)]
self
.
pages
=
[
LoginPage
(
self
.
browser
),
Index
Page
(
self
.
browser
),
SignupPage
(
self
.
browser
)]
def
test_page_existence
(
self
):
def
test_page_existence
(
self
):
"""
"""
...
@@ -45,21 +44,171 @@ class LoggedOutTest(WebAppTest):
...
@@ -45,21 +44,171 @@ class LoggedOutTest(WebAppTest):
class
LoggedInPagesTest
(
WebAppTest
):
class
LoggedInPagesTest
(
WebAppTest
):
"""
"""
Tests that verify the pages in Studio that you can get to when logged
Verify the pages in Studio that you can get to when logged in and do not have a course yet.
in and do not have a course yet.
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
super
(
LoggedInPagesTest
,
self
)
.
setUp
()
super
(
LoggedInPagesTest
,
self
)
.
setUp
()
self
.
auth_page
=
AutoAuthPage
(
self
.
browser
,
staff
=
True
)
self
.
auth_page
=
AutoAuthPage
(
self
.
browser
,
staff
=
True
)
self
.
dashboard_page
=
DashboardPage
(
self
.
browser
)
self
.
dashboard_page
=
DashboardPage
(
self
.
browser
)
self
.
home_page
=
HomePage
(
self
.
browser
)
def
test_
dashboard
_no_courses
(
self
):
def
test_
logged_in
_no_courses
(
self
):
"""
"""
Make sure that you can get to the dashboard
page
without a course.
Make sure that you can get to the dashboard
and home pages
without a course.
"""
"""
self
.
auth_page
.
visit
()
self
.
auth_page
.
visit
()
self
.
dashboard_page
.
visit
()
self
.
dashboard_page
.
visit
()
self
.
home_page
.
visit
()
class
SignUpAndSignInTest
(
UniqueCourseTest
):
"""
Test studio sign-up and sign-in
"""
def
setUp
(
self
):
# pylint: disable=arguments-differ
super
(
SignUpAndSignInTest
,
self
)
.
setUp
()
self
.
sign_up_page
=
SignupPage
(
self
.
browser
)
self
.
login_page
=
LoginPage
(
self
.
browser
)
self
.
course_outline_page
=
CourseOutlinePage
(
self
.
browser
,
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
]
)
self
.
course_outline_sign_in_redirect_page
=
CourseOutlineSignInRedirectPage
(
self
.
browser
,
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
]
)
self
.
course_fixture
=
CourseFixture
(
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
],
self
.
course_info
[
'display_name'
],
)
self
.
user
=
None
def
install_course_fixture
(
self
):
"""
Install a course fixture
"""
self
.
course_fixture
.
install
()
self
.
user
=
self
.
course_fixture
.
user
def
test_sign_up_from_home
(
self
):
"""
Scenario: Sign up from the homepage
Given I visit the Studio homepage
When I click the link with the text "Sign Up"
And I fill in the registration form
And I press the Create My Account button on the registration form
Then I should see an email verification prompt
"""
index_page
=
IndexPage
(
self
.
browser
)
index_page
.
visit
()
index_page
.
click_sign_up
()
unique_number
=
uuid
.
uuid4
()
.
hex
[:
4
]
registration_dic
=
{
'#email'
:
'{}-email@host.com'
.
format
(
unique_number
),
'#name'
:
'{}-name'
.
format
(
unique_number
),
'#username'
:
'{}-username'
.
format
(
unique_number
),
'#password'
:
'{}-password'
.
format
(
unique_number
),
}
# Register the user.
self
.
sign_up_page
.
sign_up_user
(
registration_dic
)
home
=
HomePage
(
self
.
browser
)
home
.
wait_for_page
()
def
test_login_with_valid_redirect
(
self
):
"""
Scenario: Login with a valid redirect
Given I have opened a new course in Studio
And I am not logged in
And I visit the url "/course/slashes:MITx+999+Robot_Super_Course"
And I should see that the path is "/signin?next=/course/slashes
%3
AMITx
%2
B999
%2
BRobot_Super_Course"
When I fill in and submit the signin form
Then I should see that the path is "/course/slashes:MITx+999+Robot_Super_Course"
"""
self
.
install_course_fixture
()
# Get the url, browser should land here after sign in.
course_url
=
self
.
course_outline_sign_in_redirect_page
.
url
self
.
course_outline_sign_in_redirect_page
.
visit
()
# Login
self
.
course_outline_sign_in_redirect_page
.
login
(
self
.
user
[
'email'
],
self
.
user
[
'password'
])
self
.
course_outline_page
.
wait_for_page
()
# Verify that correct course is displayed after sign in.
self
.
assertEqual
(
self
.
browser
.
current_url
,
course_url
)
def
test_login_with_invalid_redirect
(
self
):
"""
Scenario: Login with an invalid redirect
Given I have opened a new course in Studio
And I am not logged in
And I visit the url "/signin?next=http://www.google.com/"
When I fill in and submit the signin form
Then I should see that the path is "/home/"
"""
self
.
install_course_fixture
()
# Visit course
self
.
course_outline_sign_in_redirect_page
.
visit
()
# Change redirect url
self
.
browser
.
get
(
self
.
browser
.
current_url
.
split
(
'='
)[
0
]
+
'=http://www.google.com'
)
# Login
self
.
course_outline_sign_in_redirect_page
.
login
(
self
.
user
[
'email'
],
self
.
user
[
'password'
])
home
=
HomePage
(
self
.
browser
)
home
.
wait_for_page
()
self
.
assertEqual
(
self
.
browser
.
current_url
,
home
.
url
)
def
test_login_with_mistyped_credentials
(
self
):
"""
Given I have opened a new course in Studio
And I am not logged in
And I visit the Studio homepage
When I click the link with the text "Sign In"
Then I should see that the path is "/signin"
And I should not see a login error message
And I fill in and submit the signin form incorrectly
Then I should see a login error message
And I edit the password field
Then I should not see a login error message
And I submit the signin form
And I wait for "2" seconds
Then I should see that the path is "/course/slashes:MITx+999+Robot_Super_Course"
"""
self
.
install_course_fixture
()
self
.
course_outline_sign_in_redirect_page
.
visit
()
# Verify login_error is not present
self
.
course_outline_sign_in_redirect_page
.
wait_for_element_absence
(
'#login_error'
,
'Login error not be present'
)
# Login with wrong credentials
self
.
course_outline_sign_in_redirect_page
.
login
(
self
.
user
[
'email'
],
'wrong_password'
,
expect_success
=
False
)
# Verify that login error is shown
self
.
course_outline_sign_in_redirect_page
.
wait_for_element_visibility
(
'#login_error'
,
'Login error is visible'
)
# Change the password
self
.
course_outline_sign_in_redirect_page
.
fill_field
(
'input#password'
,
'changed_password'
)
# Login error should not be visible
self
.
course_outline_sign_in_redirect_page
.
wait_for_element_invisibility
(
'#login_error'
,
'Login error is not visible'
)
# Login with correct credentials
self
.
course_outline_sign_in_redirect_page
.
login
(
self
.
user
[
'email'
],
self
.
user
[
'password'
])
self
.
course_outline_page
.
wait_for_page
()
# Verify that correct course is displayed after sign in.
self
.
assertEqual
(
self
.
browser
.
current_url
,
self
.
course_outline_page
.
url
)
class
CoursePagesTest
(
StudioCourseTest
):
class
CoursePagesTest
(
StudioCourseTest
):
...
...
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