Commit eb14a078 by JonahStanley

Added tests for course updates and handouts

parent 81b06d5c
Feature: Course updates
As a course author, I want to be able to provide updates to my students
Scenario: Users can add updates
Given I have opened a new course in Studio
And I go to the course updates page
When I add a new update
And I make the text "Hello"
Then I should see the update "Hello"
Scenario: Users can edit updates
Given I have opened a new course in Studio
And I go to the course updates page
When I add a new update
And I make the text "Hello"
And I click the "edit" button
And I make the text "Goodbye"
Then I should see the update "Goodbye"
Scenario: Users can delete updates
Given I have opened a new course in Studio
And I go to the course updates page
And I add a new update
And I make the text "Hello"
When I will confirm all alerts
And I click the "delete" button
Then I should not see the update "Hello"
Scenario: Users can edit update dates
Given I have opened a new course in Studio
And I go to the course updates page
And I add a new update
And I make the text "Hello"
When I click the "edit" button
And I make the date "June 1, 2013"
Then I should see the date "June 1, 2013"
Scenario: Users can change handouts
Given I have opened a new course in Studio
And I go to the course updates page
When I edit the handouts
And I make the text "<ol>Test</ol>"
Then I see the handout "Test"
#pylint: disable=C0111
#pylint: disable=W0621
from lettuce import world, step
from selenium.webdriver.common.keys import Keys
@step(u'I go to the course updates page')
def go_to_uploads(step):
menu_css = 'li.nav-course-courseware'
uploads_css = '.nav-course-courseware-updates'
world.css_find(menu_css).click()
world.css_find(uploads_css).click()
@step(u'I add a new update')
def add_update(step):
update_css = '.new-update-button'
world.css_find(update_css).click()
@step(u'I make the text "([^"]*)"$')
def change_text(step, text):
text_css = 'div.CodeMirror > div > textarea'
prev_css = 'div.CodeMirror-lines > div > div:last-child > pre'
all_lines = world.css_find(prev_css)
all_text = ''
for i in range(len(all_lines)):
all_text = all_lines[i].html
text_area = world.css_find(text_css)
for i in range(len(all_text)):
text_area._element.send_keys(Keys.END, Keys.BACK_SPACE)
text_area._element.send_keys(text)
save_css = '.save-button'
world.css_find(save_css).click()
@step(u'I should( not)? see the update "([^"]*)"$')
def check_update(step, doesnt, text):
update_css = '.update-contents'
update = world.css_find(update_css)
if doesnt:
assert len(update) == 0 or not text in update.html
else:
assert text in update.html
@step(u'I click the "([^"]*)" button$')
def click_button(step, edit_delete):
button_css = '.post-preview .%s-button' % edit_delete
world.css_find(button_css).click()
@step(u'I make the date "([^"]*)"$')
def change_date(step, new_date):
date_css = 'input.date'
date = world.css_find(date_css)
for i in range(len(date.value)):
date._element.send_keys(Keys.END, Keys.BACK_SPACE)
date._element.send_keys(new_date)
save_css = '.save-button'
world.css_find(save_css).click()
@step(u'I should see the date "([^"]*)"$')
def check_date(step, date):
date_css = '.date-display'
date_html = world.css_find(date_css)
assert date == date_html.html
@step(u'I edit the handouts')
def edit_handouts(step):
edit_css = '.course-handouts > .edit-button'
world.css_find(edit_css).click()
@step(u'I see the handout "([^"]*)"$')
def check_handout(step, handout):
handout_css = '.handouts-content'
handouts = world.css_find(handout_css)
assert handout in handouts.html
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