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
2da3cdb4
Commit
2da3cdb4
authored
Apr 24, 2018
by
christopher lee
Committed by
Christopher Lee
Apr 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fix for
https://openedx.atlassian.net/browse/LEARNER-4765
"
This reverts commit
9bef03f1
.
parent
9feab946
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
29 deletions
+25
-29
e2e/test_payment.py
+25
-29
No files found.
e2e/test_payment.py
View file @
2da3cdb4
...
@@ -8,9 +8,8 @@ from selenium.webdriver.support.select import Select
...
@@ -8,9 +8,8 @@ from selenium.webdriver.support.select import Select
from
selenium.webdriver.support.wait
import
WebDriverWait
from
selenium.webdriver.support.wait
import
WebDriverWait
from
e2e.api
import
DiscoveryApi
,
EcommerceApi
,
EnrollmentApi
from
e2e.api
import
DiscoveryApi
,
EcommerceApi
,
EnrollmentApi
from
e2e.config
import
LMS_USERNAME
from
e2e.config
import
LMS_USERNAME
,
PAYPAL_EMAIL
,
PAYPAL_PASSWORD
from
e2e.constants
import
ADDRESS_FR
,
ADDRESS_US
from
e2e.helpers
import
EcommerceHelpers
from
e2e.helpers
import
EcommerceHelpers
,
LmsHelpers
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -61,6 +60,28 @@ class TestSeatPayment(object):
...
@@ -61,6 +60,28 @@ class TestSeatPayment(object):
# Click the payment button
# Click the payment button
selenium
.
find_element_by_id
(
'payment-button'
)
.
click
()
selenium
.
find_element_by_id
(
'payment-button'
)
.
click
()
def
checkout_with_paypal
(
self
,
selenium
):
selenium
.
find_element_by_css_selector
(
'button.payment-button[data-processor-name=paypal]'
)
.
click
()
# Wait for login form to load. PayPal's test environment is slow.
login_iframe
=
selenium
.
find_element_by_css_selector
(
'#injectedUnifiedLogin > iframe'
)
selenium
.
switch_to
.
frame
(
login_iframe
)
# Log into PayPal
email
=
selenium
.
find_element_by_id
(
'email'
)
password
=
selenium
.
find_element_by_id
(
'password'
)
email
.
send_keys
(
PAYPAL_EMAIL
)
password
.
send_keys
(
PAYPAL_PASSWORD
)
selenium
.
find_element_by_id
(
'btnLogin'
)
.
click
()
selenium
.
switch_to
.
default_content
()
# Wait for the checkout form to load, and for the loading spinner to disappear.
wait
=
WebDriverWait
(
selenium
,
10
)
spinner_invisibility
=
EC
.
invisibility_of_element_located
((
By
.
ID
,
'spinner'
))
wait
.
until
(
spinner_invisibility
)
selenium
.
find_element_by_id
(
'confirmButtonTop'
)
.
click
()
def
assert_browser_on_receipt_page
(
self
,
selenium
):
def
assert_browser_on_receipt_page
(
self
,
selenium
):
selenium
.
find_element_by_id
(
'receipt-container'
)
selenium
.
find_element_by_id
(
'receipt-container'
)
...
@@ -98,11 +119,7 @@ class TestSeatPayment(object):
...
@@ -98,11 +119,7 @@ class TestSeatPayment(object):
def
add_item_to_basket
(
self
,
selenium
,
sku
):
def
add_item_to_basket
(
self
,
selenium
,
sku
):
# Add the item to the basket and start the checkout process
# Add the item to the basket and start the checkout process
selenium
.
get
(
EcommerceHelpers
.
build_url
(
'/basket/add/?sku='
+
sku
))
selenium
.
get
(
EcommerceHelpers
.
build_url
(
'/basket/add/?sku='
+
sku
))
assert
selenium
.
find_element_by_css_selector
(
'.basket-client-side'
)
.
is_displayed
()
# Wait till the selector is visible
WebDriverWait
(
selenium
,
20
)
.
until
(
EC
.
visibility_of_element_located
((
By
.
CSS_SELECTOR
,
".basket-client-side"
))
)
def
refund_orders_for_course_run
(
self
,
course_run_id
):
def
refund_orders_for_course_run
(
self
,
course_run_id
):
api
=
EcommerceApi
()
api
=
EcommerceApi
()
...
@@ -111,7 +128,6 @@ class TestSeatPayment(object):
...
@@ -111,7 +128,6 @@ class TestSeatPayment(object):
for
refund_id
in
refund_ids
:
for
refund_id
in
refund_ids
:
api
.
process_refund
(
refund_id
,
'approve'
)
api
.
process_refund
(
refund_id
,
'approve'
)
return
True
def
get_verified_seat
(
self
,
course_run
):
def
get_verified_seat
(
self
,
course_run
):
verified_seat
=
None
verified_seat
=
None
...
@@ -120,23 +136,3 @@ class TestSeatPayment(object):
...
@@ -120,23 +136,3 @@ class TestSeatPayment(object):
verified_seat
=
seat
verified_seat
=
seat
break
break
return
verified_seat
return
verified_seat
def
test_verified_seat_payment_with_credit_card
(
self
,
selenium
):
"""
Validates users can add a verified seat to the cart and checkout with a credit card.
This test requires 'disable_repeat_order_check' waffle switch active, to run.
"""
LmsHelpers
.
login
(
selenium
)
# Get the course run we want to purchase
course_run
=
self
.
get_verified_course_run
()
verified_seat
=
self
.
get_verified_seat
(
course_run
)
for
address
in
(
ADDRESS_US
,
ADDRESS_FR
,):
self
.
add_item_to_basket
(
selenium
,
verified_seat
[
'sku'
])
self
.
checkout_with_credit_card
(
selenium
,
address
)
self
.
assert_browser_on_receipt_page
(
selenium
)
course_run_key
=
course_run
[
'key'
]
self
.
assert_user_enrolled_in_course_run
(
LMS_USERNAME
,
course_run_key
)
assert
self
.
refund_orders_for_course_run
(
course_run_key
)
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