Commit 6ca099d5 by Sarina Canelake

Acceptance tests for beta instructor dash

LMS-1203
parent 74714c4e
......@@ -7,12 +7,24 @@ Define common steps for instructor dashboard acceptance tests.
from __future__ import absolute_import
from django.conf import settings
from lettuce import world, step
from mock import patch
from nose.tools import assert_in # pylint: disable=E0611
from courseware.tests.factories import StaffFactory, InstructorFactory
@step(u'Given I am "([^"]*)" for a very large course')
def make_staff_or_instructor_for_large_course(step, role):
make_large_course(step, role)
@patch.dict('courseware.access.settings.FEATURES', {"MAX_ENROLLMENT_INSTR_BUTTONS": 0})
def make_large_course(step, role):
i_am_staff_or_instructor(step, role)
@step(u'Given I am "([^"]*)" for a course')
def i_am_staff_or_instructor(step, role): # pylint: disable=unused-argument
## In summary: makes a test course, makes a new Staff or Instructor user
......@@ -99,5 +111,24 @@ def click_a_button(step, button): # pylint: disable=unused-argument
world.css_click('input[name="list-profiles"]')
elif button == "Download profile information as a CSV":
# Go to the data download section of the instructor dash
go_to_section("data_download")
# Don't do anything else, next step will handle clicking & downloading
else:
raise ValueError("Unrecognized button option " + button)
@step(u'I visit the "([^"]*)" tab')
def click_a_button(step, tab_name): # pylint: disable=unused-argument
# course_info, membership, student_admin, data_download, analytics, send_email
tab_name_dict = {
'Course Info': 'course_info',
'Membership': 'membership',
'Student Admin': 'student_admin',
'Data Download': 'data_download',
'Analytics': 'analytics',
'Email': 'send_email',
}
go_to_section(tab_name_dict[tab_name])
......@@ -7,6 +7,7 @@ Feature: LMS.Instructor Dash Data Download
### todos when more time can be spent on instructor dashboard
#Scenario: Download profile information as a CSV
#Scenario: Download student anonymized IDs as a CSV
## Need to figure out how to assert csvs will download without actually downloading them
Scenario: List enrolled students' profile information
Given I am "<Role>" for a course
......@@ -17,6 +18,15 @@ Feature: LMS.Instructor Dash Data Download
| instructor |
| staff |
Scenario: List enrolled students' profile information for a large course
Given I am "<Role>" for a very large course
When I visit the "Data Download" tab
Then I do not see a button to 'List enrolled students' profile information'
Examples:
| Role |
| instructor |
| staff |
Scenario: View the grading configuration
Given I am "<Role>" for a course
When I click "Grading Configuration"
......
......@@ -9,6 +9,7 @@ acceptance tests.
from lettuce import world, step
from nose.tools import assert_in, assert_regexp_matches # pylint: disable=E0611
from terrain.steps import reload_the_page
from splinter.request_handler.request_handler import RequestHandler
@step(u'I see a table of student profiles')
......@@ -39,6 +40,11 @@ def find_student_profile_table(step): # pylint: disable=unused-argument
assert_in(datum, world.css_text('#data-student-profiles-table'))
@step(u"I do not see a button to 'List enrolled students' profile information'")
def no_student_profile_table(step): # pylint: disable=unused-argument
world.is_css_not_present('input[name="list-profiles"]')
@step(u"I see the grading configuration for the course")
def find_grading_config(step): # pylint: disable=unused-argument
# Find the grading configuration display
......
......@@ -54,40 +54,34 @@ class DataDownload
@$list_studs_btn.click (e) =>
url = @$list_studs_btn.data 'endpoint'
# handle csv special case
if $(e.target).data 'csv'
# redirect the document to the csv file.
url += '/csv'
location.href = url
else
# Dynamically generate slickgrid table for displaying student profile information
@clear_display()
@$download_display_table.text gettext('Loading...')
# fetch user list
$.ajax
dataType: 'json'
url: url
error: std_ajax_err =>
@clear_display()
@$download_request_response_error.text gettext("Error getting student list.")
success: (data) =>
@clear_display()
# display on a SlickGrid
options =
enableCellNavigation: true
enableColumnReorder: false
forceFitColumns: true
rowHeight: 35
columns = ({id: feature, field: feature, name: feature} for feature in data.queried_features)
grid_data = data.students
$table_placeholder = $ '<div/>', class: 'slickgrid'
@$download_display_table.append $table_placeholder
grid = new Slick.Grid($table_placeholder, grid_data, columns, options)
# grid.autosizeColumns()
# Dynamically generate slickgrid table for displaying student profile information
@clear_display()
@$download_display_table.text gettext('Loading...')
# fetch user list
$.ajax
dataType: 'json'
url: url
error: std_ajax_err =>
@clear_display()
@$download_request_response_error.text gettext("Error getting student list.")
success: (data) =>
@clear_display()
# display on a SlickGrid
options =
enableCellNavigation: true
enableColumnReorder: false
forceFitColumns: true
rowHeight: 35
columns = ({id: feature, field: feature, name: feature} for feature in data.queried_features)
grid_data = data.students
$table_placeholder = $ '<div/>', class: 'slickgrid'
@$download_display_table.append $table_placeholder
grid = new Slick.Grid($table_placeholder, grid_data, columns, options)
# grid.autosizeColumns()
@$grade_config_btn.click (e) =>
url = @$grade_config_btn.data 'endpoint'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment