Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Refactored schedule tree #11647

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions common/test/acceptance/pages/lms/ccx_dashboard_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"""
CCX coach dashboard page
"""
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise

from common.test.acceptance.pages.lms.course_page import CoursePage


Expand All @@ -24,6 +26,15 @@ def is_browser_on_enrollment_page(self):
"""
return self.q(css='div.batch-enrollment').present

def select_schedule(self):
"""
Selects the membership tab and returns the MembershipSection
"""
self.q(css='a[data-section=schedule]').first.click()
schedule_section = SchedulePage(self.browser)
schedule_section.wait_for_page()
return schedule_section

def fill_ccx_name_text_box(self, ccx_name):
"""
Fill in the form with the provided ccx name and submit it.
Expand All @@ -40,3 +51,13 @@ def fill_ccx_name_text_box(self, ccx_name):
lambda: self.q(css=create_ccx_button).present, "Create a new Custom Course for edX"
).fulfill()
self.q(css=create_ccx_button).click()


class SchedulePage(PageObject):
"""
CCX schedule page of the coach dashboard.
"""
url = None

def is_browser_on_page(self):
return self.q(css='a[data-section=schedule].active-section').present
44 changes: 38 additions & 6 deletions common/test/acceptance/tests/lms/test_ccx.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
from common.test.acceptance.pages.lms.ccx_dashboard_page import CoachDashboardPage


@attr(shard=7)
class CreateCCXCoachTest(EventsTestMixin, UniqueCourseTest):
@attr('shard_7')
class BaseCCXCoachTest(EventsTestMixin, UniqueCourseTest):
"""
Test ccx end to end process.
Base methods for CCX dashboard testing.
"""
USERNAME = "coach_tester"
EMAIL = "[email protected]"

def setUp(self):
super(CreateCCXCoachTest, self).setUp()
super(BaseCCXCoachTest, self).setUp()
self.course_info.update({"settings": {"enable_ccx": "true"}})
self.course_fixture = CourseFixture(**self.course_info)
self.course_fixture.add_advanced_settings({
Expand All @@ -45,14 +45,46 @@ def visit_coach_dashboard(self):
coach_dashboard_page.visit()
return coach_dashboard_page

def test_create_ccx(self):
def create_ccx(self):
"""
Assert that ccx created.
create ccx
"""
ccx_name = "Test ccx"

self.coach_dashboard_page.fill_ccx_name_text_box(ccx_name)
self.coach_dashboard_page.wait_for_page()


@attr('shard_7')
class CreateCCXCoachTest(BaseCCXCoachTest):
"""
Test ccx end to end process.
"""
def test_create_ccx(self):
"""
Assert that ccx created.
"""
self.create_ccx()
# Assert that new ccx is created and we are on ccx dashboard/enrollment tab.
self.assertTrue(self.coach_dashboard_page.is_browser_on_enrollment_page())


@attr('a11y')
class ScheduleTabA11yTest(BaseCCXCoachTest):
"""
Class to test schedule tab accessibility.
"""

def test_schedule_tab_a11y(self):
"""
Test schedule tab accessibility.
"""
self.create_ccx()
schedule_section = self.coach_dashboard_page.select_schedule()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the schedule populated with some units?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sorry, i think.. need some processing to add units, let me add.


schedule_section.a11y_audit.config.set_rules({
'ignore': [
'link-href', 'skip-link' # TODO: AC-233
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these ignores really necessary because of OAuth settings (which is what https://openedx.atlassian.net/browse/AC-233 refers to)? I only include ignores if they are necessary, and if they are related to something different from AC-233, create a new accessibility ticket.

],
})
schedule_section.a11y_audit.check_for_accessibility_errors()
2 changes: 1 addition & 1 deletion lms/djangoapps/ccx/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def test_create_ccx(self, ccx_name='New CCX'):
course_key = CourseKey.from_string(ccx_key)

self.assertTrue(CourseEnrollment.is_enrolled(self.coach, course_key))
self.assertTrue(re.search('id="ccx-schedule"', response.content))
self.assertTrue(re.search('id="ccx-schedule-container"', response.content))

# check if the max amount of student that can be enrolled has been overridden
ccx = CustomCourseForEdX.objects.get()
Expand Down
17 changes: 17 additions & 0 deletions lms/static/js/ccx/ccx_schedule_factory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(function(define) {
'use strict';
define([
'js/ccx/view/ccx_schedule',
'js/ccx/collection/schedule_collection'
], function(CcxScheduleView, ScheduleCollection) {
return function($container, scheduleJson, saveUrl) {
var scheduleCollection = new ScheduleCollection(scheduleJson);
var view = new CcxScheduleView({
el: $container,
saveCCXScheduleUrl: saveUrl,
collection: scheduleCollection
});
return view;
};
});
}).call(this, define || RequireJS.define);
Loading