SUST-24 Initial commit
Add bokchoy test and changes in html
This commit is contained in:
committed by
attiyaishaque
parent
7b34f4317d
commit
3fb6592443
@@ -286,3 +286,23 @@ class CoursewareSequentialTabPage(CoursePage):
|
||||
return the body of the sequential currently selected
|
||||
"""
|
||||
return self.q(css='#seq_content .xblock').text[0]
|
||||
|
||||
|
||||
class AboutPage(CoursePage):
|
||||
"""
|
||||
Course about.
|
||||
"""
|
||||
|
||||
url_path = "about/"
|
||||
|
||||
def is_browser_on_page(self):
|
||||
return self.q(css='.intro').present
|
||||
|
||||
|
||||
@property
|
||||
def is_register_button_present(self):
|
||||
"""
|
||||
Returns True if the timed/proctored exam timer bar is visible on the courseware.
|
||||
"""
|
||||
from nose.tools import set_trace; set_trace()
|
||||
return self.q(css=".register").is_present()
|
||||
|
||||
@@ -5,6 +5,7 @@ Studio Home page
|
||||
from bok_choy.page_object import PageObject
|
||||
from . import BASE_URL
|
||||
from selenium.webdriver import ActionChains
|
||||
from ..common.utils import click_css
|
||||
|
||||
|
||||
class DashboardPage(PageObject):
|
||||
@@ -12,11 +13,24 @@ class DashboardPage(PageObject):
|
||||
Studio Home page
|
||||
"""
|
||||
|
||||
def __init__(self, browser):
|
||||
"""
|
||||
Initialize the page.
|
||||
"""
|
||||
super(DashboardPage, self).__init__(browser)
|
||||
url = BASE_URL + "/course/"
|
||||
|
||||
|
||||
def is_browser_on_page(self):
|
||||
return self.q(css='.content-primary').visible
|
||||
|
||||
def mouse_hover(self, element):
|
||||
"""
|
||||
Mouse over on given element.
|
||||
"""
|
||||
mouse_hover_action = ActionChains(self.browser).move_to_element(element)
|
||||
mouse_hover_action.perform()
|
||||
|
||||
@property
|
||||
def course_runs(self):
|
||||
"""
|
||||
@@ -48,6 +62,16 @@ class DashboardPage(PageObject):
|
||||
# Clicking on course with run will trigger an ajax event
|
||||
self.wait_for_ajax()
|
||||
|
||||
|
||||
def view_live(self, element):
|
||||
"""
|
||||
Clicks the "View Live" link and switches to the new tab
|
||||
"""
|
||||
self.mouse_hover(self.browser.find_element_by_css_selector('.view-button'))
|
||||
click_css(self, '.view-button', require_notification=False)
|
||||
self.browser.switch_to_window(self.browser.window_handles[-1])
|
||||
click_css(self, element, require_notification=False)
|
||||
|
||||
def has_new_library_button(self):
|
||||
"""
|
||||
(bool) is the "New Library" button present?
|
||||
|
||||
@@ -11,6 +11,7 @@ from ...pages.studio.overview import CourseOutlinePage
|
||||
from ...pages.studio.utils import verify_ordering
|
||||
|
||||
|
||||
|
||||
class StudioCourseTest(UniqueCourseTest):
|
||||
"""
|
||||
Base class for all Studio course tests.
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
"""
|
||||
Acceptance tests for Home Page (My Courses / My Libraries).
|
||||
"""
|
||||
import os
|
||||
import uuid
|
||||
|
||||
from bok_choy.web_app_test import WebAppTest
|
||||
from common.test.acceptance.pages.common.logout import LogoutPage
|
||||
from common.test.acceptance.pages.lms.courseware import AboutPage, CoursewarePage
|
||||
from flaky import flaky
|
||||
from opaque_keys.edx.locator import LibraryLocator
|
||||
from opaque_keys.edx.locator import LibraryLocator, CourseLocator
|
||||
from uuid import uuid4
|
||||
|
||||
from ...fixtures import PROGRAMS_STUB_URL
|
||||
@@ -173,3 +178,74 @@ class StudioLanguageTest(WebAppTest):
|
||||
get_selected_option_text(language_selector),
|
||||
u'Dummy Language (Esperanto)'
|
||||
)
|
||||
|
||||
class CourseNotEnrollTest(WebAppTest):
|
||||
"""
|
||||
Test that we can create a new content library on the studio home page.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
Load the helper for the home page (dashboard page)
|
||||
"""
|
||||
super(CourseNotEnrollTest, self).setUp()
|
||||
|
||||
self.auth_page = AutoAuthPage(self.browser, staff=True)
|
||||
self.dashboard_page = DashboardPage(self.browser)
|
||||
self.course_name = "New Course Name"
|
||||
self.course_org = "orgX"
|
||||
self.course_number = str(uuid.uuid4().get_hex().upper()[0:6])
|
||||
self.course_run = "2015_T2"
|
||||
|
||||
def course_id(self):
|
||||
"""
|
||||
Returns the serialized course_key for the test
|
||||
"""
|
||||
# TODO - is there a better way to make this agnostic to the underlying default module store?
|
||||
default_store = os.environ.get('DEFAULT_STORE', 'draft')
|
||||
course_key = CourseLocator(
|
||||
self.course_org,
|
||||
self.course_number,
|
||||
self.course_run,
|
||||
deprecated=(default_store == 'draft')
|
||||
)
|
||||
return unicode(course_key)
|
||||
|
||||
def test_unenroll_course(self):
|
||||
"""
|
||||
From the home page:
|
||||
Click "New Course" ,Fill out the form
|
||||
Submit the form
|
||||
Return to the home page and logout
|
||||
Login with the staff user which is not enrolled in the course
|
||||
click the view live button of the course
|
||||
Here are two scenario:
|
||||
First click the continue button
|
||||
Second click the Enroll button and see the response.
|
||||
"""
|
||||
self.auth_page.visit()
|
||||
self.dashboard_page.visit()
|
||||
self.assertTrue(self.dashboard_page.new_course_button.present)
|
||||
|
||||
self.dashboard_page.click_new_course_button()
|
||||
self.assertTrue(self.dashboard_page.is_new_course_form_visible())
|
||||
self.dashboard_page.fill_new_course_form(
|
||||
self.course_name, self.course_org, self.course_number, self.course_run
|
||||
)
|
||||
self.assertTrue(self.dashboard_page.is_new_course_form_valid())
|
||||
self.dashboard_page.submit_new_course_form()
|
||||
|
||||
LogoutPage(self.browser).visit()
|
||||
AutoAuthPage(self.browser, course_id=None, staff=True).visit()
|
||||
|
||||
self.dashboard_page.visit()
|
||||
self.dashboard_page.view_live('.submit>input:last-child')
|
||||
about_page = AboutPage(self.browser, self.course_id)
|
||||
about_page.wait_for_page()
|
||||
self.assertTrue(about_page.is_register_button_present)
|
||||
|
||||
self.dashboard_page.visit()
|
||||
self.dashboard_page.view_live('.submit>input:first-child')
|
||||
courseware = CoursewarePage(self.browser, self.course_id)
|
||||
courseware.wait_for_page()
|
||||
self.assertTrue(courseware.is_browser_on_page())
|
||||
@@ -1449,6 +1449,14 @@ class DefaultStatesContentTest(CourseOutlineTest):
|
||||
self.assertEqual(courseware.xblock_component_type(1), 'html')
|
||||
self.assertEqual(courseware.xblock_component_type(2), 'discussion')
|
||||
|
||||
def test_unenroll_course(self):
|
||||
from nose.tools import set_trace; set_trace()
|
||||
self.course_outline_page.visit()
|
||||
self.course_outline_page.view_live()
|
||||
courseware = CoursewarePage(self.browser, self.course_id)
|
||||
courseware.wait_for_page()
|
||||
self.assertEqual(courseware.num_xblock_components, 3)
|
||||
|
||||
|
||||
@attr('shard_3')
|
||||
class UnitNavigationTest(CourseOutlineTest):
|
||||
|
||||
Reference in New Issue
Block a user