Commit 6421c49d by Andy Armstrong

Fix acceptance tests, and minor doc tweaks

parent 1f80d7a3
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
</div> </div>
<div class="staff-info__status ui-staff__content__section"> <div class="staff-info__status ui-staff__content__section">
<table class="staff-info__status__table" summary="{% trans "Where are your learners currently in this problem" %}"> <table class="staff-info__status__table">
<caption class="title">{% trans "Learner Progress" %}</caption> <caption class="title">{% trans "Learner Progress" %}</caption>
......
...@@ -75,8 +75,8 @@ def require_course_staff(error_key, with_json_handler=False): ...@@ -75,8 +75,8 @@ def require_course_staff(error_key, with_json_handler=False):
@wraps(func) @wraps(func)
def _wrapped(xblock, *args, **kwargs): # pylint: disable=C0111 def _wrapped(xblock, *args, **kwargs): # pylint: disable=C0111
permission_errors = { permission_errors = {
"STAFF_AREA": xblock._(u"You do not have permission to access the staff area"), "STAFF_AREA": xblock._(u"You do not have permission to access the ORA staff area"),
"STUDENT_INFO": xblock._(u"You do not have permission to access learner information."), "STUDENT_INFO": xblock._(u"You do not have permission to access ORA learner information."),
} }
if not xblock.is_course_staff and with_json_handler: if not xblock.is_course_staff and with_json_handler:
......
bok-choy==0.4.7 bok-choy==0.4.7
ddt==0.8.0
nose==1.3.3 nose==1.3.3
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
-r test-acceptance.txt -r test-acceptance.txt
coverage==3.7.1 coverage==3.7.1
ddt==0.8.0
django-nose==1.4.1 django-nose==1.4.1
mock==1.0.1 mock==1.0.1
moto==0.2.22 moto==0.2.22
......
...@@ -29,7 +29,7 @@ if [ -z "$TEST_HOST" ]; then ...@@ -29,7 +29,7 @@ if [ -z "$TEST_HOST" ]; then
exit 1; exit 1;
fi fi
export BASE_URL="https://${BASIC_AUTH_USER}:${BASIC_AUTH_PASSWORD}@${TEST_HOST}" export ORA_SANDBOX_URL="https://${BASIC_AUTH_USER}:${BASIC_AUTH_PASSWORD}@${TEST_HOST}"
virtualenv venv virtualenv venv
source venv/bin/activate source venv/bin/activate
...@@ -46,6 +46,6 @@ make test-acceptance ...@@ -46,6 +46,6 @@ make test-acceptance
unset SELENIUM_HOST unset SELENIUM_HOST
# AutoAuthPage times out in PhantomJS when using https, so switch to use http # AutoAuthPage times out in PhantomJS when using https, so switch to use http
export BASE_URL="http://${BASIC_AUTH_USER}:${BASIC_AUTH_PASSWORD}@${TEST_HOST}" export ORA_SANDBOX_URL="http://${BASIC_AUTH_USER}:${BASIC_AUTH_PASSWORD}@${TEST_HOST}"
make test-a11y make test-a11y
...@@ -18,8 +18,13 @@ ...@@ -18,8 +18,13 @@
cd `dirname $BASH_SOURCE` && cd .. cd `dirname $BASH_SOURCE` && cd ..
if [ -z "$BASE_URL" ]; then # Note: support BASE_URL as a synonym for ORA_SANDBOX_URL for backward compatibility
echo "Error: BASE_URL must be set to point to your sandbox" if [[ $BASE_URL ]]; then
export ORA_SANDBOX_URL="$BASE_URL"
fi
if [[ -z $ORA_SANDBOX_URL ]]; then
echo "Error: ORA_SANDBOX_URL must be set to point to your sandbox"
exit 1 exit 1
fi fi
......
...@@ -22,7 +22,7 @@ To use the tests: ...@@ -22,7 +22,7 @@ To use the tests:
.. code:: bash .. code:: bash
export BASE_URL=https://{USER}:{PASSWORD}@{SANDBOX} export ORA_SANDBOX_URL=https://{USER}:{PASSWORD}@{SANDBOX}
3. Run the tests 3. Run the tests
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
Auto-auth page (used to automatically log in during testing). Auto-auth page (used to automatically log in during testing).
""" """
import os
import re import re
import urllib import urllib
from bok_choy.page_object import PageObject from bok_choy.page_object import PageObject
import os ORA_SANDBOX_URL = os.environ.get('ORA_SANDBOX_URL')
BASE_URL = os.environ.get('BASE_URL')
class AutoAuthPage(PageObject): class AutoAuthPage(PageObject):
...@@ -58,7 +59,7 @@ class AutoAuthPage(PageObject): ...@@ -58,7 +59,7 @@ class AutoAuthPage(PageObject):
""" """
Construct the URL. Construct the URL.
""" """
url = BASE_URL + "/auto_auth" url = ORA_SANDBOX_URL + "/auto_auth"
query_str = urllib.urlencode(self._params) query_str = urllib.urlencode(self._params)
if query_str: if query_str:
......
""" """
Page objects for UI-level acceptance tests. Page objects for UI-level acceptance tests.
""" """
import os
from bok_choy.page_object import PageObject from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise from bok_choy.promise import EmptyPromise
import os ORA_SANDBOX_URL = os.environ.get('ORA_SANDBOX_URL')
BASE_URL = os.environ.get('BASE_URL')
class PageConfigurationError(Exception): class PageConfigurationError(Exception):
...@@ -33,7 +35,7 @@ class OpenAssessmentPage(PageObject): ...@@ -33,7 +35,7 @@ class OpenAssessmentPage(PageObject):
@property @property
def url(self): def url(self):
return "{base}/{loc}".format( return "{base}/{loc}".format(
base=BASE_URL, base=ORA_SANDBOX_URL,
loc=self._problem_location loc=self._problem_location
) )
......
...@@ -209,6 +209,7 @@ class StudentTrainingTest(OpenAssessmentTest): ...@@ -209,6 +209,7 @@ class StudentTrainingTest(OpenAssessmentTest):
self.fail("Student training was not marked complete.") self.fail("Student training was not marked complete.")
@ddt.ddt
class StaffAreaTest(OpenAssessmentTest): class StaffAreaTest(OpenAssessmentTest):
""" """
Test the staff area. Test the staff area.
...@@ -250,13 +251,13 @@ class StaffAreaTest(OpenAssessmentTest): ...@@ -250,13 +251,13 @@ class StaffAreaTest(OpenAssessmentTest):
("staff-info", "STAFF INFO"), ("staff-info", "STAFF INFO"),
) )
@ddt.unpack @ddt.unpack
def test_staff_tools_panel(self, button_name, button_label): def test_staff_area_panel(self, panel_name, button_label):
""" """
Scenario: the staff tools panel should be shown correctly Scenario: the staff area panels should be shown correctly
Given I am viewing the staff area of an ORA problem Given I am viewing the staff area of an ORA problem
Then none of the panels should be shown Then none of the panels should be shown
When I click the staff button When I click a staff button
Then only the related panel should be shown Then only the related panel should be shown
When I click the close button in the panel When I click the close button in the panel
Then none of the panels should be shown Then none of the panels should be shown
...@@ -269,15 +270,15 @@ class StaffAreaTest(OpenAssessmentTest): ...@@ -269,15 +270,15 @@ class StaffAreaTest(OpenAssessmentTest):
self.assertEqual(self.staff_area_page.visible_staff_panels, []) self.assertEqual(self.staff_area_page.visible_staff_panels, [])
# Click on the button and verify that the panel has opened # Click on the button and verify that the panel has opened
self.staff_area_page.click_staff_toolbar_button(button_name) self.staff_area_page.click_staff_toolbar_button(panel_name)
self.assertEqual(self.staff_area_page.selected_button_names, [button_label]) self.assertEqual(self.staff_area_page.selected_button_names, [button_label])
self.assertEqual( self.assertEqual(
self.staff_area_page.visible_staff_panels, self.staff_area_page.visible_staff_panels,
[u'openassessment__{button_name}'.format(button_name=button_name)] [u'openassessment__{button_name}'.format(button_name=panel_name)]
) )
# Click 'Close' and verify that the panel has been closed # Click 'Close' and verify that the panel has been closed
self.staff_area_page.click_staff_panel_close_button("staff-tools") self.staff_area_page.click_staff_panel_close_button(panel_name)
self.assertEqual(self.staff_area_page.selected_button_names, []) self.assertEqual(self.staff_area_page.selected_button_names, [])
self.assertEqual(self.staff_area_page.visible_staff_panels, []) self.assertEqual(self.staff_area_page.visible_staff_panels, [])
......
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