From 81151ab67a0afc082a43a3faf6e997dc1bcb6717 Mon Sep 17 00:00:00 2001 From: Jay Zoldak Date: Thu, 8 Aug 2013 13:24:07 -0400 Subject: [PATCH 01/25] Prototype for running acceptance tests via Sauce Labs Connector Added in more desired capabilities and fixed the browser creation Sauce Labs is now updated if the test suite passes or fails --- common/djangoapps/terrain/browser.py | 52 +++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index c2bf2bbbf3..5ae1ca007f 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -11,6 +11,7 @@ from logging import getLogger from django.core.management import call_command from django.conf import settings from selenium.common.exceptions import WebDriverException +from selenium.webdriver.common.desired_capabilities import DesiredCapabilities # Let the LMS and CMS do their one-time setup # For example, setting up mongo caches @@ -41,13 +42,45 @@ LOGGER.info("Loading the lettuce acceptance testing terrain file...") MAX_VALID_BROWSER_ATTEMPTS = 20 +# https://gist.github.com/santiycr/1644439 +import httplib +import base64 +try: + import json +except ImportError: + import simplejson as json + +config = {"username": "", +"access-key": ""} +desired_capabilities = DesiredCapabilities.CHROME +desired_capabilities['platform'] = "Linux" +desired_capabilities['version'] = "" +desired_capabilities['name'] = "Fail Test" +desired_capabilities['passed'] = True +desired_capabilities['video-upload-on-pass'] = False +desired_capabilities['record-screenshots'] = False +desired_capabilities['selenium-version'] = "2.33.0" +desired_capabilities['max-duration'] = 3600 +jobid='' + +base64string = base64.encodestring('%s:%s' % (config['username'], config['access-key']))[:-1] + +def set_job_status(jobid, passed=True): + body_content = json.dumps({"passed": passed}) + connection = httplib.HTTPConnection("saucelabs.com") + connection.request('PUT', '/rest/v1/%s/jobs/%s' % (config['username'], jobid), + body_content, + headers={"Authorization": "Basic %s" % base64string}) + result = connection.getresponse() + return result.status == 200 + @before.harvest def initial_setup(server): """ Launch the browser once before executing the tests. """ - browser_driver = getattr(settings, 'LETTUCE_BROWSER', 'chrome') + #browser_driver = getattr(settings, 'LETTUCE_BROWSER', 'chrome') # There is an issue with ChromeDriver2 r195627 on Ubuntu # in which we sometimes get an invalid browser session. @@ -57,8 +90,15 @@ def initial_setup(server): while (not success) and num_attempts < MAX_VALID_BROWSER_ATTEMPTS: # Get a browser session - world.browser = Browser(browser_driver) - + # world.browser = Browser(browser_driver) + world.browser = Browser( + 'remote', + url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'],config['access-key']), + **desired_capabilities + ) + world.browser.driver.implicitly_wait(30) + global jobid + jobid = world.browser.driver.session_id # Try to visit the main page # If the browser session is invalid, this will # raise a WebDriverException @@ -75,10 +115,10 @@ def initial_setup(server): # If we were unable to get a valid session within the limit of attempts, # then we cannot run the tests. if not success: - raise IOError("Could not acquire valid {driver} browser session.".format(driver=browser_driver)) + raise IOError("Could not acquire valid {driver} browser session.".format(driver='remote')) # Set the browser size to 1280x1024 - world.browser.driver.set_window_size(1280, 1024) + # world.browser.driver.set_window_size(1280, 1024) @before.each_scenario @@ -128,4 +168,6 @@ def teardown_browser(total): """ Quit the browser after executing the tests. """ + if total.scenarios_ran != total.scenarios_passed: + set_job_status(jobid, False) world.browser.quit() From eb7fe7c92712f0457d8cd96da5b0d9e1443de347 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Thu, 8 Aug 2013 16:13:07 -0400 Subject: [PATCH 02/25] Added browser matrix (might not display yet) Added build information. Status image will now display properly --- README.md | 4 ++++ common/djangoapps/terrain/browser.py | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0261f87b46..9439d27799 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ + + Selenium Tests Status + + This is the main edX platform which consists of LMS and Studio. See [code.edx.org](http://code.edx.org/) for other parts of the edX code base. diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 5ae1ca007f..69c970fc15 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -50,17 +50,20 @@ try: except ImportError: import simplejson as json -config = {"username": "", -"access-key": ""} +config = {"username": "", +"access-key": ""} desired_capabilities = DesiredCapabilities.CHROME desired_capabilities['platform'] = "Linux" desired_capabilities['version'] = "" -desired_capabilities['name'] = "Fail Test" +desired_capabilities['name'] = "LMS Lettuce Test" +desired_capabilities['build'] = "Alpha-Beta-123" desired_capabilities['passed'] = True +desired_capabilities['record-video'] = False desired_capabilities['video-upload-on-pass'] = False desired_capabilities['record-screenshots'] = False desired_capabilities['selenium-version'] = "2.33.0" desired_capabilities['max-duration'] = 3600 +desired_capabilities['public'] = 'public restricted' jobid='' base64string = base64.encodestring('%s:%s' % (config['username'], config['access-key']))[:-1] From 876651009e3fc98fd44b03923b04f6af9ea8fab9 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Fri, 9 Aug 2013 11:01:44 -0400 Subject: [PATCH 03/25] Logging out no longer uses cookies. Removed other cookie reference --- cms/djangoapps/contentstore/features/course-team.py | 3 ++- common/djangoapps/terrain/browser.py | 2 +- common/djangoapps/terrain/steps.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cms/djangoapps/contentstore/features/course-team.py b/cms/djangoapps/contentstore/features/course-team.py index db7b4d81f9..ab68050866 100644 --- a/cms/djangoapps/contentstore/features/course-team.py +++ b/cms/djangoapps/contentstore/features/course-team.py @@ -2,6 +2,7 @@ #pylint: disable=W0621 from lettuce import world, step +from lettuce.django import django_url from common import create_studio_user from django.contrib.auth.models import Group from auth.authz import get_course_groupname_for_role, get_user_by_email @@ -91,7 +92,7 @@ def remove_course_team_admin(_step, outer_capture, name): @step(u'"([^"]*)" logs in$') def other_user_login(_step, name): - world.browser.cookies.delete() + world.visit(django_url('logout')) world.visit('/') signin_css = 'a.action-signin' diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 69c970fc15..680885fec4 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -83,7 +83,7 @@ def initial_setup(server): """ Launch the browser once before executing the tests. """ - #browser_driver = getattr(settings, 'LETTUCE_BROWSER', 'chrome') + # browser_driver = getattr(settings, 'LETTUCE_BROWSER', 'chrome') # There is an issue with ChromeDriver2 r195627 on Ubuntu # in which we sometimes get an invalid browser session. diff --git a/common/djangoapps/terrain/steps.py b/common/djangoapps/terrain/steps.py index 9cf2aeda49..6e11ed19ea 100644 --- a/common/djangoapps/terrain/steps.py +++ b/common/djangoapps/terrain/steps.py @@ -99,7 +99,7 @@ def i_am_logged_in_user(step): @step('I am not logged in$') def i_am_not_logged_in(step): - world.browser.cookies.delete() + world.visit(django_url('logout')) @step('I am staff for course "([^"]*)"$') @@ -150,7 +150,7 @@ def i_am_logged_in(step): world.log_in(username='robot', password='test') world.browser.visit(django_url('/')) # You should not see the login link - assert_equals(world.browser.find_by_css('a#login'), []) + world.is_css_not_present('a#login') @step(u'I am an edX user$') From f4c19919cd0f8727f3d6c51c240a5cf13939f1a7 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 14 Aug 2013 16:49:34 -0400 Subject: [PATCH 04/25] Beginnings of a feature flag Conflicts: common/djangoapps/terrain/browser.py Changed way feature flag was checked Conflicts: common/djangoapps/terrain/browser.py --- cms/envs/acceptance.py | 2 ++ common/djangoapps/terrain/browser.py | 30 +++++++++++++++++----------- lms/envs/acceptance.py | 2 ++ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 7debfe18d1..76a15daa65 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -81,6 +81,8 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True # We do not yet understand why this occurs. Setting this to true is a stopgap measure USE_I18N = True +MITX_FEATURES['USE_SAUCE'] = False + # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('contentstore',) diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 680885fec4..7a1aff2637 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -20,6 +20,8 @@ from lms import one_time_startup # pylint: disable=W0611 from cms import one_time_startup # pylint: disable=W0611 from pymongo import MongoClient import xmodule.modulestore.django +import datetime +from pytz import UTC from xmodule.contentstore.django import _CONTENTSTORE # There is an import issue when using django-staticfiles with lettuce @@ -55,11 +57,11 @@ config = {"username": "", desired_capabilities = DesiredCapabilities.CHROME desired_capabilities['platform'] = "Linux" desired_capabilities['version'] = "" -desired_capabilities['name'] = "LMS Lettuce Test" -desired_capabilities['build'] = "Alpha-Beta-123" +desired_capabilities['name'] = "CMS Lettuce Test" +desired_capabilities['build'] = datetime.datetime.now(UTC).isoformat(' ') desired_capabilities['passed'] = True -desired_capabilities['record-video'] = False desired_capabilities['video-upload-on-pass'] = False +desired_capabilities['sauce-advisor'] = False desired_capabilities['record-screenshots'] = False desired_capabilities['selenium-version'] = "2.33.0" desired_capabilities['max-duration'] = 3600 @@ -83,7 +85,7 @@ def initial_setup(server): """ Launch the browser once before executing the tests. """ - # browser_driver = getattr(settings, 'LETTUCE_BROWSER', 'chrome') + browser_driver = getattr(settings, 'LETTUCE_BROWSER', 'chrome') # There is an issue with ChromeDriver2 r195627 on Ubuntu # in which we sometimes get an invalid browser session. @@ -93,12 +95,15 @@ def initial_setup(server): while (not success) and num_attempts < MAX_VALID_BROWSER_ATTEMPTS: # Get a browser session - # world.browser = Browser(browser_driver) - world.browser = Browser( - 'remote', - url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'],config['access-key']), - **desired_capabilities - ) + if settings.MITX_FEATURES.get('USE_SAUCE'): + world.browser = Browser( + 'remote', + url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'],config['access-key']), + **desired_capabilities + ) + else: + world.browser = Browser(browser_driver) + world.browser.driver.implicitly_wait(30) global jobid jobid = world.browser.driver.session_id @@ -121,7 +126,8 @@ def initial_setup(server): raise IOError("Could not acquire valid {driver} browser session.".format(driver='remote')) # Set the browser size to 1280x1024 - # world.browser.driver.set_window_size(1280, 1024) + if not settings.MITX_FEATURES.get('USE_SAUCE'): + world.browser.driver.set_window_size(1280, 1024) @before.each_scenario @@ -171,6 +177,6 @@ def teardown_browser(total): """ Quit the browser after executing the tests. """ - if total.scenarios_ran != total.scenarios_passed: + if settings.MITX_FEATURES.get('USE_SAUCE') and total.scenarios_ran != total.scenarios_passed: set_job_status(jobid, False) world.browser.quit() diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 1e188d3b45..b86ec56aae 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -90,6 +90,8 @@ USE_I18N = True MITX_FEATURES['ENABLE_FEEDBACK_SUBMISSION'] = True FEEDBACK_SUBMISSION_EMAIL = 'dummy@example.com' +MITX_FEATURES['USE_SAUCE'] = False + # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('courseware',) From 28d9bbaff2d141412daaaa3bda5f191a46329810 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Mon, 12 Aug 2013 14:13:11 -0400 Subject: [PATCH 05/25] Change build name generation Browser Matrix Data only applies to latest build information --- common/djangoapps/terrain/browser.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 7a1aff2637..37fde93b55 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -20,8 +20,6 @@ from lms import one_time_startup # pylint: disable=W0611 from cms import one_time_startup # pylint: disable=W0611 from pymongo import MongoClient import xmodule.modulestore.django -import datetime -from pytz import UTC from xmodule.contentstore.django import _CONTENTSTORE # There is an import issue when using django-staticfiles with lettuce @@ -58,8 +56,7 @@ desired_capabilities = DesiredCapabilities.CHROME desired_capabilities['platform'] = "Linux" desired_capabilities['version'] = "" desired_capabilities['name'] = "CMS Lettuce Test" -desired_capabilities['build'] = datetime.datetime.now(UTC).isoformat(' ') -desired_capabilities['passed'] = True +desired_capabilities['build'] = "Branch Test" desired_capabilities['video-upload-on-pass'] = False desired_capabilities['sauce-advisor'] = False desired_capabilities['record-screenshots'] = False From 010fd5771d7114bd032c514ac053540cffb35084 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 14 Aug 2013 16:50:28 -0400 Subject: [PATCH 06/25] Pass/Fail status updated properly Conflicts: common/djangoapps/terrain/browser.py --- common/djangoapps/terrain/browser.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 37fde93b55..52ed8d1510 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -174,6 +174,9 @@ def teardown_browser(total): """ Quit the browser after executing the tests. """ - if settings.MITX_FEATURES.get('USE_SAUCE') and total.scenarios_ran != total.scenarios_passed: - set_job_status(jobid, False) + if settings.MITX_FEATURES.get('USE_SAUCE'): + if total.scenarios_ran != total.scenarios_passed: + set_job_status(jobid, False) + else: + set_job_status(jobid, True) world.browser.quit() From 1d7284b7cdd3beaed31309e864505d56a84c5671 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Mon, 12 Aug 2013 15:13:30 -0400 Subject: [PATCH 07/25] Refactored out more for feature flags Refactored more for feature flags --- cms/envs/acceptance.py | 9 +++++++++ common/djangoapps/terrain/browser.py | 16 +++++++++------- lms/envs/acceptance.py | 10 ++++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 76a15daa65..0404d0005b 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -8,6 +8,7 @@ so that we can run the lettuce acceptance tests. # pylint: disable=W0401, W0614 from .test import * +from selenium.webdriver.common.desired_capabilities import DesiredCapabilities # You need to start the server in debug mode, # otherwise the browser will not render the pages correctly @@ -82,6 +83,14 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True USE_I18N = True MITX_FEATURES['USE_SAUCE'] = False +MITX_FEATURES['SAUCE_USERNAME'] = '' +MITX_FEATURES['SAUCE_ACCESS_ID'] = '' +MITX_FEATURES['SAUCE_BROWSER'] = DesiredCapabilities.CHROME +MITX_FEATURES['SAUCE_PLATFORM'] = 'Linux' +MITX_FEATURES['SAUCE_VERSION'] = '' +MITX_FEATURES['SAUCE_BUILD'] = 'Feature Test' +MITX_FEATURES['SAUCE_TAGS'] = '' + # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 52ed8d1510..22aefc90bd 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -50,13 +50,15 @@ try: except ImportError: import simplejson as json -config = {"username": "", -"access-key": ""} -desired_capabilities = DesiredCapabilities.CHROME -desired_capabilities['platform'] = "Linux" -desired_capabilities['version'] = "" -desired_capabilities['name'] = "CMS Lettuce Test" -desired_capabilities['build'] = "Branch Test" +config = {"username": settings.MITX_FEATURES.get('SAUCE_USERNAME'), +"access-key": settings.MITX_FEATURES.get('SAUCE_ACCESS_ID')} + +desired_capabilities = settings.MITX_FEATURES.get('SAUCE_BROWSER', DesiredCapabilities.CHROME) +desired_capabilities['platform'] = settings.MITX_FEATURES.get('SAUCE_PLATFORM', 'Linux') +desired_capabilities['version'] = settings.MITX_FEATURES.get('SAUCE_VERSION', '') +desired_capabilities['name'] = "Lettuce Test" +desired_capabilities['build'] = settings.MITX_FEATURES.get('SAUCE_BUILD', 'edX Plaform') +desired_capabilities['tags'] = settings.MITX_FEATURES.get('SAUCE_TAGS', '') desired_capabilities['video-upload-on-pass'] = False desired_capabilities['sauce-advisor'] = False desired_capabilities['record-screenshots'] = False diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index b86ec56aae..f30c22a486 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -9,6 +9,8 @@ so that we can run the lettuce acceptance tests. from .test import * +from selenium.webdriver.common.desired_capabilities import DesiredCapabilities + # You need to start the server in debug mode, # otherwise the browser will not render the pages correctly DEBUG = True @@ -91,6 +93,14 @@ MITX_FEATURES['ENABLE_FEEDBACK_SUBMISSION'] = True FEEDBACK_SUBMISSION_EMAIL = 'dummy@example.com' MITX_FEATURES['USE_SAUCE'] = False +MITX_FEATURES['SAUCE_USERNAME'] = '' +MITX_FEATURES['SAUCE_ACCESS_ID'] = '' +MITX_FEATURES['SAUCE_BROWSER'] = DesiredCapabilities.CHROME +MITX_FEATURES['SAUCE_PLATFORM'] = 'Linux' +MITX_FEATURES['SAUCE_VERSION'] = '' +MITX_FEATURES['SAUCE_BUILD'] = 'edX Platform' +MITX_FEATURES['SAUCE_TAGS'] = '' + # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) From 97df5aa997381c8996293f8a812f0d5fc924a3d0 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Mon, 12 Aug 2013 16:20:09 -0400 Subject: [PATCH 08/25] Added feature flag for device type. Needed for android tablets --- cms/envs/acceptance.py | 1 + common/djangoapps/terrain/browser.py | 1 + lms/envs/acceptance.py | 1 + 3 files changed, 3 insertions(+) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 0404d0005b..7b91a7570e 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -88,6 +88,7 @@ MITX_FEATURES['SAUCE_ACCESS_ID'] = '' MITX_FEATURES['SAUCE_BROWSER'] = DesiredCapabilities.CHROME MITX_FEATURES['SAUCE_PLATFORM'] = 'Linux' MITX_FEATURES['SAUCE_VERSION'] = '' +MITX_FEATURES['SAUCE_DEVICE'] = '' MITX_FEATURES['SAUCE_BUILD'] = 'Feature Test' MITX_FEATURES['SAUCE_TAGS'] = '' diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 22aefc90bd..204bd96b8a 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -56,6 +56,7 @@ config = {"username": settings.MITX_FEATURES.get('SAUCE_USERNAME'), desired_capabilities = settings.MITX_FEATURES.get('SAUCE_BROWSER', DesiredCapabilities.CHROME) desired_capabilities['platform'] = settings.MITX_FEATURES.get('SAUCE_PLATFORM', 'Linux') desired_capabilities['version'] = settings.MITX_FEATURES.get('SAUCE_VERSION', '') +desired_capabilities['device-type'] = settings.MITX_FEATURES.get('SAUCE_DEVICE', '') desired_capabilities['name'] = "Lettuce Test" desired_capabilities['build'] = settings.MITX_FEATURES.get('SAUCE_BUILD', 'edX Plaform') desired_capabilities['tags'] = settings.MITX_FEATURES.get('SAUCE_TAGS', '') diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index f30c22a486..17c769648a 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -98,6 +98,7 @@ MITX_FEATURES['SAUCE_ACCESS_ID'] = '' MITX_FEATURES['SAUCE_BROWSER'] = DesiredCapabilities.CHROME MITX_FEATURES['SAUCE_PLATFORM'] = 'Linux' MITX_FEATURES['SAUCE_VERSION'] = '' +MITX_FEATURES['SAUCE_DEVICE'] = '' MITX_FEATURES['SAUCE_BUILD'] = 'edX Platform' MITX_FEATURES['SAUCE_TAGS'] = '' From 3746c654d8e78577674ab56127b81cf53113bbd3 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Tue, 13 Aug 2013 10:06:53 -0400 Subject: [PATCH 09/25] Added a tag for things that will not work on Firefox Added tags for tests that will not work on Sauce Changed build name Tightened up logic Conflicts: common/djangoapps/terrain/browser.py Added flag for session name --- .../contentstore/features/advanced-settings.feature | 8 ++++++++ cms/djangoapps/contentstore/features/checklists.feature | 2 ++ cms/djangoapps/contentstore/features/video-editor.feature | 4 ++++ cms/envs/acceptance.py | 3 ++- common/djangoapps/terrain/browser.py | 7 ++----- lms/djangoapps/courseware/features/login.feature | 1 + lms/djangoapps/courseware/features/signup.feature | 1 + lms/djangoapps/courseware/features/video.feature | 4 +++- lms/envs/acceptance.py | 3 ++- 9 files changed, 25 insertions(+), 8 deletions(-) diff --git a/cms/djangoapps/contentstore/features/advanced-settings.feature b/cms/djangoapps/contentstore/features/advanced-settings.feature index a11a6cb869..2f0d396e63 100644 --- a/cms/djangoapps/contentstore/features/advanced-settings.feature +++ b/cms/djangoapps/contentstore/features/advanced-settings.feature @@ -2,6 +2,8 @@ Feature: Advanced (manual) course policy In order to specify course policy settings for which no custom user interface exists I want to be able to manually enter JSON key /value pairs +#Sauce labs does not play nicely with CodeMirror + Scenario: A course author sees default advanced settings Given I have opened a new course in Studio When I select the Advanced Settings @@ -11,6 +13,7 @@ Feature: Advanced (manual) course policy Given I am on the Advanced Course Settings page in Studio Then the settings are alphabetized + @Sauce Scenario: Test cancel editing key value Given I am on the Advanced Course Settings page in Studio When I edit the value of a policy key @@ -19,6 +22,7 @@ Feature: Advanced (manual) course policy And I reload the page Then the policy key value is unchanged + @Sauce Scenario: Test editing key value Given I am on the Advanced Course Settings page in Studio When I edit the value of a policy key and save @@ -26,6 +30,7 @@ Feature: Advanced (manual) course policy And I reload the page Then the policy key value is changed + @Sauce Scenario: Test how multi-line input appears Given I am on the Advanced Course Settings page in Studio When I create a JSON object as a value for "discussion_topics" @@ -33,6 +38,7 @@ Feature: Advanced (manual) course policy And I reload the page Then it is displayed as formatted + @Sauce Scenario: Test error if value supplied is of the wrong type Given I am on the Advanced Course Settings page in Studio When I create a JSON object as a value for "display_name" @@ -41,6 +47,7 @@ Feature: Advanced (manual) course policy Then the policy key value is unchanged # This feature will work in Firefox only when Firefox is the active window + @Sauce Scenario: Test automatic quoting of non-JSON values Given I am on the Advanced Course Settings page in Studio When I create a non-JSON value not in quotes @@ -48,6 +55,7 @@ Feature: Advanced (manual) course policy And I reload the page Then it is displayed as a string + @Sauce Scenario: Confirmation is shown on save Given I am on the Advanced Course Settings page in Studio When I edit the value of a policy key diff --git a/cms/djangoapps/contentstore/features/checklists.feature b/cms/djangoapps/contentstore/features/checklists.feature index f13ce53fc2..72cff726f4 100644 --- a/cms/djangoapps/contentstore/features/checklists.feature +++ b/cms/djangoapps/contentstore/features/checklists.feature @@ -11,6 +11,7 @@ Feature: Course checklists And They are correctly selected after reloading the page # CHROME ONLY, due to issues getting link to be active in firefox + @Firefox Scenario: A task can link to a location within Studio Given I have opened Checklists When I select a link to the course outline @@ -19,6 +20,7 @@ Feature: Course checklists Then I am brought back to the course outline in the correct state # CHROME ONLY, due to issues getting link to be active in firefox + @Firefox Scenario: A task can link to a location outside Studio Given I have opened Checklists When I select a link to help page diff --git a/cms/djangoapps/contentstore/features/video-editor.feature b/cms/djangoapps/contentstore/features/video-editor.feature index a53183e37c..d75f21e9c0 100644 --- a/cms/djangoapps/contentstore/features/video-editor.feature +++ b/cms/djangoapps/contentstore/features/video-editor.feature @@ -1,6 +1,8 @@ Feature: Video Component Editor As a course author, I want to be able to create video components. + #Sauce Labs cannot delete cookies + Scenario: User can view Video metadata Given I have created a Video component And I edit the component @@ -12,11 +14,13 @@ Feature: Video Component Editor Then I can modify the display name And my video display name change is persisted on save + @Sauce Scenario: Captions are hidden when "show captions" is false Given I have created a Video component And I have set "show captions" to False Then when I view the video it does not show the captions + @Sauce Scenario: Captions are shown when "show captions" is true Given I have created a Video component And I have set "show captions" to True diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 7b91a7570e..c962ec5560 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -89,7 +89,8 @@ MITX_FEATURES['SAUCE_BROWSER'] = DesiredCapabilities.CHROME MITX_FEATURES['SAUCE_PLATFORM'] = 'Linux' MITX_FEATURES['SAUCE_VERSION'] = '' MITX_FEATURES['SAUCE_DEVICE'] = '' -MITX_FEATURES['SAUCE_BUILD'] = 'Feature Test' +MITX_FEATURES['SAUCE_SESSION'] = 'Lettuce Tests' +MITX_FEATURES['SAUCE_BUILD'] = 'CMS TESTS' MITX_FEATURES['SAUCE_TAGS'] = '' diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 204bd96b8a..9aff0f9999 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -57,7 +57,7 @@ desired_capabilities = settings.MITX_FEATURES.get('SAUCE_BROWSER', DesiredCapab desired_capabilities['platform'] = settings.MITX_FEATURES.get('SAUCE_PLATFORM', 'Linux') desired_capabilities['version'] = settings.MITX_FEATURES.get('SAUCE_VERSION', '') desired_capabilities['device-type'] = settings.MITX_FEATURES.get('SAUCE_DEVICE', '') -desired_capabilities['name'] = "Lettuce Test" +desired_capabilities['name'] = settings.MITX_FEATURES.get('SAUCE_SESSION', 'Lettuce Tests') desired_capabilities['build'] = settings.MITX_FEATURES.get('SAUCE_BUILD', 'edX Plaform') desired_capabilities['tags'] = settings.MITX_FEATURES.get('SAUCE_TAGS', '') desired_capabilities['video-upload-on-pass'] = False @@ -178,8 +178,5 @@ def teardown_browser(total): Quit the browser after executing the tests. """ if settings.MITX_FEATURES.get('USE_SAUCE'): - if total.scenarios_ran != total.scenarios_passed: - set_job_status(jobid, False) - else: - set_job_status(jobid, True) + set_job_status(jobid, total.scenarios_ran == total.scenarios_passed) world.browser.quit() diff --git a/lms/djangoapps/courseware/features/login.feature b/lms/djangoapps/courseware/features/login.feature index 2b90c56f2d..28cba2e874 100644 --- a/lms/djangoapps/courseware/features/login.feature +++ b/lms/djangoapps/courseware/features/login.feature @@ -12,6 +12,7 @@ Feature: Login in as a registered user Then I should see the login error message "This account has not been activated" # CHROME ONLY, firefox will not redirect properly + @Firefox Scenario: Login to an activated account Given I am an edX user And I am an activated user diff --git a/lms/djangoapps/courseware/features/signup.feature b/lms/djangoapps/courseware/features/signup.feature index 19dfd74f1c..e723071fd5 100644 --- a/lms/djangoapps/courseware/features/signup.feature +++ b/lms/djangoapps/courseware/features/signup.feature @@ -4,6 +4,7 @@ Feature: Sign in I want to signup for a student account # CHROME ONLY, firefox will not redirect properly + @Firefox Scenario: Sign up from the homepage Given I visit the homepage When I click the link with the text "Register Now" diff --git a/lms/djangoapps/courseware/features/video.feature b/lms/djangoapps/courseware/features/video.feature index 74cd9cbcbb..e68e8b1ada 100644 --- a/lms/djangoapps/courseware/features/video.feature +++ b/lms/djangoapps/courseware/features/video.feature @@ -11,6 +11,8 @@ Feature: Video component Given the course has a Video component in Youtube mode Then when I view the video it has rendered in Youtube mode + #Firefox doesn't have HTML5 + @Firefox Scenario: Autoplay is enabled in LMS for a Video component Given the course has a Video component in HTML5 mode - Then when I view the video it has autoplay enabled \ No newline at end of file + Then when I view the video it has autoplay enabled diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 17c769648a..e6cac76312 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -99,7 +99,8 @@ MITX_FEATURES['SAUCE_BROWSER'] = DesiredCapabilities.CHROME MITX_FEATURES['SAUCE_PLATFORM'] = 'Linux' MITX_FEATURES['SAUCE_VERSION'] = '' MITX_FEATURES['SAUCE_DEVICE'] = '' -MITX_FEATURES['SAUCE_BUILD'] = 'edX Platform' +MITX_FEATURES['SAUCE_SESSION'] = 'Lettuce Tests' +MITX_FEATURES['SAUCE_BUILD'] = 'LMS TESTS' MITX_FEATURES['SAUCE_TAGS'] = '' From 682d85c2f307e3f62b7e3cdb5ecb599a8a305cba Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 14 Aug 2013 16:51:08 -0400 Subject: [PATCH 10/25] Changed feature to being one dictionary Conflicts: common/djangoapps/terrain/browser.py --- cms/envs/acceptance.py | 24 ++++++++++++------------ common/djangoapps/terrain/browser.py | 21 +++++++++++---------- lms/envs/acceptance.py | 26 ++++++++++++-------------- 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index c962ec5560..54407a8c2f 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -76,23 +76,23 @@ DATABASES = { # Use the auto_auth workflow for creating users and logging them in MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True - # HACK # Setting this flag to false causes imports to not load correctly in the lettuce python files # We do not yet understand why this occurs. Setting this to true is a stopgap measure USE_I18N = True -MITX_FEATURES['USE_SAUCE'] = False -MITX_FEATURES['SAUCE_USERNAME'] = '' -MITX_FEATURES['SAUCE_ACCESS_ID'] = '' -MITX_FEATURES['SAUCE_BROWSER'] = DesiredCapabilities.CHROME -MITX_FEATURES['SAUCE_PLATFORM'] = 'Linux' -MITX_FEATURES['SAUCE_VERSION'] = '' -MITX_FEATURES['SAUCE_DEVICE'] = '' -MITX_FEATURES['SAUCE_SESSION'] = 'Lettuce Tests' -MITX_FEATURES['SAUCE_BUILD'] = 'CMS TESTS' -MITX_FEATURES['SAUCE_TAGS'] = '' - +MITX_FEATURES['SAUCE'] = { + 'USE' : False, + 'USERNAME' : '', + 'ACCESS_ID' : '', + 'BROWSER' : DesiredCapabilities.CHROME, + 'PLATFORM' : 'Linux', + 'VERSION' : '', + 'DEVICE' : '', + 'SESSION' : 'Lettuce Tests', + 'BUILD' : 'CMS TESTS', + 'TAGS' : '' +} # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 9aff0f9999..2757a2fa79 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -53,13 +53,14 @@ except ImportError: config = {"username": settings.MITX_FEATURES.get('SAUCE_USERNAME'), "access-key": settings.MITX_FEATURES.get('SAUCE_ACCESS_ID')} -desired_capabilities = settings.MITX_FEATURES.get('SAUCE_BROWSER', DesiredCapabilities.CHROME) -desired_capabilities['platform'] = settings.MITX_FEATURES.get('SAUCE_PLATFORM', 'Linux') -desired_capabilities['version'] = settings.MITX_FEATURES.get('SAUCE_VERSION', '') -desired_capabilities['device-type'] = settings.MITX_FEATURES.get('SAUCE_DEVICE', '') -desired_capabilities['name'] = settings.MITX_FEATURES.get('SAUCE_SESSION', 'Lettuce Tests') -desired_capabilities['build'] = settings.MITX_FEATURES.get('SAUCE_BUILD', 'edX Plaform') -desired_capabilities['tags'] = settings.MITX_FEATURES.get('SAUCE_TAGS', '') +SAUCE = settings.MITX_FEATURES.get('SAUCE', {}) +desired_capabilities = SAUCE.get('BROWSER', DesiredCapabilities.CHROME) +desired_capabilities['platform'] = SAUCE.get('PLATFORM', 'Linux') +desired_capabilities['version'] = SAUCE.get('VERSION', '') +desired_capabilities['device-type'] = SAUCE.get('DEVICE', '') +desired_capabilities['name'] = SAUCE.get('SESSION', 'Lettuce Tests') +desired_capabilities['build'] = SAUCE.get('BUILD', 'edX Plaform') +desired_capabilities['tags'] = SAUCE.get('TAGS', '') desired_capabilities['video-upload-on-pass'] = False desired_capabilities['sauce-advisor'] = False desired_capabilities['record-screenshots'] = False @@ -95,7 +96,7 @@ def initial_setup(server): while (not success) and num_attempts < MAX_VALID_BROWSER_ATTEMPTS: # Get a browser session - if settings.MITX_FEATURES.get('USE_SAUCE'): + if SAUCE.get('USE'): world.browser = Browser( 'remote', url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'],config['access-key']), @@ -126,7 +127,7 @@ def initial_setup(server): raise IOError("Could not acquire valid {driver} browser session.".format(driver='remote')) # Set the browser size to 1280x1024 - if not settings.MITX_FEATURES.get('USE_SAUCE'): + if not SAUCE.get('USE'): world.browser.driver.set_window_size(1280, 1024) @@ -177,6 +178,6 @@ def teardown_browser(total): """ Quit the browser after executing the tests. """ - if settings.MITX_FEATURES.get('USE_SAUCE'): + if SAUCE.get('USE'): set_job_status(jobid, total.scenarios_ran == total.scenarios_passed) world.browser.quit() diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index e6cac76312..3689b0a18d 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -89,20 +89,18 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True # We do not yet understand why this occurs. Setting this to true is a stopgap measure USE_I18N = True -MITX_FEATURES['ENABLE_FEEDBACK_SUBMISSION'] = True -FEEDBACK_SUBMISSION_EMAIL = 'dummy@example.com' - -MITX_FEATURES['USE_SAUCE'] = False -MITX_FEATURES['SAUCE_USERNAME'] = '' -MITX_FEATURES['SAUCE_ACCESS_ID'] = '' -MITX_FEATURES['SAUCE_BROWSER'] = DesiredCapabilities.CHROME -MITX_FEATURES['SAUCE_PLATFORM'] = 'Linux' -MITX_FEATURES['SAUCE_VERSION'] = '' -MITX_FEATURES['SAUCE_DEVICE'] = '' -MITX_FEATURES['SAUCE_SESSION'] = 'Lettuce Tests' -MITX_FEATURES['SAUCE_BUILD'] = 'LMS TESTS' -MITX_FEATURES['SAUCE_TAGS'] = '' - +MITX_FEATURES['SAUCE'] = { + 'USE' : False, + 'USERNAME' : '', + 'ACCESS_ID' : '', + 'BROWSER' : DesiredCapabilities.CHROME, + 'PLATFORM' : 'Linux', + 'VERSION' : '', + 'DEVICE' : '', + 'SESSION' : 'Lettuce Tests', + 'BUILD' : 'CMS TESTS', + 'TAGS' : '' +} # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) From 2812b9cd5c5ad2834518f72a76b40ea63d542044 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Tue, 13 Aug 2013 11:36:45 -0400 Subject: [PATCH 11/25] Fixed how config was obtained Added comment about the feature --- cms/envs/acceptance.py | 1 + common/djangoapps/terrain/browser.py | 6 ++++-- lms/envs/acceptance.py | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 54407a8c2f..94d6d7697a 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -81,6 +81,7 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True # We do not yet understand why this occurs. Setting this to true is a stopgap measure USE_I18N = True +# Information needed to utilize Sauce Labs. MITX_FEATURES['SAUCE'] = { 'USE' : False, 'USERNAME' : '', diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 2757a2fa79..b92354e755 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -50,10 +50,12 @@ try: except ImportError: import simplejson as json -config = {"username": settings.MITX_FEATURES.get('SAUCE_USERNAME'), -"access-key": settings.MITX_FEATURES.get('SAUCE_ACCESS_ID')} SAUCE = settings.MITX_FEATURES.get('SAUCE', {}) + +config = {"username": SAUCE.get('USERNAME'), +"access-key": SAUCE.get('ACCESS_ID')} + desired_capabilities = SAUCE.get('BROWSER', DesiredCapabilities.CHROME) desired_capabilities['platform'] = SAUCE.get('PLATFORM', 'Linux') desired_capabilities['version'] = SAUCE.get('VERSION', '') diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 3689b0a18d..e9b7163d24 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -89,6 +89,7 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True # We do not yet understand why this occurs. Setting this to true is a stopgap measure USE_I18N = True +# Information needed to utilize Sauce Labs. MITX_FEATURES['SAUCE'] = { 'USE' : False, 'USERNAME' : '', @@ -98,7 +99,7 @@ MITX_FEATURES['SAUCE'] = { 'VERSION' : '', 'DEVICE' : '', 'SESSION' : 'Lettuce Tests', - 'BUILD' : 'CMS TESTS', + 'BUILD' : 'LMS TESTS', 'TAGS' : '' } From 3cf8083717419746de31a5960c52eb572cc0dc9b Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Tue, 13 Aug 2013 11:53:26 -0400 Subject: [PATCH 12/25] Upgraded selenium version for sauce --- common/djangoapps/terrain/browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index b92354e755..9b4885e160 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -66,7 +66,7 @@ desired_capabilities['tags'] = SAUCE.get('TAGS', '') desired_capabilities['video-upload-on-pass'] = False desired_capabilities['sauce-advisor'] = False desired_capabilities['record-screenshots'] = False -desired_capabilities['selenium-version'] = "2.33.0" +desired_capabilities['selenium-version'] = "2.34.0" desired_capabilities['max-duration'] = 3600 desired_capabilities['public'] = 'public restricted' jobid='' From 9fb0529036058a2ef1370cdf8b6e82e5e928d4bc Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Tue, 13 Aug 2013 14:03:31 -0400 Subject: [PATCH 13/25] Sauce can only connect on certain ports --- cms/envs/acceptance.py | 11 ++++++++--- common/djangoapps/terrain/browser.py | 7 ++++--- lms/envs/acceptance.py | 16 ++++++++++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 94d6d7697a..24a5a02533 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -18,7 +18,12 @@ DEBUG = True import logging logging.disable(logging.ERROR) import os -import random +from random import choice +PORTS = [80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, + 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, + 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, + 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, + 9080, 9090, 9876, 9999, 49221, 55001] def seed(): @@ -92,11 +97,11 @@ MITX_FEATURES['SAUCE'] = { 'DEVICE' : '', 'SESSION' : 'Lettuce Tests', 'BUILD' : 'CMS TESTS', - 'TAGS' : '' + 'CUSTOM_TAGS' : {} } # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('contentstore',) -LETTUCE_SERVER_PORT = random.randint(1024, 65535) +LETTUCE_SERVER_PORT = choice(PORTS) LETTUCE_BROWSER = 'chrome' diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 9b4885e160..62e9cde9c0 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -62,7 +62,7 @@ desired_capabilities['version'] = SAUCE.get('VERSION', '') desired_capabilities['device-type'] = SAUCE.get('DEVICE', '') desired_capabilities['name'] = SAUCE.get('SESSION', 'Lettuce Tests') desired_capabilities['build'] = SAUCE.get('BUILD', 'edX Plaform') -desired_capabilities['tags'] = SAUCE.get('TAGS', '') +desired_capabilities['custom-data'] = SAUCE.get('CUSTOM_TAGS', '') desired_capabilities['video-upload-on-pass'] = False desired_capabilities['sauce-advisor'] = False desired_capabilities['record-screenshots'] = False @@ -104,12 +104,13 @@ def initial_setup(server): url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'],config['access-key']), **desired_capabilities ) + global jobid + jobid = world.browser.driver.session_id else: world.browser = Browser(browser_driver) world.browser.driver.implicitly_wait(30) - global jobid - jobid = world.browser.driver.session_id + # Try to visit the main page # If the browser session is invalid, this will # raise a WebDriverException diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index e9b7163d24..f908c31bdc 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -19,8 +19,12 @@ DEBUG = True import logging logging.disable(logging.ERROR) import os -import random - +from random import choice +PORTS = [80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, + 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, + 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, + 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, + 9080, 9090, 9876, 9999, 49221, 55001] def seed(): return os.getppid() @@ -67,7 +71,7 @@ DATABASES = { # Set up XQueue information so that the lms will send # requests to a mock XQueue server running locally -XQUEUE_PORT = random.randint(1024, 65535) +XQUEUE_PORT = choice(PORTS) XQUEUE_INTERFACE = { "url": "http://127.0.0.1:%d" % XQUEUE_PORT, "django_auth": { @@ -99,12 +103,12 @@ MITX_FEATURES['SAUCE'] = { 'VERSION' : '', 'DEVICE' : '', 'SESSION' : 'Lettuce Tests', - 'BUILD' : 'LMS TESTS', - 'TAGS' : '' + 'BUILD' : 'CMS TESTS', + 'CUSTOM_TAGS' : {} } # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('courseware',) -LETTUCE_SERVER_PORT = random.randint(1024, 65535) +LETTUCE_SERVER_PORT = choice(PORTS) LETTUCE_BROWSER = 'chrome' From ee23b9d16180b1b56564b67c592563f7486c1e41 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 14 Aug 2013 16:51:24 -0400 Subject: [PATCH 14/25] Changed method of obtaining feature flags to environment variables Conflicts: common/djangoapps/terrain/browser.py --- cms/envs/acceptance.py | 28 ++++++++++++++++++--------- common/djangoapps/terrain/browser.py | 6 +++--- lms/envs/acceptance.py | 29 +++++++++++++++++++--------- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 24a5a02533..f503bbd043 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -25,6 +25,16 @@ PORTS = [80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, 9080, 9090, 9876, 9999, 49221, 55001] +DESIRED_CAPABILITIES={ + 'chrome': DesiredCapabilities.CHROME, + 'internet explorer': DesiredCapabilities.INTERNETEXPLORER, + 'firefox': DesiredCapabilities.FIREFOX, + 'opera': DesiredCapabilities.OPERA, + 'iphone': DesiredCapabilities.IPHONE, + 'ipad': DesiredCapabilities.IPAD, + 'safari': DesiredCapabilities.SAFARI, + 'android': DesiredCapabilities.ANDROID +} def seed(): return os.getppid() @@ -88,15 +98,15 @@ USE_I18N = True # Information needed to utilize Sauce Labs. MITX_FEATURES['SAUCE'] = { - 'USE' : False, - 'USERNAME' : '', - 'ACCESS_ID' : '', - 'BROWSER' : DesiredCapabilities.CHROME, - 'PLATFORM' : 'Linux', - 'VERSION' : '', - 'DEVICE' : '', - 'SESSION' : 'Lettuce Tests', - 'BUILD' : 'CMS TESTS', + 'ENABLED' : os.environ.get('ENABLED'), + 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), + 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), + 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER')), + 'PLATFORM' : os.environ.get('SAUCE_PLATFORM'), + 'VERSION' : os.environ.get('SAUCE_VERSION'), + 'DEVICE' : os.environ.get('SAUCE_DEVICE'), + 'SESSION' : 'Jenkins Acceptance Tests', + 'BUILD' : os.environ.get('JOB_NAME'), 'CUSTOM_TAGS' : {} } diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 62e9cde9c0..223418972d 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -98,7 +98,7 @@ def initial_setup(server): while (not success) and num_attempts < MAX_VALID_BROWSER_ATTEMPTS: # Get a browser session - if SAUCE.get('USE'): + if SAUCE.get('ENABLED'): world.browser = Browser( 'remote', url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'],config['access-key']), @@ -130,7 +130,7 @@ def initial_setup(server): raise IOError("Could not acquire valid {driver} browser session.".format(driver='remote')) # Set the browser size to 1280x1024 - if not SAUCE.get('USE'): + if not SAUCE.get('ENABLED'): world.browser.driver.set_window_size(1280, 1024) @@ -181,6 +181,6 @@ def teardown_browser(total): """ Quit the browser after executing the tests. """ - if SAUCE.get('USE'): + if SAUCE.get('ENABLED'): set_job_status(jobid, total.scenarios_ran == total.scenarios_passed) world.browser.quit() diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index f908c31bdc..951ddf8418 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -26,6 +26,17 @@ PORTS = [80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, 9080, 9090, 9876, 9999, 49221, 55001] +DESIRED_CAPABILITIES={ + 'chrome': DesiredCapabilities.CHROME, + 'internet explorer': DesiredCapabilities.INTERNETEXPLORER, + 'firefox': DesiredCapabilities.FIREFOX, + 'opera': DesiredCapabilities.OPERA, + 'iphone': DesiredCapabilities.IPHONE, + 'ipad': DesiredCapabilities.IPAD, + 'safari': DesiredCapabilities.SAFARI, + 'android': DesiredCapabilities.ANDROID +} + def seed(): return os.getppid() @@ -95,15 +106,15 @@ USE_I18N = True # Information needed to utilize Sauce Labs. MITX_FEATURES['SAUCE'] = { - 'USE' : False, - 'USERNAME' : '', - 'ACCESS_ID' : '', - 'BROWSER' : DesiredCapabilities.CHROME, - 'PLATFORM' : 'Linux', - 'VERSION' : '', - 'DEVICE' : '', - 'SESSION' : 'Lettuce Tests', - 'BUILD' : 'CMS TESTS', + 'ENABLED' : os.environ.get('ENABLED'), + 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), + 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), + 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER')), + 'PLATFORM' : os.environ.get('SAUCE_PLATFORM'), + 'VERSION' : os.environ.get('SAUCE_VERSION'), + 'DEVICE' : os.environ.get('SAUCE_DEVICE'), + 'SESSION' : 'Jenkins Acceptance Tests', + 'BUILD' : os.environ.get('JOB_NAME'), 'CUSTOM_TAGS' : {} } From d422cb9206c007bd012324fcd6e18f23a53cad6c Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 14 Aug 2013 14:47:30 -0400 Subject: [PATCH 15/25] Fixed desired_capabilities issues Also, now lettuce browser can be specified by jenkins --- cms/envs/acceptance.py | 4 ++-- lms/envs/acceptance.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index f503bbd043..37107c7f70 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -101,7 +101,7 @@ MITX_FEATURES['SAUCE'] = { 'ENABLED' : os.environ.get('ENABLED'), 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), - 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER')), + 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome')), 'PLATFORM' : os.environ.get('SAUCE_PLATFORM'), 'VERSION' : os.environ.get('SAUCE_VERSION'), 'DEVICE' : os.environ.get('SAUCE_DEVICE'), @@ -114,4 +114,4 @@ MITX_FEATURES['SAUCE'] = { INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('contentstore',) LETTUCE_SERVER_PORT = choice(PORTS) -LETTUCE_BROWSER = 'chrome' +LETTUCE_BROWSER = os.environ.get('LETTUCE_BROWSER', 'chrome') diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 951ddf8418..6de7861d71 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -109,7 +109,7 @@ MITX_FEATURES['SAUCE'] = { 'ENABLED' : os.environ.get('ENABLED'), 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), - 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER')), + 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome')), 'PLATFORM' : os.environ.get('SAUCE_PLATFORM'), 'VERSION' : os.environ.get('SAUCE_VERSION'), 'DEVICE' : os.environ.get('SAUCE_DEVICE'), @@ -122,4 +122,4 @@ MITX_FEATURES['SAUCE'] = { INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('courseware',) LETTUCE_SERVER_PORT = choice(PORTS) -LETTUCE_BROWSER = 'chrome' +LETTUCE_BROWSER = os.environ.get('LETTUCE_BROWSER', 'chrome') From 027cbfd09a85001bc20023942c86e8458c72085a Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 14 Aug 2013 15:15:34 -0400 Subject: [PATCH 16/25] Added logic to test_acceptance.sh so that the proper tests will be skipped for each browser This logic also covers if a lettuce_browser is specified Removing browser matrix from readme --- README.md | 4 ---- cms/envs/acceptance.py | 2 +- jenkins/test_acceptance.sh | 12 ++++++++++-- lms/envs/acceptance.py | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9439d27799..0261f87b46 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,3 @@ - - Selenium Tests Status - - This is the main edX platform which consists of LMS and Studio. See [code.edx.org](http://code.edx.org/) for other parts of the edX code base. diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 37107c7f70..335a027c7c 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -19,7 +19,7 @@ import logging logging.disable(logging.ERROR) import os from random import choice -PORTS = [80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, +PORTS = [2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, diff --git a/jenkins/test_acceptance.sh b/jenkins/test_acceptance.sh index b7a244fe99..1bc88744bf 100755 --- a/jenkins/test_acceptance.sh +++ b/jenkins/test_acceptance.sh @@ -30,10 +30,18 @@ TESTS_FAILED=0 # /usr/bin/Xvfb :1 -screen 0 1024x268x24 # This allows us to run Chrome without a display export DISPLAY=:1 +SKIP_TESTS="" + +if [ ! -z ${LETTUCE_BROWSER+x} ]; then + SKIP_TESTS="--tag -$(tr '[:lower:]' '[:upper:]' <<< ${LETTUCE_BROWSER:0:1})${LETTUCE_BROWSER:1}" +fi +if [ ! -z ${SAUCE_ENABLED+x} ]; then + SKIP_TESTS="--tag -Sauce --tag -$(tr '[:lower:]' '[:upper:]' <<< ${SAUCE_BROWSER:0:1})${SAUCE_BROWSER:1}" +fi # Run the lms and cms acceptance tests # (the -v flag turns off color in the output) -rake test_acceptance_lms["-v 3"] || TESTS_FAILED=1 -rake test_acceptance_cms["-v 3"] || TESTS_FAILED=1 +rake test_acceptance_lms["-v 3 $SKIP_TESTS"] || TESTS_FAILED=1 +rake test_acceptance_cms["-v 3 $SKIP_TESTS"] || TESTS_FAILED=1 [ $TESTS_FAILED == '0' ] diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 6de7861d71..60c5d04997 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -20,7 +20,7 @@ import logging logging.disable(logging.ERROR) import os from random import choice -PORTS = [80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, +PORTS = [2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, From 58bb6e1ea37bdddb3ed5e21cd9dd966864ec5b04 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 14 Aug 2013 15:46:12 -0400 Subject: [PATCH 17/25] Changed tags to be lowercase to prevent preprocessing Changed to have a default for device since it isn't always needed Tags are more clear Fixed stylistic issues --- .../features/advanced-settings.feature | 12 +++++------ .../contentstore/features/checklists.feature | 4 ++-- .../features/video-editor.feature | 4 ++-- cms/envs/acceptance.py | 17 ++++++++-------- common/djangoapps/terrain/browser.py | 20 +++++++++---------- jenkins/test_acceptance.sh | 4 ++-- .../courseware/features/login.feature | 2 +- .../courseware/features/signup.feature | 2 +- .../courseware/features/video.feature | 2 +- lms/envs/acceptance.py | 17 ++++++++-------- 10 files changed, 41 insertions(+), 43 deletions(-) diff --git a/cms/djangoapps/contentstore/features/advanced-settings.feature b/cms/djangoapps/contentstore/features/advanced-settings.feature index 2f0d396e63..767dafb796 100644 --- a/cms/djangoapps/contentstore/features/advanced-settings.feature +++ b/cms/djangoapps/contentstore/features/advanced-settings.feature @@ -13,7 +13,7 @@ Feature: Advanced (manual) course policy Given I am on the Advanced Course Settings page in Studio Then the settings are alphabetized - @Sauce + @skip_sauce Scenario: Test cancel editing key value Given I am on the Advanced Course Settings page in Studio When I edit the value of a policy key @@ -22,7 +22,7 @@ Feature: Advanced (manual) course policy And I reload the page Then the policy key value is unchanged - @Sauce + @skip_sauce Scenario: Test editing key value Given I am on the Advanced Course Settings page in Studio When I edit the value of a policy key and save @@ -30,7 +30,7 @@ Feature: Advanced (manual) course policy And I reload the page Then the policy key value is changed - @Sauce + @skip_sauce Scenario: Test how multi-line input appears Given I am on the Advanced Course Settings page in Studio When I create a JSON object as a value for "discussion_topics" @@ -38,7 +38,7 @@ Feature: Advanced (manual) course policy And I reload the page Then it is displayed as formatted - @Sauce + @skip_sauce Scenario: Test error if value supplied is of the wrong type Given I am on the Advanced Course Settings page in Studio When I create a JSON object as a value for "display_name" @@ -47,7 +47,7 @@ Feature: Advanced (manual) course policy Then the policy key value is unchanged # This feature will work in Firefox only when Firefox is the active window - @Sauce + @skip_sauce Scenario: Test automatic quoting of non-JSON values Given I am on the Advanced Course Settings page in Studio When I create a non-JSON value not in quotes @@ -55,7 +55,7 @@ Feature: Advanced (manual) course policy And I reload the page Then it is displayed as a string - @Sauce + @skip_sauce Scenario: Confirmation is shown on save Given I am on the Advanced Course Settings page in Studio When I edit the value of a policy key diff --git a/cms/djangoapps/contentstore/features/checklists.feature b/cms/djangoapps/contentstore/features/checklists.feature index 72cff726f4..28a38b307e 100644 --- a/cms/djangoapps/contentstore/features/checklists.feature +++ b/cms/djangoapps/contentstore/features/checklists.feature @@ -11,7 +11,7 @@ Feature: Course checklists And They are correctly selected after reloading the page # CHROME ONLY, due to issues getting link to be active in firefox - @Firefox + @skip_firefox Scenario: A task can link to a location within Studio Given I have opened Checklists When I select a link to the course outline @@ -20,7 +20,7 @@ Feature: Course checklists Then I am brought back to the course outline in the correct state # CHROME ONLY, due to issues getting link to be active in firefox - @Firefox + @skip_firefox Scenario: A task can link to a location outside Studio Given I have opened Checklists When I select a link to help page diff --git a/cms/djangoapps/contentstore/features/video-editor.feature b/cms/djangoapps/contentstore/features/video-editor.feature index d75f21e9c0..6f5fbd48b9 100644 --- a/cms/djangoapps/contentstore/features/video-editor.feature +++ b/cms/djangoapps/contentstore/features/video-editor.feature @@ -14,13 +14,13 @@ Feature: Video Component Editor Then I can modify the display name And my video display name change is persisted on save - @Sauce + @skip_sauce Scenario: Captions are hidden when "show captions" is false Given I have created a Video component And I have set "show captions" to False Then when I view the video it does not show the captions - @Sauce + @skip_sauce Scenario: Captions are shown when "show captions" is true Given I have created a Video component And I have set "show captions" to True diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 335a027c7c..f51a697f36 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -22,10 +22,10 @@ from random import choice PORTS = [2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, - 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, + 7777, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, 9080, 9090, 9876, 9999, 49221, 55001] -DESIRED_CAPABILITIES={ +DESIRED_CAPABILITIES = { 'chrome': DesiredCapabilities.CHROME, 'internet explorer': DesiredCapabilities.INTERNETEXPLORER, 'firefox': DesiredCapabilities.FIREFOX, @@ -98,16 +98,15 @@ USE_I18N = True # Information needed to utilize Sauce Labs. MITX_FEATURES['SAUCE'] = { - 'ENABLED' : os.environ.get('ENABLED'), + 'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'), 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), - 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome')), - 'PLATFORM' : os.environ.get('SAUCE_PLATFORM'), - 'VERSION' : os.environ.get('SAUCE_VERSION'), - 'DEVICE' : os.environ.get('SAUCE_DEVICE'), + 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome'), DesiredCapabilities.CHROME), + 'PLATFORM' : os.environ.get('SAUCE_PLATFORM', 'Linux'), + 'VERSION' : os.environ.get('SAUCE_VERSION', ''), + 'DEVICE' : os.environ.get('SAUCE_DEVICE', ''), 'SESSION' : 'Jenkins Acceptance Tests', - 'BUILD' : os.environ.get('JOB_NAME'), - 'CUSTOM_TAGS' : {} + 'BUILD' : os.environ.get('JOB_NAME', 'CMS TESTS'), } # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 223418972d..15c822e159 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -56,13 +56,13 @@ SAUCE = settings.MITX_FEATURES.get('SAUCE', {}) config = {"username": SAUCE.get('USERNAME'), "access-key": SAUCE.get('ACCESS_ID')} +world.absorb(SAUCE.get('SAUCE_ENABLED'),'SAUCE_ENABLED') desired_capabilities = SAUCE.get('BROWSER', DesiredCapabilities.CHROME) -desired_capabilities['platform'] = SAUCE.get('PLATFORM', 'Linux') -desired_capabilities['version'] = SAUCE.get('VERSION', '') -desired_capabilities['device-type'] = SAUCE.get('DEVICE', '') -desired_capabilities['name'] = SAUCE.get('SESSION', 'Lettuce Tests') -desired_capabilities['build'] = SAUCE.get('BUILD', 'edX Plaform') -desired_capabilities['custom-data'] = SAUCE.get('CUSTOM_TAGS', '') +desired_capabilities['platform'] = SAUCE.get('PLATFORM') +desired_capabilities['version'] = SAUCE.get('VERSION') +desired_capabilities['device-type'] = SAUCE.get('DEVICE') +desired_capabilities['name'] = SAUCE.get('SESSION') +desired_capabilities['build'] = SAUCE.get('BUILD') desired_capabilities['video-upload-on-pass'] = False desired_capabilities['sauce-advisor'] = False desired_capabilities['record-screenshots'] = False @@ -71,7 +71,7 @@ desired_capabilities['max-duration'] = 3600 desired_capabilities['public'] = 'public restricted' jobid='' -base64string = base64.encodestring('%s:%s' % (config['username'], config['access-key']))[:-1] +base64string = base64.encodestring('{}:{}'.format(config['username'], config['access-key']))[:-1] def set_job_status(jobid, passed=True): body_content = json.dumps({"passed": passed}) @@ -98,7 +98,7 @@ def initial_setup(server): while (not success) and num_attempts < MAX_VALID_BROWSER_ATTEMPTS: # Get a browser session - if SAUCE.get('ENABLED'): + if world.SAUCE_ENABLED: world.browser = Browser( 'remote', url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'],config['access-key']), @@ -130,7 +130,7 @@ def initial_setup(server): raise IOError("Could not acquire valid {driver} browser session.".format(driver='remote')) # Set the browser size to 1280x1024 - if not SAUCE.get('ENABLED'): + if not world.SAUCE_ENABLED: world.browser.driver.set_window_size(1280, 1024) @@ -181,6 +181,6 @@ def teardown_browser(total): """ Quit the browser after executing the tests. """ - if SAUCE.get('ENABLED'): + if world.SAUCE_ENABLED: set_job_status(jobid, total.scenarios_ran == total.scenarios_passed) world.browser.quit() diff --git a/jenkins/test_acceptance.sh b/jenkins/test_acceptance.sh index 1bc88744bf..aaa7cfc3da 100755 --- a/jenkins/test_acceptance.sh +++ b/jenkins/test_acceptance.sh @@ -33,10 +33,10 @@ export DISPLAY=:1 SKIP_TESTS="" if [ ! -z ${LETTUCE_BROWSER+x} ]; then - SKIP_TESTS="--tag -$(tr '[:lower:]' '[:upper:]' <<< ${LETTUCE_BROWSER:0:1})${LETTUCE_BROWSER:1}" + SKIP_TESTS="--tag -skip_$LETTUCE_BROWSER" fi if [ ! -z ${SAUCE_ENABLED+x} ]; then - SKIP_TESTS="--tag -Sauce --tag -$(tr '[:lower:]' '[:upper:]' <<< ${SAUCE_BROWSER:0:1})${SAUCE_BROWSER:1}" + SKIP_TESTS="--tag -skip_sauce --tag -skip_$SAUCE_BROWSER" fi # Run the lms and cms acceptance tests diff --git a/lms/djangoapps/courseware/features/login.feature b/lms/djangoapps/courseware/features/login.feature index 28cba2e874..5c777fd64f 100644 --- a/lms/djangoapps/courseware/features/login.feature +++ b/lms/djangoapps/courseware/features/login.feature @@ -12,7 +12,7 @@ Feature: Login in as a registered user Then I should see the login error message "This account has not been activated" # CHROME ONLY, firefox will not redirect properly - @Firefox + @skip_firefox Scenario: Login to an activated account Given I am an edX user And I am an activated user diff --git a/lms/djangoapps/courseware/features/signup.feature b/lms/djangoapps/courseware/features/signup.feature index e723071fd5..c1fce04b54 100644 --- a/lms/djangoapps/courseware/features/signup.feature +++ b/lms/djangoapps/courseware/features/signup.feature @@ -4,7 +4,7 @@ Feature: Sign in I want to signup for a student account # CHROME ONLY, firefox will not redirect properly - @Firefox + @skip_firefox Scenario: Sign up from the homepage Given I visit the homepage When I click the link with the text "Register Now" diff --git a/lms/djangoapps/courseware/features/video.feature b/lms/djangoapps/courseware/features/video.feature index e68e8b1ada..260887290e 100644 --- a/lms/djangoapps/courseware/features/video.feature +++ b/lms/djangoapps/courseware/features/video.feature @@ -12,7 +12,7 @@ Feature: Video component Then when I view the video it has rendered in Youtube mode #Firefox doesn't have HTML5 - @Firefox + @skip_firefox Scenario: Autoplay is enabled in LMS for a Video component Given the course has a Video component in HTML5 mode Then when I view the video it has autoplay enabled diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 60c5d04997..e4928301d7 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -23,10 +23,10 @@ from random import choice PORTS = [2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, - 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, + 7777, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, 9080, 9090, 9876, 9999, 49221, 55001] -DESIRED_CAPABILITIES={ +DESIRED_CAPABILITIES = { 'chrome': DesiredCapabilities.CHROME, 'internet explorer': DesiredCapabilities.INTERNETEXPLORER, 'firefox': DesiredCapabilities.FIREFOX, @@ -106,16 +106,15 @@ USE_I18N = True # Information needed to utilize Sauce Labs. MITX_FEATURES['SAUCE'] = { - 'ENABLED' : os.environ.get('ENABLED'), + 'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'), 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), - 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome')), - 'PLATFORM' : os.environ.get('SAUCE_PLATFORM'), - 'VERSION' : os.environ.get('SAUCE_VERSION'), - 'DEVICE' : os.environ.get('SAUCE_DEVICE'), + 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome'), DesiredCapabilities.CHROME), + 'PLATFORM' : os.environ.get('SAUCE_PLATFORM', 'Linux'), + 'VERSION' : os.environ.get('SAUCE_VERSION', ''), + 'DEVICE' : os.environ.get('SAUCE_DEVICE', ''), 'SESSION' : 'Jenkins Acceptance Tests', - 'BUILD' : os.environ.get('JOB_NAME'), - 'CUSTOM_TAGS' : {} + 'BUILD' : os.environ.get('JOB_NAME', 'LMS TESTS'), } # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command From 0b6e62984e3992f349c3eec7463b619522b28556 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Thu, 15 Aug 2013 10:58:18 -0400 Subject: [PATCH 18/25] Using requests instead of a HTTPConnect --- cms/envs/acceptance.py | 2 +- common/djangoapps/terrain/browser.py | 12 +++++------- lms/envs/acceptance.py | 3 ++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index f51a697f36..493e2e1028 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -101,7 +101,7 @@ MITX_FEATURES['SAUCE'] = { 'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'), 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), - 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome'), DesiredCapabilities.CHROME), + 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome').lower(), DesiredCapabilities.CHROME), 'PLATFORM' : os.environ.get('SAUCE_PLATFORM', 'Linux'), 'VERSION' : os.environ.get('SAUCE_VERSION', ''), 'DEVICE' : os.environ.get('SAUCE_DEVICE', ''), diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 15c822e159..d351f7433a 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -43,7 +43,7 @@ LOGGER.info("Loading the lettuce acceptance testing terrain file...") MAX_VALID_BROWSER_ATTEMPTS = 20 # https://gist.github.com/santiycr/1644439 -import httplib +import requests import base64 try: import json @@ -75,12 +75,10 @@ base64string = base64.encodestring('{}:{}'.format(config['username'], config['ac def set_job_status(jobid, passed=True): body_content = json.dumps({"passed": passed}) - connection = httplib.HTTPConnection("saucelabs.com") - connection.request('PUT', '/rest/v1/%s/jobs/%s' % (config['username'], jobid), - body_content, - headers={"Authorization": "Basic %s" % base64string}) - result = connection.getresponse() - return result.status == 200 + result=requests.put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], jobid), + data=body_content, + headers={"Authorization": "Basic {}".format(base64string)}) + return result.status_code == 200 @before.harvest diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index e4928301d7..618d52a995 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -109,7 +109,7 @@ MITX_FEATURES['SAUCE'] = { 'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'), 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), - 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome'), DesiredCapabilities.CHROME), + 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome').lower(), DesiredCapabilities.CHROME), 'PLATFORM' : os.environ.get('SAUCE_PLATFORM', 'Linux'), 'VERSION' : os.environ.get('SAUCE_VERSION', ''), 'DEVICE' : os.environ.get('SAUCE_DEVICE', ''), @@ -117,6 +117,7 @@ MITX_FEATURES['SAUCE'] = { 'BUILD' : os.environ.get('JOB_NAME', 'LMS TESTS'), } + # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('courseware',) From 35e5f4cab5a00384acad61fa86751f59bf65b626 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Thu, 15 Aug 2013 11:39:27 -0400 Subject: [PATCH 19/25] Moved global things in browser.py to functions --- cms/envs/acceptance.py | 2 +- common/djangoapps/terrain/browser.py | 53 ++++++++++++++-------------- lms/envs/acceptance.py | 2 +- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 493e2e1028..8b208123cc 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -97,7 +97,7 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True USE_I18N = True # Information needed to utilize Sauce Labs. -MITX_FEATURES['SAUCE'] = { +SAUCE = { 'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'), 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index d351f7433a..0068e587b0 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -51,41 +51,40 @@ except ImportError: import simplejson as json -SAUCE = settings.MITX_FEATURES.get('SAUCE', {}) - -config = {"username": SAUCE.get('USERNAME'), -"access-key": SAUCE.get('ACCESS_ID')} - -world.absorb(SAUCE.get('SAUCE_ENABLED'),'SAUCE_ENABLED') -desired_capabilities = SAUCE.get('BROWSER', DesiredCapabilities.CHROME) -desired_capabilities['platform'] = SAUCE.get('PLATFORM') -desired_capabilities['version'] = SAUCE.get('VERSION') -desired_capabilities['device-type'] = SAUCE.get('DEVICE') -desired_capabilities['name'] = SAUCE.get('SESSION') -desired_capabilities['build'] = SAUCE.get('BUILD') -desired_capabilities['video-upload-on-pass'] = False -desired_capabilities['sauce-advisor'] = False -desired_capabilities['record-screenshots'] = False -desired_capabilities['selenium-version'] = "2.34.0" -desired_capabilities['max-duration'] = 3600 -desired_capabilities['public'] = 'public restricted' -jobid='' - -base64string = base64.encodestring('{}:{}'.format(config['username'], config['access-key']))[:-1] - def set_job_status(jobid, passed=True): body_content = json.dumps({"passed": passed}) - result=requests.put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], jobid), + config = get_username_and_key() + base64string = base64.encodestring('{}:{}'.format(config['username'], config['access-key']))[:-1] + result=requests.put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], world.jobid), data=body_content, headers={"Authorization": "Basic {}".format(base64string)}) return result.status_code == 200 +def make_desired_capabilities(): + desired_capabilities = settings.SAUCE.get('BROWSER', DesiredCapabilities.CHROME) + desired_capabilities['platform'] = settings.SAUCE.get('PLATFORM') + desired_capabilities['version'] = settings.SAUCE.get('VERSION') + desired_capabilities['device-type'] = settings.SAUCE.get('DEVICE') + desired_capabilities['name'] = settings.SAUCE.get('SESSION') + desired_capabilities['build'] = settings.SAUCE.get('BUILD') + desired_capabilities['video-upload-on-pass'] = False + desired_capabilities['sauce-advisor'] = False + desired_capabilities['record-screenshots'] = False + desired_capabilities['selenium-version'] = "2.34.0" + desired_capabilities['max-duration'] = 3600 + desired_capabilities['public'] = 'public restricted' + return desired_capabilities + +def get_username_and_key(): + return {"username": settings.SAUCE.get('USERNAME'),"access-key": settings.SAUCE.get('ACCESS_ID')} + @before.harvest def initial_setup(server): """ Launch the browser once before executing the tests. """ + world.absorb(settings.SAUCE.get('SAUCE_ENABLED'),'SAUCE_ENABLED') browser_driver = getattr(settings, 'LETTUCE_BROWSER', 'chrome') # There is an issue with ChromeDriver2 r195627 on Ubuntu @@ -97,13 +96,13 @@ def initial_setup(server): # Get a browser session if world.SAUCE_ENABLED: + config = get_username_and_key() world.browser = Browser( 'remote', url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'],config['access-key']), - **desired_capabilities + **make_desired_capabilities() ) - global jobid - jobid = world.browser.driver.session_id + world.absorb(world.browser.driver.session_id, 'jobid') else: world.browser = Browser(browser_driver) @@ -180,5 +179,5 @@ def teardown_browser(total): Quit the browser after executing the tests. """ if world.SAUCE_ENABLED: - set_job_status(jobid, total.scenarios_ran == total.scenarios_passed) + set_job_status(world.jobid, total.scenarios_ran == total.scenarios_passed) world.browser.quit() diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 618d52a995..80e8fd980e 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -105,7 +105,7 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True USE_I18N = True # Information needed to utilize Sauce Labs. -MITX_FEATURES['SAUCE'] = { +SAUCE = { 'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'), 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), From 22b3f2b161041315a7ec925343b7eb1d8ecd53a4 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Thu, 15 Aug 2013 13:04:28 -0400 Subject: [PATCH 20/25] Factored out Sauce related things to one file LMS was arbitrarily chosen for now. Fixed up pylint and pep8 errors Fixed up pylint and pep8 errors Changed naming to be better Changed Sauce Info to obtaining a JSON string --- cms/envs/acceptance.py | 30 +----------------- common/djangoapps/terrain/browser.py | 11 ++++--- lms/envs/acceptance.py | 32 +------------------ lms/envs/sauce.py | 46 ++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 65 deletions(-) create mode 100644 lms/envs/sauce.py diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 8b208123cc..708583719e 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -8,7 +8,7 @@ so that we can run the lettuce acceptance tests. # pylint: disable=W0401, W0614 from .test import * -from selenium.webdriver.common.desired_capabilities import DesiredCapabilities +from lms.envs.sauce import * # You need to start the server in debug mode, # otherwise the browser will not render the pages correctly @@ -19,22 +19,7 @@ import logging logging.disable(logging.ERROR) import os from random import choice -PORTS = [2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, - 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, - 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, - 7777, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, - 9080, 9090, 9876, 9999, 49221, 55001] -DESIRED_CAPABILITIES = { - 'chrome': DesiredCapabilities.CHROME, - 'internet explorer': DesiredCapabilities.INTERNETEXPLORER, - 'firefox': DesiredCapabilities.FIREFOX, - 'opera': DesiredCapabilities.OPERA, - 'iphone': DesiredCapabilities.IPHONE, - 'ipad': DesiredCapabilities.IPAD, - 'safari': DesiredCapabilities.SAFARI, - 'android': DesiredCapabilities.ANDROID -} def seed(): return os.getppid() @@ -96,19 +81,6 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True # We do not yet understand why this occurs. Setting this to true is a stopgap measure USE_I18N = True -# Information needed to utilize Sauce Labs. -SAUCE = { - 'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'), - 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), - 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), - 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome').lower(), DesiredCapabilities.CHROME), - 'PLATFORM' : os.environ.get('SAUCE_PLATFORM', 'Linux'), - 'VERSION' : os.environ.get('SAUCE_VERSION', ''), - 'DEVICE' : os.environ.get('SAUCE_DEVICE', ''), - 'SESSION' : 'Jenkins Acceptance Tests', - 'BUILD' : os.environ.get('JOB_NAME', 'CMS TESTS'), -} - # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('contentstore',) diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 0068e587b0..80c47433b7 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -55,11 +55,12 @@ def set_job_status(jobid, passed=True): body_content = json.dumps({"passed": passed}) config = get_username_and_key() base64string = base64.encodestring('{}:{}'.format(config['username'], config['access-key']))[:-1] - result=requests.put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], world.jobid), + result = requests.put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], world.jobid), data=body_content, headers={"Authorization": "Basic {}".format(base64string)}) return result.status_code == 200 + def make_desired_capabilities(): desired_capabilities = settings.SAUCE.get('BROWSER', DesiredCapabilities.CHROME) desired_capabilities['platform'] = settings.SAUCE.get('PLATFORM') @@ -75,8 +76,9 @@ def make_desired_capabilities(): desired_capabilities['public'] = 'public restricted' return desired_capabilities + def get_username_and_key(): - return {"username": settings.SAUCE.get('USERNAME'),"access-key": settings.SAUCE.get('ACCESS_ID')} + return {"username": settings.SAUCE.get('USERNAME'), "access-key": settings.SAUCE.get('ACCESS_ID')} @before.harvest @@ -99,7 +101,7 @@ def initial_setup(server): config = get_username_and_key() world.browser = Browser( 'remote', - url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'],config['access-key']), + url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'], config['access-key']), **make_desired_capabilities() ) world.absorb(world.browser.driver.session_id, 'jobid') @@ -147,7 +149,6 @@ def clear_data(scenario): world.spew('scenario_dict') - @after.each_scenario def reset_databases(scenario): ''' @@ -179,5 +180,5 @@ def teardown_browser(total): Quit the browser after executing the tests. """ if world.SAUCE_ENABLED: - set_job_status(world.jobid, total.scenarios_ran == total.scenarios_passed) + set_job_status(world.jobid, total.scenarios_ran == total.scenarios_passed) world.browser.quit() diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 80e8fd980e..969f461640 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -8,8 +8,7 @@ so that we can run the lettuce acceptance tests. # pylint: disable=W0401, W0614 from .test import * - -from selenium.webdriver.common.desired_capabilities import DesiredCapabilities +from .sauce import * # You need to start the server in debug mode, # otherwise the browser will not render the pages correctly @@ -20,22 +19,7 @@ import logging logging.disable(logging.ERROR) import os from random import choice -PORTS = [2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, - 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, - 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, - 7777, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, - 9080, 9090, 9876, 9999, 49221, 55001] -DESIRED_CAPABILITIES = { - 'chrome': DesiredCapabilities.CHROME, - 'internet explorer': DesiredCapabilities.INTERNETEXPLORER, - 'firefox': DesiredCapabilities.FIREFOX, - 'opera': DesiredCapabilities.OPERA, - 'iphone': DesiredCapabilities.IPHONE, - 'ipad': DesiredCapabilities.IPAD, - 'safari': DesiredCapabilities.SAFARI, - 'android': DesiredCapabilities.ANDROID -} def seed(): return os.getppid() @@ -104,20 +88,6 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True # We do not yet understand why this occurs. Setting this to true is a stopgap measure USE_I18N = True -# Information needed to utilize Sauce Labs. -SAUCE = { - 'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'), - 'USERNAME' : os.environ.get('SAUCE_USER_NAME'), - 'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), - 'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome').lower(), DesiredCapabilities.CHROME), - 'PLATFORM' : os.environ.get('SAUCE_PLATFORM', 'Linux'), - 'VERSION' : os.environ.get('SAUCE_VERSION', ''), - 'DEVICE' : os.environ.get('SAUCE_DEVICE', ''), - 'SESSION' : 'Jenkins Acceptance Tests', - 'BUILD' : os.environ.get('JOB_NAME', 'LMS TESTS'), -} - - # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('courseware',) diff --git a/lms/envs/sauce.py b/lms/envs/sauce.py new file mode 100644 index 0000000000..2692037082 --- /dev/null +++ b/lms/envs/sauce.py @@ -0,0 +1,46 @@ +""" +This config file extends the test environment configuration +so that we can run the lettuce acceptance tests on SauceLabs. +""" + +# We intentionally define lots of variables that aren't used, and +# want to import all variables from base settings files +# pylint: disable=W0401, W0614 + +from selenium.webdriver.common.desired_capabilities import DesiredCapabilities +import os +import json + +PORTS = [2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, + 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, + 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, + 7777, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, + 9080, 9090, 9876, 9999, 49221, 55001] + +DESIRED_CAPABILITIES = { + 'chrome': DesiredCapabilities.CHROME, + 'internet explorer': DesiredCapabilities.INTERNETEXPLORER, + 'firefox': DesiredCapabilities.FIREFOX, + 'opera': DesiredCapabilities.OPERA, + 'iphone': DesiredCapabilities.IPHONE, + 'ipad': DesiredCapabilities.IPAD, + 'safari': DesiredCapabilities.SAFARI, + 'android': DesiredCapabilities.ANDROID +} + +DEFAULT_CONFIG='{"PLATFORM":"Linux", "BROWSER":"chrome", "VERISON":"", "DEVICE":""}' + +SAUCE_INFO = json.loads(os.environ.get('SAUCE_INFO', DEFAULT_CONFIG)) + +# Information needed to utilize Sauce Labs. +SAUCE = { + 'SAUCE_ENABLED': os.environ.get('SAUCE_ENABLED'), + 'USERNAME': os.environ.get('SAUCE_USER_NAME'), + 'ACCESS_ID': os.environ.get('SAUCE_API_KEY'), + 'BROWSER': DESIRED_CAPABILITIES.get(SAUCE_INFO.get('BROWSER', 'chrome').lower(), DesiredCapabilities.CHROME), + 'PLATFORM': SAUCE_INFO.get('PLATFORM', 'Linux'), + 'VERSION': SAUCE_INFO.get('VERSION', ''), + 'DEVICE': SAUCE_INFO.get('DEVICE', ''), + 'SESSION': 'Jenkins Acceptance Tests', + 'BUILD': os.environ.get('JOB_NAME', 'LETTUCE TESTS'), +} From 4c3dcda7e8c794f24b6905c534c8e0445d0d7928 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Fri, 16 Aug 2013 15:25:31 -0400 Subject: [PATCH 21/25] Hack to get around many types of string encodings Changed the port listing Changing to better readability --- lms/envs/sauce.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lms/envs/sauce.py b/lms/envs/sauce.py index 2692037082..1704edd68b 100644 --- a/lms/envs/sauce.py +++ b/lms/envs/sauce.py @@ -9,12 +9,11 @@ so that we can run the lettuce acceptance tests on SauceLabs. from selenium.webdriver.common.desired_capabilities import DesiredCapabilities import os -import json PORTS = [2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, - 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, - 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, - 7777, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, + 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, + 5050, 5555, 5432, 6060, 6666, 6543, 7000, 7070, 7774, + 7777, 8003, 8031, 8080, 8081, 8765, 8888, 9080, 9090, 9876, 9999, 49221, 55001] DESIRED_CAPABILITIES = { @@ -28,19 +27,25 @@ DESIRED_CAPABILITIES = { 'android': DesiredCapabilities.ANDROID } -DEFAULT_CONFIG='{"PLATFORM":"Linux", "BROWSER":"chrome", "VERISON":"", "DEVICE":""}' -SAUCE_INFO = json.loads(os.environ.get('SAUCE_INFO', DEFAULT_CONFIG)) +#HACK +#This needs to be done because Jenkins needs to satisfy URLs, JSON, BASH, SAUCE, and PYTHON +#This is the simplest way to adhere to all of these requirements and still be readible +DEFAULT_CONFIG = 'Linux-chrome--' + +SAUCE_INFO = os.environ.get('SAUCE_INFO', DEFAULT_CONFIG).split('-') +if len(SAUCE_INFO) !=4: + SAUCE_INFO = DEFAULT_CONFIG.split('-') # Information needed to utilize Sauce Labs. SAUCE = { 'SAUCE_ENABLED': os.environ.get('SAUCE_ENABLED'), 'USERNAME': os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID': os.environ.get('SAUCE_API_KEY'), - 'BROWSER': DESIRED_CAPABILITIES.get(SAUCE_INFO.get('BROWSER', 'chrome').lower(), DesiredCapabilities.CHROME), - 'PLATFORM': SAUCE_INFO.get('PLATFORM', 'Linux'), - 'VERSION': SAUCE_INFO.get('VERSION', ''), - 'DEVICE': SAUCE_INFO.get('DEVICE', ''), + 'BROWSER': DESIRED_CAPABILITIES.get(SAUCE_INFO[0].lower(), DesiredCapabilities.CHROME), + 'PLATFORM': SAUCE_INFO[0], + 'VERSION': SAUCE_INFO[2], + 'DEVICE': SAUCE_INFO[3], 'SESSION': 'Jenkins Acceptance Tests', 'BUILD': os.environ.get('JOB_NAME', 'LETTUCE TESTS'), } From bb7cbf4d6263c30de056758c6e39d0cc532a3179 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Mon, 19 Aug 2013 09:01:40 -0400 Subject: [PATCH 22/25] If sauce is not enabled, allow full range of ports Forgot an import --- cms/envs/acceptance.py | 4 ++-- lms/envs/acceptance.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 708583719e..3b89e2e988 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -18,7 +18,7 @@ DEBUG = True import logging logging.disable(logging.ERROR) import os -from random import choice +from random import choice, randint def seed(): @@ -84,5 +84,5 @@ USE_I18N = True # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('contentstore',) -LETTUCE_SERVER_PORT = choice(PORTS) +LETTUCE_SERVER_PORT = choice(PORTS) if SAUCE.get('SAUCE_ENABLED') else randint(1024, 65535) LETTUCE_BROWSER = os.environ.get('LETTUCE_BROWSER', 'chrome') diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 969f461640..232e8b86b4 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -18,7 +18,7 @@ DEBUG = True import logging logging.disable(logging.ERROR) import os -from random import choice +from random import choice, randint def seed(): @@ -66,7 +66,7 @@ DATABASES = { # Set up XQueue information so that the lms will send # requests to a mock XQueue server running locally -XQUEUE_PORT = choice(PORTS) +XQUEUE_PORT = choice(PORTS) if SAUCE.get('SAUCE_ENABLED') else randint(1024, 65535) XQUEUE_INTERFACE = { "url": "http://127.0.0.1:%d" % XQUEUE_PORT, "django_auth": { @@ -91,5 +91,5 @@ USE_I18N = True # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('courseware',) -LETTUCE_SERVER_PORT = choice(PORTS) +LETTUCE_SERVER_PORT = choice(PORTS) if SAUCE.get('SAUCE_ENABLED') else randint(1024, 65535) LETTUCE_BROWSER = os.environ.get('LETTUCE_BROWSER', 'chrome') From 21f75ff250a7a4a687d0bb0bd47d6ee71cb2cfc6 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Mon, 19 Aug 2013 09:08:02 -0400 Subject: [PATCH 23/25] Various stylistic and pylint fixes / changes Version numbers have very different ranges for different browsers so not having a dictionary of those. Fixed a whitespace issue Fixed pylint/pep8 violations Don't need django_url Spacing issues Changed how commenting works Forgot one Used wrong name Changed around importing Remove django_url Fixed function orderingn Made logic nicer for getting a new browser Modifying tests to run in opera Needed to increase time to account for slow sauce loading Now safari LMS works Forgot an assert statement Skipping a few tests for opera --- .../features/advanced-settings.feature | 7 +- .../contentstore/features/checklists.feature | 6 +- .../contentstore/features/course-team.py | 3 +- .../contentstore/features/grading.py | 9 +- .../features/video-editor.feature | 4 +- common/djangoapps/terrain/browser.py | 110 +++++++++--------- common/djangoapps/terrain/steps.py | 11 +- .../courseware/features/login.feature | 2 +- .../courseware/features/navigation.feature | 2 + .../courseware/features/signup.feature | 2 +- .../courseware/features/video.feature | 2 +- lms/envs/sauce.py | 13 ++- 12 files changed, 93 insertions(+), 78 deletions(-) diff --git a/cms/djangoapps/contentstore/features/advanced-settings.feature b/cms/djangoapps/contentstore/features/advanced-settings.feature index 767dafb796..b2941ac7a5 100644 --- a/cms/djangoapps/contentstore/features/advanced-settings.feature +++ b/cms/djangoapps/contentstore/features/advanced-settings.feature @@ -2,7 +2,6 @@ Feature: Advanced (manual) course policy In order to specify course policy settings for which no custom user interface exists I want to be able to manually enter JSON key /value pairs -#Sauce labs does not play nicely with CodeMirror Scenario: A course author sees default advanced settings Given I have opened a new course in Studio @@ -13,6 +12,7 @@ Feature: Advanced (manual) course policy Given I am on the Advanced Course Settings page in Studio Then the settings are alphabetized + # Sauce labs does not play nicely with CodeMirror @skip_sauce Scenario: Test cancel editing key value Given I am on the Advanced Course Settings page in Studio @@ -22,6 +22,7 @@ Feature: Advanced (manual) course policy And I reload the page Then the policy key value is unchanged + # Sauce labs does not play nicely with CodeMirror @skip_sauce Scenario: Test editing key value Given I am on the Advanced Course Settings page in Studio @@ -30,6 +31,7 @@ Feature: Advanced (manual) course policy And I reload the page Then the policy key value is changed + # Sauce labs does not play nicely with CodeMirror @skip_sauce Scenario: Test how multi-line input appears Given I am on the Advanced Course Settings page in Studio @@ -38,6 +40,7 @@ Feature: Advanced (manual) course policy And I reload the page Then it is displayed as formatted + # Sauce labs does not play nicely with CodeMirror @skip_sauce Scenario: Test error if value supplied is of the wrong type Given I am on the Advanced Course Settings page in Studio @@ -47,6 +50,7 @@ Feature: Advanced (manual) course policy Then the policy key value is unchanged # This feature will work in Firefox only when Firefox is the active window + # Sauce labs does not play nicely with CodeMirror @skip_sauce Scenario: Test automatic quoting of non-JSON values Given I am on the Advanced Course Settings page in Studio @@ -55,6 +59,7 @@ Feature: Advanced (manual) course policy And I reload the page Then it is displayed as a string + # Sauce labs does not play nicely with CodeMirror @skip_sauce Scenario: Confirmation is shown on save Given I am on the Advanced Course Settings page in Studio diff --git a/cms/djangoapps/contentstore/features/checklists.feature b/cms/djangoapps/contentstore/features/checklists.feature index 28a38b307e..1649cd0749 100644 --- a/cms/djangoapps/contentstore/features/checklists.feature +++ b/cms/djangoapps/contentstore/features/checklists.feature @@ -10,8 +10,9 @@ Feature: Course checklists Then I can check and uncheck tasks in a checklist And They are correctly selected after reloading the page - # CHROME ONLY, due to issues getting link to be active in firefox + # There are issues getting link to be active in browsers other than chrome @skip_firefox + @skip_opera Scenario: A task can link to a location within Studio Given I have opened Checklists When I select a link to the course outline @@ -19,8 +20,9 @@ Feature: Course checklists And I press the browser back button Then I am brought back to the course outline in the correct state - # CHROME ONLY, due to issues getting link to be active in firefox + # There are issues getting link to be active in browsers other than chrome @skip_firefox + @skip_opera Scenario: A task can link to a location outside Studio Given I have opened Checklists When I select a link to help page diff --git a/cms/djangoapps/contentstore/features/course-team.py b/cms/djangoapps/contentstore/features/course-team.py index ab68050866..8b31d325e5 100644 --- a/cms/djangoapps/contentstore/features/course-team.py +++ b/cms/djangoapps/contentstore/features/course-team.py @@ -2,7 +2,6 @@ #pylint: disable=W0621 from lettuce import world, step -from lettuce.django import django_url from common import create_studio_user from django.contrib.auth.models import Group from auth.authz import get_course_groupname_for_role, get_user_by_email @@ -92,7 +91,7 @@ def remove_course_team_admin(_step, outer_capture, name): @step(u'"([^"]*)" logs in$') def other_user_login(_step, name): - world.visit(django_url('logout')) + world.visit('logout') world.visit('/') signin_css = 'a.action-signin' diff --git a/cms/djangoapps/contentstore/features/grading.py b/cms/djangoapps/contentstore/features/grading.py index 719b3f7f7c..93e44b3893 100644 --- a/cms/djangoapps/contentstore/features/grading.py +++ b/cms/djangoapps/contentstore/features/grading.py @@ -112,10 +112,10 @@ def changes_not_persisted(step): @step(u'I see the assignment type "(.*)"$') def i_see_the_assignment_type(_step, name): - assignment_css = '#course-grading-assignment-name' - assignments = world.css_find(assignment_css) - types = [ele['value'] for ele in assignments] - assert name in types + assignment_css = '#course-grading-assignment-name' + assignments = world.css_find(assignment_css) + types = [ele['value'] for ele in assignments] + assert name in types @step(u'I change the highest grade range to "(.*)"$') @@ -144,6 +144,7 @@ def cannot_edit_fail(_step): pass # We should get this exception on failing to edit the element + @step(u'I change the grace period to "(.*)"$') def i_change_grace_period(_step, grace_period): grace_period_css = '#course-grading-graceperiod' diff --git a/cms/djangoapps/contentstore/features/video-editor.feature b/cms/djangoapps/contentstore/features/video-editor.feature index 6f5fbd48b9..7117926c60 100644 --- a/cms/djangoapps/contentstore/features/video-editor.feature +++ b/cms/djangoapps/contentstore/features/video-editor.feature @@ -1,8 +1,6 @@ Feature: Video Component Editor As a course author, I want to be able to create video components. - #Sauce Labs cannot delete cookies - Scenario: User can view Video metadata Given I have created a Video component And I edit the component @@ -14,12 +12,14 @@ Feature: Video Component Editor Then I can modify the display name And my video display name change is persisted on save + # Sauce Labs cannot delete cookies @skip_sauce Scenario: Captions are hidden when "show captions" is false Given I have created a Video component And I have set "show captions" to False Then when I view the video it does not show the captions + # Sauce Labs cannot delete cookies @skip_sauce Scenario: Captions are shown when "show captions" is true Given I have created a Video component diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 80c47433b7..5820ad46f7 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -12,6 +12,9 @@ from django.core.management import call_command from django.conf import settings from selenium.common.exceptions import WebDriverException from selenium.webdriver.common.desired_capabilities import DesiredCapabilities +from requests import put +from base64 import encodestring +from json import dumps # Let the LMS and CMS do their one-time setup # For example, setting up mongo caches @@ -42,27 +45,32 @@ LOGGER.info("Loading the lettuce acceptance testing terrain file...") MAX_VALID_BROWSER_ATTEMPTS = 20 -# https://gist.github.com/santiycr/1644439 -import requests -import base64 -try: - import json -except ImportError: - import simplejson as json + +def get_username_and_key(): + """ + Returns the Sauce Labs username and access ID as set by environment variables + """ + return {"username": settings.SAUCE.get('USERNAME'), "access-key": settings.SAUCE.get('ACCESS_ID')} def set_job_status(jobid, passed=True): - body_content = json.dumps({"passed": passed}) + """ + Sets the job status on sauce labs + """ + body_content = dumps({"passed": passed}) config = get_username_and_key() - base64string = base64.encodestring('{}:{}'.format(config['username'], config['access-key']))[:-1] - result = requests.put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], world.jobid), + base64string = encodestring('{}:{}'.format(config['username'], config['access-key']))[:-1] + result = put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], world.jobid), data=body_content, headers={"Authorization": "Basic {}".format(base64string)}) return result.status_code == 200 def make_desired_capabilities(): - desired_capabilities = settings.SAUCE.get('BROWSER', DesiredCapabilities.CHROME) + """ + Returns a DesiredCapabilities object corresponding to the environment sauce parameters + """ + desired_capabilities = settings.SAUCE.get('BROWSER', DesiredCapabilities.CHROME) desired_capabilities['platform'] = settings.SAUCE.get('PLATFORM') desired_capabilities['version'] = settings.SAUCE.get('VERSION') desired_capabilities['device-type'] = settings.SAUCE.get('DEVICE') @@ -77,60 +85,54 @@ def make_desired_capabilities(): return desired_capabilities -def get_username_and_key(): - return {"username": settings.SAUCE.get('USERNAME'), "access-key": settings.SAUCE.get('ACCESS_ID')} - - @before.harvest def initial_setup(server): """ Launch the browser once before executing the tests. """ - world.absorb(settings.SAUCE.get('SAUCE_ENABLED'),'SAUCE_ENABLED') - browser_driver = getattr(settings, 'LETTUCE_BROWSER', 'chrome') + world.absorb(settings.SAUCE.get('SAUCE_ENABLED'), 'SAUCE_ENABLED') - # There is an issue with ChromeDriver2 r195627 on Ubuntu - # in which we sometimes get an invalid browser session. - # This is a work-around to ensure that we get a valid session. - success = False - num_attempts = 0 - while (not success) and num_attempts < MAX_VALID_BROWSER_ATTEMPTS: + if not world.SAUCE_ENABLED: + browser_driver = getattr(settings, 'LETTUCE_BROWSER', 'chrome') - # Get a browser session - if world.SAUCE_ENABLED: - config = get_username_and_key() - world.browser = Browser( - 'remote', - url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'], config['access-key']), - **make_desired_capabilities() - ) - world.absorb(world.browser.driver.session_id, 'jobid') - else: + # There is an issue with ChromeDriver2 r195627 on Ubuntu + # in which we sometimes get an invalid browser session. + # This is a work-around to ensure that we get a valid session. + success = False + num_attempts = 0 + while (not success) and num_attempts < MAX_VALID_BROWSER_ATTEMPTS: world.browser = Browser(browser_driver) + # Try to visit the main page + # If the browser session is invalid, this will + # raise a WebDriverException + try: + world.visit('/') + + except WebDriverException: + world.browser.quit() + num_attempts += 1 + + else: + success = True + + # If we were unable to get a valid session within the limit of attempts, + # then we cannot run the tests. + if not success: + raise IOError("Could not acquire valid {driver} browser session.".format(driver='remote')) + + world.browser.driver.set_window_size(1280, 1024) + + else: + config = get_username_and_key() + world.browser = Browser( + 'remote', + url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'], config['access-key']), + **make_desired_capabilities() + ) world.browser.driver.implicitly_wait(30) - # Try to visit the main page - # If the browser session is invalid, this will - # raise a WebDriverException - try: - world.visit('/') - - except WebDriverException: - world.browser.quit() - num_attempts += 1 - - else: - success = True - - # If we were unable to get a valid session within the limit of attempts, - # then we cannot run the tests. - if not success: - raise IOError("Could not acquire valid {driver} browser session.".format(driver='remote')) - - # Set the browser size to 1280x1024 - if not world.SAUCE_ENABLED: - world.browser.driver.set_window_size(1280, 1024) + world.absorb(world.browser.driver.session_id, 'jobid') @before.each_scenario diff --git a/common/djangoapps/terrain/steps.py b/common/djangoapps/terrain/steps.py index 6e11ed19ea..f13b3ff932 100644 --- a/common/djangoapps/terrain/steps.py +++ b/common/djangoapps/terrain/steps.py @@ -99,7 +99,7 @@ def i_am_logged_in_user(step): @step('I am not logged in$') def i_am_not_logged_in(step): - world.visit(django_url('logout')) + world.visit('logout') @step('I am staff for course "([^"]*)"$') @@ -138,10 +138,13 @@ def should_have_link_with_path_and_text(step, path, text): @step(r'should( not)? see "(.*)" (?:somewhere|anywhere) (?:in|on) (?:the|this) page') def should_see_in_the_page(step, doesnt_appear, text): + multiplier = 1 + if world.SAUCE_ENABLED: + multiplier = 2 if doesnt_appear: - assert world.browser.is_text_not_present(text, wait_time=5) + assert world.browser.is_text_not_present(text, wait_time=5*multiplier) else: - assert world.browser.is_text_present(text, wait_time=5) + assert world.browser.is_text_present(text, wait_time=5*multiplier) @step('I am logged in$') @@ -150,7 +153,7 @@ def i_am_logged_in(step): world.log_in(username='robot', password='test') world.browser.visit(django_url('/')) # You should not see the login link - world.is_css_not_present('a#login') + assert world.is_css_not_present('a#login') @step(u'I am an edX user$') diff --git a/lms/djangoapps/courseware/features/login.feature b/lms/djangoapps/courseware/features/login.feature index 5c777fd64f..4165a9bb9f 100644 --- a/lms/djangoapps/courseware/features/login.feature +++ b/lms/djangoapps/courseware/features/login.feature @@ -11,7 +11,7 @@ Feature: Login in as a registered user And I submit my credentials on the login form Then I should see the login error message "This account has not been activated" - # CHROME ONLY, firefox will not redirect properly + # firefox will not redirect properly when the whole suite is run @skip_firefox Scenario: Login to an activated account Given I am an edX user diff --git a/lms/djangoapps/courseware/features/navigation.feature b/lms/djangoapps/courseware/features/navigation.feature index 8fd8b54c1a..70cc93fd93 100644 --- a/lms/djangoapps/courseware/features/navigation.feature +++ b/lms/djangoapps/courseware/features/navigation.feature @@ -13,6 +13,8 @@ Feature: Navigate Course When I click on subsection "2" Then I should see the content of subsection "2" + # Clicking on the sequence link doesn't work on opera through sauce + @skip_opera Scenario: I can navigate to sequences Given I am viewing a section with multiple sequences When I click on sequence "2" diff --git a/lms/djangoapps/courseware/features/signup.feature b/lms/djangoapps/courseware/features/signup.feature index c1fce04b54..3c9f491f7d 100644 --- a/lms/djangoapps/courseware/features/signup.feature +++ b/lms/djangoapps/courseware/features/signup.feature @@ -3,7 +3,7 @@ Feature: Sign in As a new user I want to signup for a student account - # CHROME ONLY, firefox will not redirect properly + # firefox will not redirect properly @skip_firefox Scenario: Sign up from the homepage Given I visit the homepage diff --git a/lms/djangoapps/courseware/features/video.feature b/lms/djangoapps/courseware/features/video.feature index 260887290e..6c8299f2c5 100644 --- a/lms/djangoapps/courseware/features/video.feature +++ b/lms/djangoapps/courseware/features/video.feature @@ -11,7 +11,7 @@ Feature: Video component Given the course has a Video component in Youtube mode Then when I view the video it has rendered in Youtube mode - #Firefox doesn't have HTML5 + # Firefox doesn't have HTML5 @skip_firefox Scenario: Autoplay is enabled in LMS for a Video component Given the course has a Video component in HTML5 mode diff --git a/lms/envs/sauce.py b/lms/envs/sauce.py index 1704edd68b..e33d4dff62 100644 --- a/lms/envs/sauce.py +++ b/lms/envs/sauce.py @@ -27,25 +27,26 @@ DESIRED_CAPABILITIES = { 'android': DesiredCapabilities.ANDROID } +PLATFORMS = ['Linux', 'OS X 10.8', 'OS X 10.6', 'Windows 8', 'Windows 7', 'Windows XP'] #HACK #This needs to be done because Jenkins needs to satisfy URLs, JSON, BASH, SAUCE, and PYTHON -#This is the simplest way to adhere to all of these requirements and still be readible +#This is the simplest way to adhere to all of these requirements and still be readable DEFAULT_CONFIG = 'Linux-chrome--' SAUCE_INFO = os.environ.get('SAUCE_INFO', DEFAULT_CONFIG).split('-') -if len(SAUCE_INFO) !=4: - SAUCE_INFO = DEFAULT_CONFIG.split('-') +if len(SAUCE_INFO) != 4: + SAUCE_INFO = DEFAULT_CONFIG.split('-') # Information needed to utilize Sauce Labs. SAUCE = { 'SAUCE_ENABLED': os.environ.get('SAUCE_ENABLED'), 'USERNAME': os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID': os.environ.get('SAUCE_API_KEY'), - 'BROWSER': DESIRED_CAPABILITIES.get(SAUCE_INFO[0].lower(), DesiredCapabilities.CHROME), - 'PLATFORM': SAUCE_INFO[0], + 'PLATFORM': SAUCE_INFO[0] if SAUCE_INFO[0] in PLATFORMS else 'Linux', + 'BROWSER': DESIRED_CAPABILITIES.get(SAUCE_INFO[1].lower(), DesiredCapabilities.CHROME), 'VERSION': SAUCE_INFO[2], 'DEVICE': SAUCE_INFO[3], 'SESSION': 'Jenkins Acceptance Tests', - 'BUILD': os.environ.get('JOB_NAME', 'LETTUCE TESTS'), + 'BUILD': os.environ.get('BUILD_DISPLAY_NAME', 'LETTUCE TESTS'), } From b2480b5f00782cffa4020db8f493ca5b93192c8d Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Tue, 20 Aug 2013 10:43:05 -0400 Subject: [PATCH 24/25] Changed way feature flags are interpreted Configurations must be defined before hand Reduced pylint violations We only support 4 browsers --- .../contentstore/features/checklists.feature | 2 -- .../contentstore/features/upload.py | 3 +- .../courseware/features/navigation.feature | 2 -- lms/envs/sauce.py | 29 +++++++++++++++---- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/cms/djangoapps/contentstore/features/checklists.feature b/cms/djangoapps/contentstore/features/checklists.feature index 1649cd0749..b48d8608b6 100644 --- a/cms/djangoapps/contentstore/features/checklists.feature +++ b/cms/djangoapps/contentstore/features/checklists.feature @@ -12,7 +12,6 @@ Feature: Course checklists # There are issues getting link to be active in browsers other than chrome @skip_firefox - @skip_opera Scenario: A task can link to a location within Studio Given I have opened Checklists When I select a link to the course outline @@ -22,7 +21,6 @@ Feature: Course checklists # There are issues getting link to be active in browsers other than chrome @skip_firefox - @skip_opera Scenario: A task can link to a location outside Studio Given I have opened Checklists When I select a link to help page diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index a989d6c07f..882b36e6b2 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -10,6 +10,7 @@ import os TEST_ROOT = settings.COMMON_TEST_DATA_ROOT + @step(u'I go to the files and uploads page') def go_to_uploads(_step): menu_css = 'li.nav-course-courseware' @@ -106,8 +107,8 @@ def get_index(file_name): def get_file(file_name): index = get_index(file_name) assert index != -1 - url_css = 'a.filename' + def get_url(): return world.css_find(url_css)[index]._element.get_attribute('href') url = world.retry_on_exception(get_url) diff --git a/lms/djangoapps/courseware/features/navigation.feature b/lms/djangoapps/courseware/features/navigation.feature index 70cc93fd93..8fd8b54c1a 100644 --- a/lms/djangoapps/courseware/features/navigation.feature +++ b/lms/djangoapps/courseware/features/navigation.feature @@ -13,8 +13,6 @@ Feature: Navigate Course When I click on subsection "2" Then I should see the content of subsection "2" - # Clicking on the sequence link doesn't work on opera through sauce - @skip_opera Scenario: I can navigate to sequences Given I am viewing a section with multiple sequences When I click on sequence "2" diff --git a/lms/envs/sauce.py b/lms/envs/sauce.py index e33d4dff62..e4764f7cf8 100644 --- a/lms/envs/sauce.py +++ b/lms/envs/sauce.py @@ -27,24 +27,41 @@ DESIRED_CAPABILITIES = { 'android': DesiredCapabilities.ANDROID } -PLATFORMS = ['Linux', 'OS X 10.8', 'OS X 10.6', 'Windows 8', 'Windows 7', 'Windows XP'] +ALL_CONFIG = { + 'Linux-chrome--': ['Linux', 'chrome', '', ''], + 'Windows 8-chrome--': ['Windows 8', 'chrome', '', ''], + 'Windows 7-chrome--': ['Windows 7', 'chrome', '', ''], + 'Windows XP-chrome--': ['Windows XP', 'chrome', '', ''], + 'OS X 10.8-chrome--': ['OS X 10.8', 'chrome', '', ''], + 'OS X 10.6-chrome--': ['OS X 10.6', 'chrome', '', ''], + + 'Linux-firefox-23-': ['Linux', 'firefox', '23', ''], + 'Windows 8-firefox-23-': ['Windows 8', 'firefox', '23', ''], + 'Windows 7-firefox-23-': ['Windows 7', 'firefox', '23', ''], + 'Windows XP-firefox-23-': ['Windows XP', 'firefox', '23', ''], + + 'OS X 10.8-safari-6-': ['OS X 10.8', 'safari', '6', ''], + + 'Windows 8-internetexplorer-10-': ['Windows 8', 'internetexplorer', '10', ''], +} #HACK #This needs to be done because Jenkins needs to satisfy URLs, JSON, BASH, SAUCE, and PYTHON #This is the simplest way to adhere to all of these requirements and still be readable +# PLATFORM-BROWSER-VERSION_NUM-DEVICE DEFAULT_CONFIG = 'Linux-chrome--' -SAUCE_INFO = os.environ.get('SAUCE_INFO', DEFAULT_CONFIG).split('-') -if len(SAUCE_INFO) != 4: - SAUCE_INFO = DEFAULT_CONFIG.split('-') +SAUCE_CONFIG = os.environ.get('SAUCE_INFO', DEFAULT_CONFIG) + +SAUCE_INFO = ALL_CONFIG[SAUCE_CONFIG] # Information needed to utilize Sauce Labs. SAUCE = { 'SAUCE_ENABLED': os.environ.get('SAUCE_ENABLED'), 'USERNAME': os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID': os.environ.get('SAUCE_API_KEY'), - 'PLATFORM': SAUCE_INFO[0] if SAUCE_INFO[0] in PLATFORMS else 'Linux', - 'BROWSER': DESIRED_CAPABILITIES.get(SAUCE_INFO[1].lower(), DesiredCapabilities.CHROME), + 'PLATFORM': SAUCE_INFO[0], + 'BROWSER': DESIRED_CAPABILITIES.get(SAUCE_INFO[1]), 'VERSION': SAUCE_INFO[2], 'DEVICE': SAUCE_INFO[3], 'SESSION': 'Jenkins Acceptance Tests', From d96595318a8e77e8b473dd64de1e1e0bc4032fb4 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Tue, 20 Aug 2013 12:47:53 -0400 Subject: [PATCH 25/25] Stylistic changes CMS tests should now run on IE CMS tests will now run on Safari Rebased wrong Forgot to update the test_acceptance.sh Changed way of string splitting --- .../contentstore/features/checklists.feature | 4 ++++ .../features/course-overview.feature | 4 ++++ .../features/course-settings.feature | 16 ++++++++++++++++ .../contentstore/features/course-updates.feature | 6 ++++++ .../features/discussion-editor.feature | 2 ++ .../contentstore/features/grading.feature | 8 +++++++- .../contentstore/features/html-editor.feature | 2 ++ .../contentstore/features/problem-editor.feature | 16 ++++++++++++++++ .../contentstore/features/static-pages.feature | 2 ++ .../contentstore/features/subsection.feature | 2 ++ .../contentstore/features/textbooks.feature | 3 +++ .../contentstore/features/upload.feature | 10 ++++++++++ .../contentstore/features/video-editor.feature | 2 ++ .../contentstore/features/video.feature | 6 ++++++ common/djangoapps/terrain/browser.py | 2 +- jenkins/test_acceptance.sh | 6 +++++- lms/envs/acceptance.py | 3 +++ lms/envs/sauce.py | 12 +++--------- 18 files changed, 94 insertions(+), 12 deletions(-) diff --git a/cms/djangoapps/contentstore/features/checklists.feature b/cms/djangoapps/contentstore/features/checklists.feature index b48d8608b6..6289df9cfc 100644 --- a/cms/djangoapps/contentstore/features/checklists.feature +++ b/cms/djangoapps/contentstore/features/checklists.feature @@ -12,6 +12,8 @@ Feature: Course checklists # There are issues getting link to be active in browsers other than chrome @skip_firefox + @skip_internetexplorer + @skip_safari Scenario: A task can link to a location within Studio Given I have opened Checklists When I select a link to the course outline @@ -21,6 +23,8 @@ Feature: Course checklists # There are issues getting link to be active in browsers other than chrome @skip_firefox + @skip_internetexplorer + @skip_safari Scenario: A task can link to a location outside Studio Given I have opened Checklists When I select a link to help page diff --git a/cms/djangoapps/contentstore/features/course-overview.feature b/cms/djangoapps/contentstore/features/course-overview.feature index a9aed5d982..2cbb22ddd7 100644 --- a/cms/djangoapps/contentstore/features/course-overview.feature +++ b/cms/djangoapps/contentstore/features/course-overview.feature @@ -64,6 +64,10 @@ Feature: Course Overview And I change an assignment's grading status Then I am shown a notification + # Notification is not shown on reorder for IE + # Safari does not have moveMouseTo implemented + @skip_internetexplorer + @skip_safari Scenario: Notification is shown on subsection reorder Given I have opened a new course section in Studio And I have added a new subsection diff --git a/cms/djangoapps/contentstore/features/course-settings.feature b/cms/djangoapps/contentstore/features/course-settings.feature index 8f00452efe..9976179b68 100644 --- a/cms/djangoapps/contentstore/features/course-settings.feature +++ b/cms/djangoapps/contentstore/features/course-settings.feature @@ -1,6 +1,8 @@ Feature: Course Settings As a course author, I want to be able to configure my course settings. + # Safari has trouble keeps dates on refresh + @skip_safari Scenario: User can set course dates Given I have opened a new course in Studio When I select Schedule and Details @@ -8,12 +10,16 @@ Feature: Course Settings And I press the "Save" notification button Then I see the set dates on refresh + # IE has trouble with saving information + @skip_internetexplorer Scenario: User can clear previously set course dates (except start date) Given I have set course dates And I clear all the dates except start And I press the "Save" notification button Then I see cleared dates on refresh + # IE has trouble with saving information + @skip_internetexplorer Scenario: User cannot clear the course start date Given I have set course dates And I press the "Save" notification button @@ -21,6 +27,10 @@ Feature: Course Settings Then I receive a warning about course start date And The previously set start date is shown on refresh + # IE has trouble with saving information + # Safari gets CSRF token errors + @skip_internetexplorer + @skip_safari Scenario: User can correct the course start date warning Given I have tried to clear the course start And I have entered a new course start date @@ -28,12 +38,16 @@ Feature: Course Settings Then The warning about course start date goes away And My new course start date is shown on refresh + # Safari does not save + refresh properly through sauce labs + @skip_safari Scenario: Settings are only persisted when saved Given I have set course dates And I press the "Save" notification button When I change fields Then I do not see the new changes persisted on refresh + # Safari does not save + refresh properly through sauce labs + @skip_safari Scenario: Settings are reset on cancel Given I have set course dates And I press the "Save" notification button @@ -41,6 +55,8 @@ Feature: Course Settings And I press the "Cancel" notification button Then I do not see the changes + # Safari gets CSRF token errors + @skip_safari Scenario: Confirmation is shown on save Given I have opened a new course in Studio When I select Schedule and Details diff --git a/cms/djangoapps/contentstore/features/course-updates.feature b/cms/djangoapps/contentstore/features/course-updates.feature index fb18e51f2d..41ee785db5 100644 --- a/cms/djangoapps/contentstore/features/course-updates.feature +++ b/cms/djangoapps/contentstore/features/course-updates.feature @@ -1,6 +1,8 @@ Feature: Course updates As a course author, I want to be able to provide updates to my students + # Internet explorer can't select all so the update appears weirdly + @skip_internetexplorer Scenario: Users can add updates Given I have opened a new course in Studio And I go to the course updates page @@ -8,6 +10,8 @@ Feature: Course updates Then I should see the update "Hello" And I see a "saving" notification + # Internet explorer can't select all so the update appears weirdly + @skip_internetexplorer Scenario: Users can edit updates Given I have opened a new course in Studio And I go to the course updates page @@ -33,6 +37,8 @@ Feature: Course updates Then I should see the date "June 1, 2013" And I see a "saving" notification + # Internet explorer can't select all so the update appears weirdly + @skip_internetexplorer Scenario: Users can change handouts Given I have opened a new course in Studio And I go to the course updates page diff --git a/cms/djangoapps/contentstore/features/discussion-editor.feature b/cms/djangoapps/contentstore/features/discussion-editor.feature index 8fb14c3205..e4b1f5450b 100644 --- a/cms/djangoapps/contentstore/features/discussion-editor.feature +++ b/cms/djangoapps/contentstore/features/discussion-editor.feature @@ -6,6 +6,8 @@ Feature: Discussion Component Editor And I edit and select Settings Then I see three alphabetized settings and their expected values + # Safari doesn't save the name properly + @skip_safari Scenario: User can modify display name Given I have created a Discussion Tag And I edit and select Settings diff --git a/cms/djangoapps/contentstore/features/grading.feature b/cms/djangoapps/contentstore/features/grading.feature index 5cf5a72866..0b34feb7aa 100644 --- a/cms/djangoapps/contentstore/features/grading.feature +++ b/cms/djangoapps/contentstore/features/grading.feature @@ -13,7 +13,7 @@ Feature: Course Grading When I add "6" new grades Then I see I now have "5" grades - #Cannot reliably make the delete button appear so using javascript instead + # Cannot reliably make the delete button appear so using javascript instead Scenario: Users can delete grading ranges Given I have opened a new course in Studio And I am viewing the grading settings @@ -21,6 +21,9 @@ Feature: Course Grading And I delete a grade Then I see I now have "2" grades + # IE and Safari cannot reliably drag and drop through selenium + @skip_internetexplorer + @skip_safari Scenario: Users can move grading ranges Given I have opened a new course in Studio And I am viewing the grading settings @@ -85,6 +88,9 @@ Feature: Course Grading When I change assignment type "Homework" to "" Then the save button is disabled + # IE and Safari cannot type in grade range name + @skip_internetexplorer + @skip_safari Scenario: User can edit grading range names Given I have opened a new course in Studio And I have populated the course diff --git a/cms/djangoapps/contentstore/features/html-editor.feature b/cms/djangoapps/contentstore/features/html-editor.feature index 4cd5e1c1b9..4419d6018b 100644 --- a/cms/djangoapps/contentstore/features/html-editor.feature +++ b/cms/djangoapps/contentstore/features/html-editor.feature @@ -6,6 +6,8 @@ Feature: HTML Editor And I edit and select Settings Then I see only the HTML display name setting + # Safari doesn't save the name properly + @skip_safari Scenario: User can modify display name Given I have created a Blank HTML Page And I edit and select Settings diff --git a/cms/djangoapps/contentstore/features/problem-editor.feature b/cms/djangoapps/contentstore/features/problem-editor.feature index 50c49a1896..1296acec1c 100644 --- a/cms/djangoapps/contentstore/features/problem-editor.feature +++ b/cms/djangoapps/contentstore/features/problem-editor.feature @@ -7,12 +7,16 @@ Feature: Problem Editor Then I see five alphabetized settings and their expected values And Edit High Level Source is not visible + # Safari is having trouble saving the values on sauce + @skip_safari Scenario: User can modify String values Given I have created a Blank Common Problem When I edit and select Settings Then I can modify the display name And my display name change is persisted on save + # Safari is having trouble saving the values on sauce + @skip_safari Scenario: User can specify special characters in String values Given I have created a Blank Common Problem When I edit and select Settings @@ -25,6 +29,8 @@ Feature: Problem Editor Then I can revert the display name to unset And my display name is unset on save + # IE will not click the revert button properly + @skip_internetexplorer Scenario: User can select values in a Select Given I have created a Blank Common Problem When I edit and select Settings @@ -32,6 +38,8 @@ Feature: Problem Editor And my change to randomization is persisted And I can revert to the default value for randomization + # Safari will input it as 35. + @skip_safari Scenario: User can modify float input values Given I have created a Blank Common Problem When I edit and select Settings @@ -44,16 +52,22 @@ Feature: Problem Editor When I edit and select Settings Then if I set the weight to "abc", it remains unset + # Safari will input it as 234. + @skip_safari Scenario: User cannot type decimal values integer number field Given I have created a Blank Common Problem When I edit and select Settings Then if I set the max attempts to "2.34", it will persist as a valid integer + # Safari will input it incorrectly + @skip_safari Scenario: User cannot type out of range values in an integer number field Given I have created a Blank Common Problem When I edit and select Settings Then if I set the max attempts to "-3", it will persist as a valid integer + # Safari will input it as 35. + @skip_safari Scenario: Settings changes are not saved on Cancel Given I have created a Blank Common Problem When I edit and select Settings @@ -67,6 +81,8 @@ Feature: Problem Editor Then Edit High Level Source is visible # This feature will work in Firefox only when Firefox is the active window + # IE will not interact with the high level source in sauce labs + @skip_internetexplorer Scenario: High Level source is persisted for LaTeX problem (bug STUD-280) Given I have created a LaTeX Problem When I edit and compile the High Level Source diff --git a/cms/djangoapps/contentstore/features/static-pages.feature b/cms/djangoapps/contentstore/features/static-pages.feature index 9997df69f0..c1a8ec91fc 100644 --- a/cms/djangoapps/contentstore/features/static-pages.feature +++ b/cms/djangoapps/contentstore/features/static-pages.feature @@ -15,6 +15,8 @@ Feature: Static Pages And I "delete" the "Empty" page Then I should not see a "Empty" static page + # Safari won't update the name properly + @skip_safari Scenario: Users can edit static pages Given I have opened a new course in Studio And I go to the static pages page diff --git a/cms/djangoapps/contentstore/features/subsection.feature b/cms/djangoapps/contentstore/features/subsection.feature index 84755b3644..6703c60c3b 100644 --- a/cms/djangoapps/contentstore/features/subsection.feature +++ b/cms/djangoapps/contentstore/features/subsection.feature @@ -25,6 +25,8 @@ Feature: Create Subsection And I reload the page Then I see it marked as Homework + # Safari has trouble saving the date in Sauce + @skip_safari Scenario: Set a due date in a different year (bug #256) Given I have opened a new subsection in Studio And I set the subsection release date to 12/25/2011 03:00 diff --git a/cms/djangoapps/contentstore/features/textbooks.feature b/cms/djangoapps/contentstore/features/textbooks.feature index 0758a0b57b..36de10daa1 100644 --- a/cms/djangoapps/contentstore/features/textbooks.feature +++ b/cms/djangoapps/contentstore/features/textbooks.feature @@ -5,6 +5,9 @@ Feature: Textbooks When I go to the textbooks page Then I should see a message telling me to create a new textbook + # IE and Safari on sauce labs will not upload the textbook correctly resulting in an error + @skip_internetexplorer + @skip_safari Scenario: Create a textbook Given I have opened a new course in Studio And I go to the textbooks page diff --git a/cms/djangoapps/contentstore/features/upload.feature b/cms/djangoapps/contentstore/features/upload.feature index 8d40163685..441de597ea 100644 --- a/cms/djangoapps/contentstore/features/upload.feature +++ b/cms/djangoapps/contentstore/features/upload.feature @@ -1,6 +1,8 @@ Feature: Upload Files As a course author, I want to be able to upload files for my students + # Uploading isn't working on safari with sauce labs + @skip_safari Scenario: Users can upload files Given I have opened a new course in Studio And I go to the files and uploads page @@ -8,6 +10,8 @@ Feature: Upload Files Then I should see the file "test" was uploaded And The url for the file "test" is valid + # Uploading isn't working on safari with sauce labs + @skip_safari Scenario: Users can update files Given I have opened a new course in studio And I go to the files and uploads page @@ -15,6 +19,8 @@ Feature: Upload Files And I upload the file "test" Then I should see only one "test" + # Uploading isn't working on safari with sauce labs + @skip_safari Scenario: Users can delete uploaded files Given I have opened a new course in studio And I go to the files and uploads page @@ -23,12 +29,16 @@ Feature: Upload Files Then I should not see the file "test" was uploaded And I see a confirmation that the file was deleted + # Uploading isn't working on safari with sauce labs + @skip_safari Scenario: Users can download files Given I have opened a new course in studio And I go to the files and uploads page When I upload the file "test" Then I can download the correct "test" file + # Uploading isn't working on safari with sauce labs + @skip_safari Scenario: Users can download updated files Given I have opened a new course in studio And I go to the files and uploads page diff --git a/cms/djangoapps/contentstore/features/video-editor.feature b/cms/djangoapps/contentstore/features/video-editor.feature index 7117926c60..d238a7e523 100644 --- a/cms/djangoapps/contentstore/features/video-editor.feature +++ b/cms/djangoapps/contentstore/features/video-editor.feature @@ -6,6 +6,8 @@ Feature: Video Component Editor And I edit the component Then I see the correct video settings and default values + # Safari has trouble saving values on Sauce + @skip_safari Scenario: User can modify Video display name Given I have created a Video component And I edit the component diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature index 50c06fde63..d2f9915f55 100644 --- a/cms/djangoapps/contentstore/features/video.feature +++ b/cms/djangoapps/contentstore/features/video.feature @@ -10,15 +10,21 @@ Feature: Video Component Given I have clicked the new unit button Then creating a video takes a single click + # Sauce Labs cannot delete cookies + @skip_sauce Scenario: Captions are hidden correctly Given I have created a Video component And I have hidden captions Then when I view the video it does not show the captions + # Sauce Labs cannot delete cookies + @skip_sauce Scenario: Captions are shown correctly Given I have created a Video component Then when I view the video it does show the captions + # Sauce Labs cannot delete cookies + @skip_sauce Scenario: Captions are toggled correctly Given I have created a Video component And I have toggled captions diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 5820ad46f7..cf53aa4f69 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -119,7 +119,7 @@ def initial_setup(server): # If we were unable to get a valid session within the limit of attempts, # then we cannot run the tests. if not success: - raise IOError("Could not acquire valid {driver} browser session.".format(driver='remote')) + raise IOError("Could not acquire valid {driver} browser session.".format(driver=browser_driver)) world.browser.driver.set_window_size(1280, 1024) diff --git a/jenkins/test_acceptance.sh b/jenkins/test_acceptance.sh index aaa7cfc3da..c2f2fa4ce3 100755 --- a/jenkins/test_acceptance.sh +++ b/jenkins/test_acceptance.sh @@ -32,11 +32,15 @@ TESTS_FAILED=0 export DISPLAY=:1 SKIP_TESTS="" +# Testing for the existance of these environment variables if [ ! -z ${LETTUCE_BROWSER+x} ]; then SKIP_TESTS="--tag -skip_$LETTUCE_BROWSER" fi if [ ! -z ${SAUCE_ENABLED+x} ]; then - SKIP_TESTS="--tag -skip_sauce --tag -skip_$SAUCE_BROWSER" + # SAUCE_INFO is a - seperated string PLATFORM-BROWSER-VERSION-DEVICE + # Error checking is done in the setting up of the browser + IFS='-' read -a SAUCE <<< "${SAUCE_INFO}" + SKIP_TESTS="--tag -skip_sauce --tag -skip_${SAUCE[1]}" fi # Run the lms and cms acceptance tests diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 232e8b86b4..cf64404161 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -88,6 +88,9 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True # We do not yet understand why this occurs. Setting this to true is a stopgap measure USE_I18N = True +MITX_FEATURES['ENABLE_FEEDBACK_SUBMISSION'] = True +FEEDBACK_SUBMISSION_EMAIL = 'dummy@example.com' + # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('courseware',) diff --git a/lms/envs/sauce.py b/lms/envs/sauce.py index e4764f7cf8..8d48228251 100644 --- a/lms/envs/sauce.py +++ b/lms/envs/sauce.py @@ -27,6 +27,8 @@ DESIRED_CAPABILITIES = { 'android': DesiredCapabilities.ANDROID } +# All keys must be URL and JSON encodable +# PLATFORM-BROWSER-VERSION_NUM-DEVICE ALL_CONFIG = { 'Linux-chrome--': ['Linux', 'chrome', '', ''], 'Windows 8-chrome--': ['Windows 8', 'chrome', '', ''], @@ -45,15 +47,7 @@ ALL_CONFIG = { 'Windows 8-internetexplorer-10-': ['Windows 8', 'internetexplorer', '10', ''], } -#HACK -#This needs to be done because Jenkins needs to satisfy URLs, JSON, BASH, SAUCE, and PYTHON -#This is the simplest way to adhere to all of these requirements and still be readable -# PLATFORM-BROWSER-VERSION_NUM-DEVICE -DEFAULT_CONFIG = 'Linux-chrome--' - -SAUCE_CONFIG = os.environ.get('SAUCE_INFO', DEFAULT_CONFIG) - -SAUCE_INFO = ALL_CONFIG[SAUCE_CONFIG] +SAUCE_INFO = ALL_CONFIG.get(os.environ.get('SAUCE_INFO', 'Linux-chrome--')) # Information needed to utilize Sauce Labs. SAUCE = {