Commit 27d5ebf0 by Will Daly

pep8 fixes

parent 00d25b68
Feature: Advanced (manual) course policy Feature: Advanced (manual) course policy
In order to specify course policy settings for which no custom user interface exists 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 I want to be able to manually enter JSON key /value pairs
Scenario: A course author sees default advanced settings Scenario: A course author sees default advanced settings
Given I have opened a new course in Studio Given I have opened a new course in Studio
...@@ -27,16 +27,16 @@ Feature: Advanced (manual) course policy ...@@ -27,16 +27,16 @@ Feature: Advanced (manual) course policy
And I reload the page And I reload the page
Then the policy key value is changed Then the policy key value is changed
Scenario: Test how multi-line input appears Scenario: Test how multi -line input appears
Given I am on the Advanced Course Settings page in Studio Given I am on the Advanced Course Settings page in Studio
When I create a JSON object as a value When I create a JSON object as a value
Then it is displayed as formatted Then it is displayed as formatted
And I reload the page And I reload the page
Then it is displayed as formatted Then it is displayed as formatted
Scenario: Test automatic quoting of non-JSON values Scenario: Test automatic quoting of non -JSON values
Given I am on the Advanced Course Settings page in Studio Given I am on the Advanced Course Settings page in Studio
When I create a non-JSON value not in quotes When I create a non -JSON value not in quotes
Then it is displayed as a string Then it is displayed as a string
And I reload the page And I reload the page
Then it is displayed as a string Then it is displayed as a string
...@@ -16,6 +16,7 @@ DISPLAY_NAME_KEY = "display_name" ...@@ -16,6 +16,7 @@ DISPLAY_NAME_KEY = "display_name"
DISPLAY_NAME_VALUE = '"Robot Super Course"' DISPLAY_NAME_VALUE = '"Robot Super Course"'
############### ACTIONS #################### ############### ACTIONS ####################
@step('I select the Advanced Settings$') @step('I select the Advanced Settings$')
def i_select_advanced_settings(step): def i_select_advanced_settings(step):
expand_icon_css = 'li.nav-course-settings i.icon-expand' expand_icon_css = 'li.nav-course-settings i.icon-expand'
......
...@@ -10,6 +10,7 @@ from logging import getLogger ...@@ -10,6 +10,7 @@ from logging import getLogger
logger = getLogger(__name__) logger = getLogger(__name__)
########### STEP HELPERS ############## ########### STEP HELPERS ##############
@step('I (?:visit|access|open) the Studio homepage$') @step('I (?:visit|access|open) the Studio homepage$')
def i_visit_the_studio_homepage(step): def i_visit_the_studio_homepage(step):
# To make this go to port 8001, put # To make this go to port 8001, put
......
...@@ -43,6 +43,7 @@ def i_see_the_course_in_my_courses(step): ...@@ -43,6 +43,7 @@ def i_see_the_course_in_my_courses(step):
course_css = 'span.class-name' course_css = 'span.class-name'
assert world.css_has_text(course_css, 'Robot Super Course') assert world.css_has_text(course_css, 'Robot Super Course')
@step('the course is loaded$') @step('the course is loaded$')
def course_is_loaded(step): def course_is_loaded(step):
class_css = 'a.class-name' class_css = 'a.class-name'
......
...@@ -112,7 +112,7 @@ def the_section_release_date_picker_not_visible(step): ...@@ -112,7 +112,7 @@ def the_section_release_date_picker_not_visible(step):
def the_section_release_date_is_updated(step): def the_section_release_date_is_updated(step):
css = 'span.published-status' css = 'span.published-status'
status_text = world.css_text(css) status_text = world.css_text(css)
assert_equal(status_text,'Will Release: 12/25/2013 at 12:00am') assert_equal(status_text, 'Will Release: 12/25/2013 at 12:00am')
############ HELPER METHODS ################### ############ HELPER METHODS ###################
......
...@@ -20,6 +20,7 @@ def i_press_the_button_on_the_registration_form(step): ...@@ -20,6 +20,7 @@ def i_press_the_button_on_the_registration_form(step):
e = world.css_find(submit_css) e = world.css_find(submit_css)
e.type(' ') e.type(' ')
@step('I should see be on the studio home page$') @step('I should see be on the studio home page$')
def i_should_see_be_on_the_studio_home_page(step): def i_should_see_be_on_the_studio_home_page(step):
assert world.browser.find_by_css('div.inner-wrapper') assert world.browser.find_by_css('div.inner-wrapper')
......
...@@ -9,7 +9,7 @@ Feature: Overview Toggle Section ...@@ -9,7 +9,7 @@ Feature: Overview Toggle Section
Then I see the "Collapse All Sections" link Then I see the "Collapse All Sections" link
And all sections are expanded And all sections are expanded
Scenario: Expand/collapse for a course with no sections Scenario: Expand /collapse for a course with no sections
Given I have a course with no sections Given I have a course with no sections
When I navigate to the course overview page When I navigate to the course overview page
Then I do not see the "Collapse All Sections" link Then I do not see the "Collapse All Sections" link
...@@ -21,7 +21,7 @@ Feature: Overview Toggle Section ...@@ -21,7 +21,7 @@ Feature: Overview Toggle Section
Then I see the "Collapse All Sections" link Then I see the "Collapse All Sections" link
And all sections are expanded And all sections are expanded
@skip-phantom @skip -phantom
Scenario: Collapse link is not removed after last section of a course is deleted Scenario: Collapse link is not removed after last section of a course is deleted
Given I have a course with 1 section Given I have a course with 1 section
And I navigate to the course overview page And I navigate to the course overview page
......
...@@ -72,6 +72,7 @@ def save_subsection_name(name): ...@@ -72,6 +72,7 @@ def save_subsection_name(name):
world.css_fill(name_css, name) world.css_fill(name_css, name)
world.css_click(save_css) world.css_click(save_css)
def see_subsection_name(name): def see_subsection_name(name):
css = 'span.subsection-name' css = 'span.subsection-name'
assert world.is_css_present(css) assert world.is_css_present(css)
......
...@@ -122,6 +122,7 @@ def save_the_course_content(path='/tmp'): ...@@ -122,6 +122,7 @@ def save_the_course_content(path='/tmp'):
f.write(output) f.write(output)
f.close f.close
@world.absorb @world.absorb
def clear_courses(): def clear_courses():
# Flush and initialize the module store # Flush and initialize the module store
......
...@@ -29,11 +29,13 @@ def i_visit_the_homepage(step): ...@@ -29,11 +29,13 @@ def i_visit_the_homepage(step):
world.visit('/') world.visit('/')
assert world.is_css_present('header.global') assert world.is_css_present('header.global')
@step(u'I (?:visit|access|open) the dashboard$') @step(u'I (?:visit|access|open) the dashboard$')
def i_visit_the_dashboard(step): def i_visit_the_dashboard(step):
world.visit('/dashboard') world.visit('/dashboard')
assert world.is_css_present('section.container.dashboard') assert world.is_css_present('section.container.dashboard')
@step('I should be on the dashboard page$') @step('I should be on the dashboard page$')
def i_should_be_on_the_dashboard(step): def i_should_be_on_the_dashboard(step):
assert world.is_css_present('section.container.dashboard') assert world.is_css_present('section.container.dashboard')
...@@ -97,6 +99,7 @@ def i_am_staff_for_course_by_id(step, course_id): ...@@ -97,6 +99,7 @@ def i_am_staff_for_course_by_id(step, course_id):
def click_the_link_called(step, text): def click_the_link_called(step, text):
world.click_link(text) world.click_link(text)
@step(r'should see that the url is "([^"]*)"$') @step(r'should see that the url is "([^"]*)"$')
def should_have_the_url(step, url): def should_have_the_url(step, url):
assert_equals(world.browser.url, url) assert_equals(world.browser.url, url)
......
...@@ -12,10 +12,12 @@ from lettuce.django import django_url ...@@ -12,10 +12,12 @@ from lettuce.django import django_url
def wait(seconds): def wait(seconds):
time.sleep(float(seconds)) time.sleep(float(seconds))
@world.absorb @world.absorb
def wait_for(func): def wait_for(func):
WebDriverWait(world.browser.driver, 5).until(func) WebDriverWait(world.browser.driver, 5).until(func)
@world.absorb @world.absorb
def visit(url): def visit(url):
world.browser.visit(django_url(url)) world.browser.visit(django_url(url))
...@@ -30,19 +32,22 @@ def url_equals(url): ...@@ -30,19 +32,22 @@ def url_equals(url):
def is_css_present(css_selector): def is_css_present(css_selector):
return world.browser.is_element_present_by_css(css_selector, wait_time=4) return world.browser.is_element_present_by_css(css_selector, wait_time=4)
@world.absorb @world.absorb
def css_has_text(css_selector, text): def css_has_text(css_selector, text):
return world.css_text(css_selector) == text return world.css_text(css_selector) == text
@world.absorb @world.absorb
def css_find(css): def css_find(css):
def is_visible(driver): def is_visible(driver):
return EC.visibility_of_element_located((By.CSS_SELECTOR,css,)) return EC.visibility_of_element_located((By.CSS_SELECTOR, css,))
world.browser.is_element_present_by_css(css, 5) world.browser.is_element_present_by_css(css, 5)
wait_for(is_visible) wait_for(is_visible)
return world.browser.find_by_css(css) return world.browser.find_by_css(css)
@world.absorb @world.absorb
def css_click(css_selector): def css_click(css_selector):
''' '''
...@@ -61,6 +66,7 @@ def css_click(css_selector): ...@@ -61,6 +66,7 @@ def css_click(css_selector):
time.sleep(1) time.sleep(1)
world.browser.find_by_css(css_selector).click() world.browser.find_by_css(css_selector).click()
@world.absorb @world.absorb
def css_click_at(css, x=10, y=10): def css_click_at(css, x=10, y=10):
''' '''
...@@ -72,6 +78,7 @@ def css_click_at(css, x=10, y=10): ...@@ -72,6 +78,7 @@ def css_click_at(css, x=10, y=10):
e.action_chains.click() e.action_chains.click()
e.action_chains.perform() e.action_chains.perform()
@world.absorb @world.absorb
def css_fill(css_selector, text): def css_fill(css_selector, text):
world.browser.find_by_css(css_selector).first.fill(text) world.browser.find_by_css(css_selector).first.fill(text)
......
...@@ -3,7 +3,7 @@ Feature: All the high level tabs should work ...@@ -3,7 +3,7 @@ Feature: All the high level tabs should work
As a student As a student
I want to navigate through the high level tabs I want to navigate through the high level tabs
Scenario: I can navigate to all high -level tabs in a course Scenario: I can navigate to all high - level tabs in a course
Given: I am registered for the course "6.002x" Given: I am registered for the course "6.002x"
And The course "6.002x" has extra tab "Custom Tab" And The course "6.002x" has extra tab "Custom Tab"
And I am logged in And I am logged in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment