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
e2c65c57
Commit
e2c65c57
authored
May 16, 2016
by
Douglas Hall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Studio settings image upload acceptance tests
parent
06fa0839
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
1 deletions
+64
-1
common/test/acceptance/pages/studio/settings.py
+17
-1
common/test/acceptance/tests/studio/test_studio_settings.py
+47
-0
No files found.
common/test/acceptance/pages/studio/settings.py
View file @
e2c65c57
...
@@ -8,6 +8,7 @@ from bok_choy.promise import EmptyPromise
...
@@ -8,6 +8,7 @@ from bok_choy.promise import EmptyPromise
from
bok_choy.javascript
import
requirejs
from
bok_choy.javascript
import
requirejs
from
.course_page
import
CoursePage
from
.course_page
import
CoursePage
from
.users
import
wait_for_ajax_or_reload
from
.utils
import
press_the_notification_button
from
.utils
import
press_the_notification_button
...
@@ -26,6 +27,7 @@ class SettingsPage(CoursePage):
...
@@ -26,6 +27,7 @@ class SettingsPage(CoursePage):
# Helpers
# Helpers
################
################
def
is_browser_on_page
(
self
):
def
is_browser_on_page
(
self
):
wait_for_ajax_or_reload
(
self
.
browser
)
return
self
.
q
(
css
=
'body.view-settings'
)
.
visible
return
self
.
q
(
css
=
'body.view-settings'
)
.
visible
def
wait_for_require_js
(
self
):
def
wait_for_require_js
(
self
):
...
@@ -35,6 +37,20 @@ class SettingsPage(CoursePage):
...
@@ -35,6 +37,20 @@ class SettingsPage(CoursePage):
if
hasattr
(
self
,
'wait_for_js'
):
if
hasattr
(
self
,
'wait_for_js'
):
self
.
wait_for_js
()
# pylint: disable=no-member
self
.
wait_for_js
()
# pylint: disable=no-member
def
wait_for_jquery_value
(
self
,
jquery_element
,
value
):
"""
Use jQuery to obtain the element's value.
This is useful for when jQuery performs functions towards the
end of the page load. (In other words, waiting for jquery to
load is not enough; we need to also query values that it has
injected onto the page to ensure it's done.)
"""
self
.
wait_for
(
lambda
:
self
.
browser
.
execute_script
(
"return $('{ele}').val();"
.
format
(
ele
=
jquery_element
))
==
'{val}'
.
format
(
val
=
value
),
'wait for jQuery to finish loading data on page.'
)
def
refresh_and_wait_for_load
(
self
):
def
refresh_and_wait_for_load
(
self
):
"""
"""
Refresh the page and wait for all resources to load.
Refresh the page and wait for all resources to load.
...
@@ -267,7 +283,7 @@ class SettingsPage(CoursePage):
...
@@ -267,7 +283,7 @@ class SettingsPage(CoursePage):
"""
"""
# wait for upload button
# wait for upload button
self
.
wait_for_element_
presence
(
upload_btn_selector
,
'upload button is present'
)
self
.
wait_for_element_
visibility
(
upload_btn_selector
,
'upload button is present'
)
self
.
q
(
css
=
upload_btn_selector
)
.
results
[
0
]
.
click
()
self
.
q
(
css
=
upload_btn_selector
)
.
results
[
0
]
.
click
()
...
...
common/test/acceptance/tests/studio/test_studio_settings.py
View file @
e2c65c57
...
@@ -510,6 +510,15 @@ class StudioSettingsA11yTest(StudioCourseTest):
...
@@ -510,6 +510,15 @@ class StudioSettingsA11yTest(StudioCourseTest):
],
],
})
})
# TODO: Figure out how to get CodeMirror to pass accessibility testing
# We use the CodeMirror Javascript library to
# add code editing to a number of textarea elements
# on this page. CodeMirror generates markup that does
# not pass our accessibility testing rules.
self
.
settings_page
.
a11y_audit
.
config
.
set_scope
(
exclude
=
[
'.CodeMirror textarea'
]
)
self
.
settings_page
.
a11y_audit
.
check_for_accessibility_errors
()
self
.
settings_page
.
a11y_audit
.
check_for_accessibility_errors
()
...
@@ -571,3 +580,41 @@ class StudioSubsectionSettingsA11yTest(StudioCourseTest):
...
@@ -571,3 +580,41 @@ class StudioSubsectionSettingsA11yTest(StudioCourseTest):
include
=
[
'section.edit-settings-timed-examination'
]
include
=
[
'section.edit-settings-timed-examination'
]
)
)
self
.
course_outline
.
a11y_audit
.
check_for_accessibility_errors
()
self
.
course_outline
.
a11y_audit
.
check_for_accessibility_errors
()
class
StudioSettingsImageUploadTest
(
StudioCourseTest
):
"""
Class to test course settings image uploads.
"""
def
setUp
(
self
):
# pylint: disable=arguments-differ
super
(
StudioSettingsImageUploadTest
,
self
)
.
setUp
()
self
.
settings_page
=
SettingsPage
(
self
.
browser
,
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
])
# from nose.tools import set_trace; set_trace()
self
.
settings_page
.
visit
()
# Ensure jquery is loaded before running a jQuery
self
.
settings_page
.
wait_for_ajax
()
# This text appears towards the end of the work that jQuery is performing on the page
self
.
settings_page
.
wait_for_jquery_value
(
'input#course-name:text'
,
'test_run'
)
def
test_upload_course_card_image
(
self
):
# upload image
file_to_upload
=
'image.jpg'
self
.
settings_page
.
upload_image
(
'#upload-course-image'
,
file_to_upload
)
self
.
assertIn
(
file_to_upload
,
self
.
settings_page
.
get_uploaded_image_path
(
'#course-image'
))
def
test_upload_course_banner_image
(
self
):
# upload image
file_to_upload
=
'image.jpg'
self
.
settings_page
.
upload_image
(
'#upload-banner-image'
,
file_to_upload
)
self
.
assertIn
(
file_to_upload
,
self
.
settings_page
.
get_uploaded_image_path
(
'#banner-image'
))
def
test_upload_course_video_thumbnail_image
(
self
):
# upload image
file_to_upload
=
'image.jpg'
self
.
settings_page
.
upload_image
(
'#upload-video-thumbnail-image'
,
file_to_upload
)
self
.
assertIn
(
file_to_upload
,
self
.
settings_page
.
get_uploaded_image_path
(
'#video-thumbnail-image'
))
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