From b2480b5f00782cffa4020db8f493ca5b93192c8d Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Tue, 20 Aug 2013 10:43:05 -0400 Subject: [PATCH] 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',