Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
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
ecommerce
Commits
8184d2b3
Commit
8184d2b3
authored
Jun 15, 2016
by
Clinton Blackburn
Committed by
GitHub
Jun 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed incorrect login redirect URL view name (#801)
ECOM-4714
parent
2dd77b1b
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
76 additions
and
30 deletions
+76
-30
acceptance_tests/mixins.py
+26
-5
acceptance_tests/pages/__init__.py
+5
-5
acceptance_tests/pages/ecommerce.py
+20
-3
acceptance_tests/pages/lms.py
+3
-4
acceptance_tests/test_auth.py
+11
-4
acceptance_tests/test_coupon_admin.py
+1
-1
acceptance_tests/test_coupon_checkout.py
+4
-4
acceptance_tests/test_payment.py
+3
-2
acceptance_tests/test_profed_enrollment.py
+2
-1
ecommerce/settings/base.py
+1
-1
No files found.
acceptance_tests/mixins.py
View file @
8184d2b3
...
@@ -27,7 +27,9 @@ from acceptance_tests.config import (
...
@@ -27,7 +27,9 @@ from acceptance_tests.config import (
LMS_HTTPS
LMS_HTTPS
)
)
from
acceptance_tests.expected_conditions
import
input_provided
from
acceptance_tests.expected_conditions
import
input_provided
from
acceptance_tests.pages
import
LMSLoginPage
,
LMSDashboardPage
,
LMSRegistrationPage
,
LMSLogoutPage
from
acceptance_tests.pages
import
submit_lms_login_form
from
acceptance_tests.pages.ecommerce
import
EcommerceLoginPage
from
acceptance_tests.pages.lms
import
LMSLoginPage
,
LMSDashboardPage
,
LMSRegistrationPage
,
LMSLogoutPage
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -72,9 +74,6 @@ class LogistrationMixin(LmsUserMixin):
...
@@ -72,9 +74,6 @@ class LogistrationMixin(LmsUserMixin):
self
.
lms_login_page
=
LMSLoginPage
(
self
.
browser
)
self
.
lms_login_page
=
LMSLoginPage
(
self
.
browser
)
self
.
lms_registration_page
=
LMSRegistrationPage
(
self
.
browser
)
self
.
lms_registration_page
=
LMSRegistrationPage
(
self
.
browser
)
def
login
(
self
):
self
.
login_with_lms
()
def
login_with_lms
(
self
,
email
=
None
,
password
=
None
,
course_id
=
None
):
def
login_with_lms
(
self
,
email
=
None
,
password
=
None
,
course_id
=
None
):
""" Visit LMS and login. """
""" Visit LMS and login. """
email
=
email
or
LMS_EMAIL
email
=
email
or
LMS_EMAIL
...
@@ -106,7 +105,29 @@ class LMSLogoutMixin(object):
...
@@ -106,7 +105,29 @@ class LMSLogoutMixin(object):
self
.
lms_logout_page
.
visit
()
self
.
lms_logout_page
.
visit
()
class
LogoutMixin
(
object
):
def
login_with_lms
(
self
,
email
=
None
,
password
=
None
,
course_id
=
None
):
""" Visit LMS and login. """
email
=
email
or
LMS_EMAIL
password
=
password
or
LMS_PASSWORD
# Note: We use Selenium directly here (as opposed to bok-choy) to avoid issues with promises being broken.
self
.
lms_login_page
.
browser
.
get
(
self
.
lms_login_page
.
url
(
course_id
))
# pylint: disable=not-callable
self
.
lms_login_page
.
login
(
email
,
password
)
class
OttoAuthenticationMixin
(
object
):
def
setUp
(
self
):
super
(
OttoAuthenticationMixin
,
self
)
.
setUp
()
self
.
otto_login_page
=
EcommerceLoginPage
(
self
.
browser
)
def
login_via_otto
(
self
,
email
=
None
,
password
=
None
):
""" Start the login process via Otto's login page (which should redirect to LMS.) """
email
=
email
or
LMS_EMAIL
password
=
password
or
LMS_PASSWORD
self
.
otto_login_page
.
visit
()
submit_lms_login_form
(
self
.
otto_login_page
,
email
,
password
)
def
logout_via_otto
(
self
):
def
logout_via_otto
(
self
):
url
=
'{}/logout/'
.
format
(
ECOMMERCE_URL_ROOT
)
url
=
'{}/logout/'
.
format
(
ECOMMERCE_URL_ROOT
)
self
.
browser
.
get
(
url
)
self
.
browser
.
get
(
url
)
...
...
acceptance_tests/pages/__init__.py
View file @
8184d2b3
# pylint: disable=wildcard-import
def
submit_lms_login_form
(
page
,
email
,
password
):
from
acceptance_tests.pages.coupons
import
*
""" Fill out and submit the LMS login form. """
from
acceptance_tests.pages.ecommerce
import
*
page
.
q
(
css
=
'input#login-email'
)
.
fill
(
email
)
from
acceptance_tests.pages.lms
import
*
page
.
q
(
css
=
'input#login-password'
)
.
fill
(
password
)
from
acceptance_tests.pages.marketing
import
*
page
.
q
(
css
=
'button.login-button'
)
.
click
()
acceptance_tests/pages/ecommerce.py
View file @
8184d2b3
from
bok_choy.page_object
import
PageObject
from
bok_choy.page_object
import
PageObject
from
acceptance_tests.config
import
ECOMMERCE_URL_ROOT
from
acceptance_tests.config
import
ECOMMERCE_URL_ROOT
from
acceptance_tests.pages.lms
import
LMSLoginPage
class
EcommerceAppPage
(
PageObject
):
# pylint: disable=abstract-method
class
EcommerceAppPage
(
PageObject
):
# pylint: disable=abstract-method
path
=
None
path
=
None
server_url
=
ECOMMERCE_URL_ROOT
@classmethod
def
build_ecommerce_url
(
cls
,
path
):
return
'{}/{}'
.
format
(
cls
.
server_url
,
path
)
@property
@property
def
url
(
self
):
def
url
(
self
):
...
@@ -13,12 +19,23 @@ class EcommerceAppPage(PageObject): # pylint: disable=abstract-method
...
@@ -13,12 +19,23 @@ class EcommerceAppPage(PageObject): # pylint: disable=abstract-method
def
__init__
(
self
,
browser
,
path
=
None
):
def
__init__
(
self
,
browser
,
path
=
None
):
super
(
EcommerceAppPage
,
self
)
.
__init__
(
browser
)
super
(
EcommerceAppPage
,
self
)
.
__init__
(
browser
)
path
=
path
or
self
.
path
path
=
path
or
self
.
path
self
.
server_url
=
ECOMMERCE_URL_ROOT
self
.
page_url
=
self
.
build_ecommerce_url
(
path
)
self
.
page_url
=
'{}/{}'
.
format
(
self
.
server_url
,
path
)
class
DashboardHomePage
(
EcommerceAppPage
):
class
Ecommerce
DashboardHomePage
(
EcommerceAppPage
):
path
=
'dashboard'
path
=
'dashboard'
def
is_browser_on_page
(
self
):
def
is_browser_on_page
(
self
):
return
self
.
browser
.
title
.
startswith
(
'Dashboard | Oscar'
)
return
self
.
browser
.
title
.
startswith
(
'Dashboard | Oscar'
)
class
EcommerceLoginPage
(
LMSLoginPage
):
""" Otto login page.
Although the URL is an Otto URL, this page actually redirects to the LMS login page, hence our inheriting
that page and it's properties.
"""
@property
def
url
(
self
):
# pylint: disable=arguments-differ
return
EcommerceAppPage
.
build_ecommerce_url
(
'login'
)
acceptance_tests/pages/lms.py
View file @
8184d2b3
...
@@ -7,6 +7,7 @@ from selenium.common.exceptions import NoSuchElementException
...
@@ -7,6 +7,7 @@ from selenium.common.exceptions import NoSuchElementException
from
selenium.webdriver.support.select
import
Select
from
selenium.webdriver.support.select
import
Select
from
acceptance_tests.config
import
LMS_URL_ROOT
,
BASIC_AUTH_USERNAME
,
BASIC_AUTH_PASSWORD
,
MARKETING_URL_ROOT
from
acceptance_tests.config
import
LMS_URL_ROOT
,
BASIC_AUTH_USERNAME
,
BASIC_AUTH_PASSWORD
,
MARKETING_URL_ROOT
from
acceptance_tests.pages
import
submit_lms_login_form
class
LMSPage
(
PageObject
):
# pylint: disable=abstract-method
class
LMSPage
(
PageObject
):
# pylint: disable=abstract-method
...
@@ -37,10 +38,8 @@ class LMSLoginPage(LMSPage):
...
@@ -37,10 +38,8 @@ class LMSLoginPage(LMSPage):
def
is_browser_on_page
(
self
):
def
is_browser_on_page
(
self
):
return
self
.
q
(
css
=
'form#login'
)
.
visible
return
self
.
q
(
css
=
'form#login'
)
.
visible
def
login
(
self
,
username
,
password
):
def
login
(
self
,
email
,
password
):
self
.
q
(
css
=
'input#login-email'
)
.
fill
(
username
)
submit_lms_login_form
(
self
,
email
,
password
)
self
.
q
(
css
=
'input#login-password'
)
.
fill
(
password
)
self
.
q
(
css
=
'button.login-button'
)
.
click
()
# Wait for LMS to redirect to the dashboard
# Wait for LMS to redirect to the dashboard
EmptyPromise
(
self
.
_is_browser_on_lms_dashboard
,
"LMS login redirected to dashboard"
)
.
fulfill
()
EmptyPromise
(
self
.
_is_browser_on_lms_dashboard
,
"LMS login redirected to dashboard"
)
.
fulfill
()
...
...
acceptance_tests/test_auth.py
View file @
8184d2b3
from
unittest
import
skipUnless
from
unittest
import
skipUnless
from
bok_choy.promise
import
EmptyPromise
from
bok_choy.web_app_test
import
WebAppTest
from
bok_choy.web_app_test
import
WebAppTest
from
acceptance_tests.config
import
ENABLE_SSO_TESTS
,
MARKETING_URL_ROOT
,
LMS_URL_ROOT
from
acceptance_tests.config
import
ENABLE_SSO_TESTS
,
MARKETING_URL_ROOT
,
LMS_URL_ROOT
from
acceptance_tests.mixins
import
LogistrationMixin
,
Logout
Mixin
,
LMSLogoutMixin
from
acceptance_tests.mixins
import
LogistrationMixin
,
OttoAuthentication
Mixin
,
LMSLogoutMixin
from
acceptance_tests.pages
import
DashboardHomePage
from
acceptance_tests.pages
.ecommerce
import
Ecommerce
DashboardHomePage
@skipUnless
(
ENABLE_SSO_TESTS
,
'Single sign-on tests are not enabled.'
)
@skipUnless
(
ENABLE_SSO_TESTS
,
'Single sign-on tests are not enabled.'
)
class
SingleSignOnTests
(
LogistrationMixin
,
Logout
Mixin
,
LMSLogoutMixin
,
WebAppTest
):
class
SingleSignOnTests
(
LogistrationMixin
,
OttoAuthentication
Mixin
,
LMSLogoutMixin
,
WebAppTest
):
def
setUp
(
self
):
def
setUp
(
self
):
""" Instantiate the page objects. """
""" Instantiate the page objects. """
super
(
SingleSignOnTests
,
self
)
.
setUp
()
super
(
SingleSignOnTests
,
self
)
.
setUp
()
self
.
otto_dashboard_page
=
DashboardHomePage
(
self
.
browser
)
self
.
otto_dashboard_page
=
Ecommerce
DashboardHomePage
(
self
.
browser
)
def
test_login_and_logout
(
self
):
def
test_login_and_logout
(
self
):
"""
"""
...
@@ -42,3 +43,9 @@ class SingleSignOnTests(LogistrationMixin, LogoutMixin, LMSLogoutMixin, WebAppTe
...
@@ -42,3 +43,9 @@ class SingleSignOnTests(LogistrationMixin, LogoutMixin, LMSLogoutMixin, WebAppTe
# to avoid this issue.
# to avoid this issue.
self
.
browser
.
get
(
self
.
otto_dashboard_page
.
url
)
self
.
browser
.
get
(
self
.
otto_dashboard_page
.
url
)
self
.
assertTrue
(
self
.
lms_login_page
.
is_browser_on_page
())
self
.
assertTrue
(
self
.
lms_login_page
.
is_browser_on_page
())
def
test_login_redirection
(
self
):
""" Verify the user is redirected to the Otto dashboard after logging in. """
self
.
login_via_otto
()
promise_description
=
"Ensure redirect to Otto dashboard after login."
EmptyPromise
(
self
.
otto_dashboard_page
.
is_browser_on_page
,
promise_description
)
.
fulfill
()
acceptance_tests/test_coupon_admin.py
View file @
8184d2b3
...
@@ -6,7 +6,7 @@ from bok_choy.web_app_test import WebAppTest
...
@@ -6,7 +6,7 @@ from bok_choy.web_app_test import WebAppTest
from
acceptance_tests.config
import
ENABLE_COUPON_ADMIN_TESTS
from
acceptance_tests.config
import
ENABLE_COUPON_ADMIN_TESTS
from
acceptance_tests.constants
import
DEFAULT_END_DATE
,
DEFAULT_START_DATE
from
acceptance_tests.constants
import
DEFAULT_END_DATE
,
DEFAULT_START_DATE
from
acceptance_tests.mixins
import
CouponMixin
,
LogistrationMixin
from
acceptance_tests.mixins
import
CouponMixin
,
LogistrationMixin
from
acceptance_tests.pages
import
CouponsCreatePage
,
CouponsDetailsPage
,
CouponsListPage
from
acceptance_tests.pages
.coupons
import
CouponsCreatePage
,
CouponsDetailsPage
,
CouponsListPage
@skipUnless
(
ENABLE_COUPON_ADMIN_TESTS
,
'Coupon admin tests are disabled.'
)
@skipUnless
(
ENABLE_COUPON_ADMIN_TESTS
,
'Coupon admin tests are disabled.'
)
...
...
acceptance_tests/test_coupon_checkout.py
View file @
8184d2b3
...
@@ -4,12 +4,12 @@ import ddt
...
@@ -4,12 +4,12 @@ import ddt
from
bok_choy.web_app_test
import
WebAppTest
from
bok_choy.web_app_test
import
WebAppTest
from
acceptance_tests.config
import
VERIFIED_COURSE_ID
,
ENABLE_CYBERSOURCE_TESTS
from
acceptance_tests.config
import
VERIFIED_COURSE_ID
,
ENABLE_CYBERSOURCE_TESTS
from
acceptance_tests.constants
import
CYBERSOURCE_DATA1
,
CYBERSOURCE_DATA2
from
acceptance_tests.mixins
import
(
CouponMixin
,
EcommerceApiMixin
,
EnrollmentApiMixin
,
from
acceptance_tests.mixins
import
(
CouponMixin
,
EcommerceApiMixin
,
EnrollmentApiMixin
,
LogistrationMixin
,
UnenrollmentMixin
,
PaymentMixin
)
LogistrationMixin
,
UnenrollmentMixin
,
PaymentMixin
)
from
acceptance_tests.constants
import
CYBERSOURCE_DATA1
,
CYBERSOURCE_DATA2
from
acceptance_tests.pages
import
(
CouponsCreatePage
,
CouponsDetailsPage
,
CouponsListPage
,
DashboardHomePage
,
RedeemVoucherPage
)
from
acceptance_tests.pages.basket
import
BasketPage
from
acceptance_tests.pages.basket
import
BasketPage
from
acceptance_tests.pages.coupons
import
CouponsCreatePage
,
CouponsDetailsPage
,
CouponsListPage
,
RedeemVoucherPage
from
acceptance_tests.pages.ecommerce
import
EcommerceDashboardHomePage
@ddt.ddt
@ddt.ddt
...
@@ -19,7 +19,7 @@ class CouponCheckoutTests(CouponMixin, UnenrollmentMixin, EcommerceApiMixin, Enr
...
@@ -19,7 +19,7 @@ class CouponCheckoutTests(CouponMixin, UnenrollmentMixin, EcommerceApiMixin, Enr
""" Instantiate the page objects. """
""" Instantiate the page objects. """
super
(
CouponCheckoutTests
,
self
)
.
setUp
()
super
(
CouponCheckoutTests
,
self
)
.
setUp
()
self
.
app_login_page
=
DashboardHomePage
(
self
.
browser
)
self
.
app_login_page
=
Ecommerce
DashboardHomePage
(
self
.
browser
)
self
.
basket_page
=
BasketPage
(
self
.
browser
)
self
.
basket_page
=
BasketPage
(
self
.
browser
)
self
.
coupons_create_edit_page
=
CouponsCreatePage
(
self
.
browser
)
self
.
coupons_create_edit_page
=
CouponsCreatePage
(
self
.
browser
)
self
.
coupons_list_page
=
CouponsListPage
(
self
.
browser
)
self
.
coupons_list_page
=
CouponsListPage
(
self
.
browser
)
...
...
acceptance_tests/test_payment.py
View file @
8184d2b3
from
unittest
import
skipUnless
from
unittest
import
skipUnless
from
bok_choy.web_app_test
import
WebAppTest
import
ddt
import
ddt
from
bok_choy.web_app_test
import
WebAppTest
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.support
import
expected_conditions
as
EC
from
selenium.webdriver.support
import
expected_conditions
as
EC
from
selenium.webdriver.support.ui
import
WebDriverWait
from
selenium.webdriver.support.ui
import
WebDriverWait
...
@@ -11,7 +11,8 @@ from acceptance_tests.config import (VERIFIED_COURSE_ID, MARKETING_URL_ROOT,
...
@@ -11,7 +11,8 @@ from acceptance_tests.config import (VERIFIED_COURSE_ID, MARKETING_URL_ROOT,
from
acceptance_tests.constants
import
CYBERSOURCE_DATA1
,
CYBERSOURCE_DATA2
from
acceptance_tests.constants
import
CYBERSOURCE_DATA1
,
CYBERSOURCE_DATA2
from
acceptance_tests.mixins
import
(
LogistrationMixin
,
EnrollmentApiMixin
,
EcommerceApiMixin
,
from
acceptance_tests.mixins
import
(
LogistrationMixin
,
EnrollmentApiMixin
,
EcommerceApiMixin
,
PaymentMixin
,
UnenrollmentMixin
)
PaymentMixin
,
UnenrollmentMixin
)
from
acceptance_tests.pages
import
LMSCourseModePage
,
MarketingCourseAboutPage
from
acceptance_tests.pages.lms
import
LMSCourseModePage
from
acceptance_tests.pages.marketing
import
MarketingCourseAboutPage
@ddt.ddt
@ddt.ddt
...
...
acceptance_tests/test_profed_enrollment.py
View file @
8184d2b3
...
@@ -7,7 +7,8 @@ from selenium.webdriver.support.ui import WebDriverWait
...
@@ -7,7 +7,8 @@ from selenium.webdriver.support.ui import WebDriverWait
from
acceptance_tests.config
import
PROFESSIONAL_COURSE_ID
,
MARKETING_URL_ROOT
from
acceptance_tests.config
import
PROFESSIONAL_COURSE_ID
,
MARKETING_URL_ROOT
from
acceptance_tests.mixins
import
LogistrationMixin
,
EnrollmentApiMixin
from
acceptance_tests.mixins
import
LogistrationMixin
,
EnrollmentApiMixin
from
acceptance_tests.pages
import
LMSCourseModePage
,
MarketingCourseAboutPage
from
acceptance_tests.pages.lms
import
LMSCourseModePage
from
acceptance_tests.pages.marketing
import
MarketingCourseAboutPage
@skipUnless
(
PROFESSIONAL_COURSE_ID
,
'Professional education tests are not enabled.'
)
@skipUnless
(
PROFESSIONAL_COURSE_ID
,
'Professional education tests are not enabled.'
)
...
...
ecommerce/settings/base.py
View file @
8184d2b3
...
@@ -396,7 +396,7 @@ SOCIAL_AUTH_EDX_OIDC_URL_ROOT = None
...
@@ -396,7 +396,7 @@ SOCIAL_AUTH_EDX_OIDC_URL_ROOT = None
SOCIAL_AUTH_EDX_OIDC_ID_TOKEN_DECRYPTION_KEY
=
SOCIAL_AUTH_EDX_OIDC_SECRET
SOCIAL_AUTH_EDX_OIDC_ID_TOKEN_DECRYPTION_KEY
=
SOCIAL_AUTH_EDX_OIDC_SECRET
# Redirect successfully authenticated users to the Oscar dashboard.
# Redirect successfully authenticated users to the Oscar dashboard.
LOGIN_REDIRECT_URL
=
'dashboard'
LOGIN_REDIRECT_URL
=
'dashboard
:index
'
LOGIN_URL
=
'login'
LOGIN_URL
=
'login'
EXTRA_SCOPE
=
[
'permissions'
]
EXTRA_SCOPE
=
[
'permissions'
]
...
...
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