Commit 60b368e2 by Amir Qayyum Khan

Fixed unable to created ccx even if ccx_conn url is not set

parent b9b87f9b
# -*- coding: utf-8 -*-
"""
CCX coach dashboard page
"""
from bok_choy.promise import EmptyPromise
from common.test.acceptance.pages.lms.course_page import CoursePage
class CoachDashboardPage(CoursePage):
"""
CCX coach dashboard, where ccx coach can manage a course.
"""
url_path = "ccx_coach"
def is_browser_on_page(self):
"""
check if ccx dashboard is open.
"""
return self.q(css='div.instructor-dashboard-wrapper-2').present
def is_browser_on_enrollment_page(self):
"""
check if enrollment page in ccx dashboard is open.
"""
return self.q(css='div.batch-enrollment').present
def fill_ccx_name_text_box(self, ccx_name):
"""
Fill in the form with the provided ccx name and submit it.
"""
ccx_name_selector = "#ccx_name"
create_ccx_button = "#create-ccx"
# Fill the ccx_name.
self.wait_for_element_visibility(ccx_name_selector, 'CCX name field is visible')
self.q(css=ccx_name_selector).fill(ccx_name)
# Verify create ccx button is present before clicking.
EmptyPromise(
lambda: self.q(css=create_ccx_button).present, "Create a new Custom Course for edX"
).fulfill()
self.q(css=create_ccx_button).click()
# -*- coding: utf-8 -*-
"""
End-to-end tests for the CCX dashboard.
"""
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures.course import CourseFixture
from common.test.acceptance.tests.helpers import UniqueCourseTest, EventsTestMixin
from common.test.acceptance.pages.lms.auto_auth import AutoAuthPage
from common.test.acceptance.pages.lms.ccx_dashboard_page import CoachDashboardPage
@attr('shard_7')
class CreateCCXCoachTest(EventsTestMixin, UniqueCourseTest):
"""
Test ccx end to end process.
"""
USERNAME = "coach_tester"
EMAIL = "coach_tester@example.com"
def setUp(self):
super(CreateCCXCoachTest, self).setUp()
self.course_info.update({"settings": {"enable_ccx": "true"}})
self.course_fixture = CourseFixture(**self.course_info).install()
self.coach_dashboard_page = CoachDashboardPage(self.browser, self.course_id)
def _auto_auth(self, username, email):
"""
Logout and login with given credentials.
"""
AutoAuthPage(self.browser, username=username, email=email,
course_id=self.course_id, staff=True).visit()
def test_create_ccx(self):
"""
Assert that ccx created.
"""
ccx_name = "Test ccx"
self._auto_auth(self.USERNAME, self.EMAIL)
self.coach_dashboard_page.visit()
self.coach_dashboard_page.fill_ccx_name_text_box(ccx_name)
self.coach_dashboard_page.wait_for_page()
# 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())
......@@ -87,7 +87,8 @@
"AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING": true,
"ENABLE_COURSE_DISCOVERY": true,
"ENABLE_SPECIAL_EXAMS": true,
"SHOW_LANGUAGE_SELECTOR": true
"SHOW_LANGUAGE_SELECTOR": true,
"CUSTOM_COURSES_EDX": true
},
"FEEDBACK_SUBMISSION_EMAIL": "",
"GITHUB_REPO_ROOT": "** OVERRIDDEN **",
......
......@@ -167,7 +167,7 @@ from openedx.core.djangolib.js_utils import (
function validateForm(form) {
var newCCXName = $(form).find('#ccx_name').val();
var $errorMessage = $('#ccx-create-message');
var hasCcxConnector = ${has_ccx_connector | n, dump_js_escaped_json};
var hasCcxConnector = ${has_ccx_connector | n, dump_js_escaped_json} === 'true';
if (!newCCXName && !hasCcxConnector) {
$errorMessage.text("${_('Please enter a valid CCX name.') | n, js_escaped_string}");
......
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