Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #601 from edx/thallada/course-list-metadata
Browse files Browse the repository at this point in the history
Update courses index to show course list and metadata.
  • Loading branch information
dsjen authored Jan 18, 2017
2 parents 4a200de + 1b6de93 commit d99c7d8
Show file tree
Hide file tree
Showing 111 changed files with 2,961 additions and 866 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:

env:
# Make sure to update this string on every Insights or Data API release
DATA_API_VERSION: "0.17.0-rc.1"
DATA_API_VERSION: "0.20.1-rc.3"
DOCKER_COMPOSE_VERSION: "1.9.0"

before_install:
Expand All @@ -32,6 +32,10 @@ after_success:
- docker exec insights_testing /edx/app/insights/edx_analytics_dashboard/.travis/run_coverage.sh
- codecov

after_failure:
# Print the list of running containers to rule out a killed container as a cause of failure
- docker ps

deploy:
- provider: s3
access_key_id: $S3_ACCESS_KEY_ID
Expand Down
6 changes: 3 additions & 3 deletions .travis/docker-compose-travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "2.1"
services:
es:
image: elasticsearch:1.5.2
analytics_api:
analyticsapi:
image: edxops/analytics_api:${DATA_API_VERSION:-latest}
container_name: analytics_api
environment:
Expand All @@ -23,7 +23,7 @@ services:
TRAVIS_PULL_REQUEST:
DATADOG_API_KEY:
# Rest of the environment variables for testing.
API_SERVER_URL: http://analytics_api/api/v0
API_SERVER_URL: http://analyticsapi/api/v0
API_AUTH_TOKEN: edx
LMS_HOSTNAME: lms
LMS_PASSWORD: pass
Expand All @@ -34,4 +34,4 @@ services:
DISPLAY_LEARNER_ANALYTICS: "True"
depends_on:
- "es"
- "analytics_api"
- "analyticsapi"
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ validate: validate_python validate_js
demo:
python manage.py waffle_switch show_engagement_forum_activity off --create
python manage.py waffle_switch enable_course_api off --create
python manage.py waffle_switch display_names_for_course_index off --create
python manage.py waffle_switch display_course_name_in_nav off --create

# compiles djangojs and django .po and .mo files
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ The following switches are available:
| enable_ccx_courses | Display CCX Courses in the course listing page. |
| enable_engagement_videos_pages | Enable engagement video pages. |
| enable_video_preview | Enable video preview. |
| display_names_for_course_index | Display course names on course index page. |
| display_course_name_in_nav | Display course name in navigation bar. |
| enable_performance_learning_outcome | Enable performance section with learning outcome breakdown (functionality based on tagging questions in Studio) |
| enable_learner_download | Display Download CSV button on Learner List page. |
Expand Down
43 changes: 24 additions & 19 deletions acceptance_tests/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,20 @@ def assertValidFeedbackLink(self, selector):
element = self.page.q(css=selector)
self.assertEqual(element.text[0], DASHBOARD_FEEDBACK_EMAIL)

def assertTable(self, table_selector, columns, download_selector):
def fulfill_loading_promise(self, css_selector):
"""
Ensure the info contained by `css_selector` is loaded via AJAX.
Arguments
css_selector (string) -- CSS selector of the parent element that will contain the loading message.
"""

EmptyPromise(
lambda: 'Loading...' not in self.page.q(css=css_selector + ' .loading-container').text,
"Loading finished."
).fulfill()

def assertTable(self, table_selector, columns, download_selector=None):
# Ensure the table is loaded via AJAX
self.fulfill_loading_promise(table_selector)

Expand All @@ -105,7 +118,8 @@ def assertTable(self, table_selector, columns, download_selector):
rows = self.page.browser.find_elements_by_css_selector('{} tbody tr'.format(table_selector))
self.assertGreater(len(rows), 0)

self.assertValidHref(download_selector)
if download_selector is not None:
self.assertValidHref(download_selector)

def assertRowTextEquals(self, cols, expected_texts):
"""
Expand Down Expand Up @@ -164,6 +178,9 @@ def _test_footer(self):


class PrimaryNavMixin(CourseApiMixin):
# set to True if the URL fragement should be checked when testing the skip link
test_skip_link_url = True

def _test_user_menu(self):
"""
Verify the user menu functions properly.
Expand Down Expand Up @@ -191,7 +208,7 @@ def _test_active_course(self):
course_name = self.get_course_name_or_id(course_id)
self.assertEqual(element.text[0], course_name)

def _test_skip_link(self):
def _test_skip_link(self, test_url):
active_element = self.driver.switch_to.active_element
skip_link = self.page.q(css='.skip-link').results[0]
skip_link_ref = '#' + skip_link.get_attribute('href').split('#')[-1]
Expand All @@ -202,11 +219,12 @@ def _test_skip_link(self):
active_element = self.driver.switch_to.active_element
active_element.send_keys(Keys.ENTER)

url_hash = self.driver.execute_script('return window.location.hash;')
self.assertEqual(url_hash, skip_link_ref)
if test_url:
url_hash = self.driver.execute_script('return window.location.hash;')
self.assertEqual(url_hash, skip_link_ref)

def test_page(self):
self._test_skip_link()
self._test_skip_link(self.test_skip_link_url)
self._test_user_menu()
self._test_active_course()

Expand Down Expand Up @@ -331,19 +349,6 @@ def _format_last_updated_time(self, d):
def format_last_updated_date_and_time(self, d):
return {'update_date': d.strftime(self.DASHBOARD_DATE_FORMAT), 'update_time': self._format_last_updated_time(d)}

def fulfill_loading_promise(self, css_selector):
"""
Ensure the info contained by `css_selector` is loaded via AJAX.
Arguments
css_selector (string) -- CSS selector of the parent element that will contain the loading message.
"""

EmptyPromise(
lambda: 'Loading...' not in self.page.q(css=css_selector + ' .loading-container').text,
"Loading finished."
).fulfill()

def build_display_percentage(self, count, total, zero_percent_default='0.0%'):
if total and count:
percent = count / float(total) * 100.0
Expand Down
41 changes: 26 additions & 15 deletions acceptance_tests/test_course_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@


class CourseIndexTests(AnalyticsDashboardWebAppTestMixin, WebAppTest):
test_skip_link_url = False

def setUp(self):
super(CourseIndexTests, self).setUp()
self.page = CourseIndexPage(self.browser)
Expand All @@ -21,18 +23,27 @@ def _test_course_list(self):
"""
Course list should contain a link to the test course.
"""
course_id = TEST_COURSE_ID
course_name = self.get_course_name_or_id(course_id)

# Validate that we have a list of course names
course_names = self.page.q(css='.course-list .course a .course-name')
self.assertTrue(course_names.present)

# The element should list the test course name.
self.assertIn(course_name, course_names.text)

# Validate the course link
index = course_names.text.index(course_name)
course_links = self.page.q(css='.course-list .course a')
href = course_links.attrs('href')[index]
self.assertTrue(href.endswith(u'/courses/{}/'.format(course_id)))
# text after the new line is only visible to screen readers
columns = [
'Course Name \nclick to sort',
'Start Date \nclick to sort',
'End Date \nclick to sort',
'Total Enrollment \nclick to sort',
'Current Enrollment \nsort descending',
'Change Last Week \nclick to sort',
'Verified Enrollment \nclick to sort'
]
self.assertTable('.course-list-table', columns)

# Validate that we have a list of courses
course_ids = self.page.q(css='.course-list .course-id')
self.assertTrue(course_ids.present)

# The element should list the test course id.
self.assertIn(TEST_COURSE_ID, course_ids.text)

# Validate the course links
course_links = self.page.q(css='.course-list .course-name-cell a').attrs('href')

for link, course_id in zip(course_links, course_ids):
self.assertTrue(link.endswith(u'/courses/{}'.format(course_id.text)))
1 change: 1 addition & 0 deletions acceptance_tests/test_course_learners.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

@skipUnless(DISPLAY_LEARNER_ANALYTICS, 'Learner Analytics must be enabled to run CourseLearnersTests')
class CourseLearnersTests(CoursePageTestsMixin, WebAppTest):
test_skip_link_url = False
help_path = 'learners/Learner_Activity.html'

def setUp(self):
Expand Down
Binary file modified analytics_dashboard/conf/locale/en/LC_MESSAGES/django.mo
Binary file not shown.
23 changes: 9 additions & 14 deletions analytics_dashboard/conf/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-27 17:00-0500\n"
"POT-Creation-Date: 2017-01-06 14:22-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -831,7 +831,7 @@ msgstr ""
msgid "External Tools"
msgstr ""

#: courses/templates/courses/index.html
#: courses/templates/courses/index.html courses/views/course_summaries.py
msgid "Courses"
msgstr ""

Expand All @@ -846,18 +846,6 @@ msgid ""
"Here are the courses you currently have access to in %(application_name)s:"
msgstr ""

#: courses/templates/courses/index.html
#, python-format
msgid "New to %(application_name)s?"
msgstr ""

#: courses/templates/courses/index.html
#, python-format
msgid ""
"Click Help in the upper-right corner to get more information about "
"%(application_name)s. Send us feedback at %(email_link)s."
msgstr ""

#: courses/templates/courses/performance_answer_distribution.html
#: courses/templates/courses/performance_learning_outcomes_answer_distribution.html
#: courses/templates/courses/performance_ungraded_answer_distribution.html
Expand Down Expand Up @@ -1133,6 +1121,13 @@ msgstr ""
msgid "Courseware"
msgstr ""

#. Translators: Do not translate UTC.
#: courses/views/course_summaries.py
#, python-format
msgid ""
"Course summary data was last updated %(update_date)s at %(update_time)s UTC."
msgstr ""

#: courses/views/engagement.py
msgid "Engagement Content"
msgstr ""
Expand Down
Binary file modified analytics_dashboard/conf/locale/en/LC_MESSAGES/djangojs.mo
Binary file not shown.
Loading

0 comments on commit d99c7d8

Please sign in to comment.