Replaced lettuce tests with bokchoy tests for the course updates page and improved flaky test issues.

TNL-5051
This commit is contained in:
Albert St. Aubin
2016-08-03 07:42:01 -04:00
parent d2788ff2f1
commit b63bfbd5dd
4 changed files with 268 additions and 131 deletions

View File

@@ -2,46 +2,6 @@
Feature: CMS.Course updates
As a course author, I want to be able to provide updates to my students
# Commenting out as flaky TNL-5051 07/20/2016
# 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
# When I add a new update with the text "Hello"
# Then I should see the update "Hello"
# And I see a "saving" notification
# Commenting out as flaky TNL-5051 07/20/2016
# # 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
# When I add a new update with the text "Hello"
# And I modify the text to "Goodbye"
# Then I should see the update "Goodbye"
# And I see a "saving" notification
# Commenting out as flaky TNL-5051 07/20/2016
# 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 with the text "Hello"
# And I delete the update
# And I confirm the prompt
# Then I should not see the update "Hello"
# And I see a "deleting" notification
# Commenting out as flaky TNL-5051 07/20/2016
# 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 with the text "Hello"
# When I edit the date to "06/01/13"
# 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
@@ -51,26 +11,6 @@ Feature: CMS.Course updates
Then I see the handout "Test"
And I see a "saving" notification
Scenario: Text outside of tags is preserved
Given I have opened a new course in Studio
And I go to the course updates page
When I add a new update with the text "before <strong>middle</strong> after"
Then I should see the update "before <strong>middle</strong> after"
And when I reload the page
Then I should see the update "before <strong>middle</strong> after"
# Commenting out as flaky TNL-5051 07/22/2016
# Scenario: Static links are rewritten when previewing a course update
# Given I have opened a new course in Studio
# And I go to the course updates page
# When I add a new update with the text "<img src='/static/my_img.jpg'/>"
# # Can only do partial text matches because of the quotes with in quotes (and regexp step matching).
# Then I should see the asset update to "my_img.jpg"
# And I change the update from "/static/my_img.jpg" to "<img src='/static/modified.jpg'/>"
# Then I should see the asset update to "modified.jpg"
# And when I reload the page
# Then I should see the asset update to "modified.jpg"
Scenario: Static links are rewritten when previewing handouts
Given I have opened a new course in Studio
And I go to the course updates page

View File

@@ -1,8 +1,7 @@
# pylint: disable=missing-docstring
from cms.djangoapps.contentstore.features.common import type_in_codemirror, get_codemirror_value
from lettuce import world, step
from selenium.webdriver.common.keys import Keys
from common import type_in_codemirror, get_codemirror_value
from nose.tools import assert_in
@@ -15,77 +14,11 @@ def go_to_updates(_step):
world.wait_for_visible('#course-handouts-view')
@step(u'I add a new update with the text "([^"]*)"$')
def add_update(_step, text):
update_css = '.new-update-button'
world.css_click(update_css)
world.wait_for_visible('.CodeMirror')
change_text(text)
@step(u'I should see the update "([^"]*)"$')
def check_update(_step, text):
update_css = 'div.update-contents'
update_html = world.css_find(update_css).html
assert_in(text, update_html)
@step(u'I should see the asset update to "([^"]*)"$')
def check_asset_update(_step, asset_file):
update_css = 'div.update-contents'
update_html = world.css_find(update_css).html
asset_key = world.scenario_dict['COURSE'].id.make_asset_key(asset_type='asset', path=asset_file)
assert_in(unicode(asset_key), update_html)
@step(u'I should not see the update "([^"]*)"$')
def check_no_update(_step, text):
update_css = 'div.update-contents'
assert world.is_css_not_present(update_css)
@step(u'I modify the text to "([^"]*)"$')
def modify_update(_step, text):
button_css = 'div.post-preview .edit-button'
world.css_click(button_css)
change_text(text)
@step(u'I change the update from "([^"]*)" to "([^"]*)"$')
def change_existing_update(_step, before, after):
verify_text_in_editor_and_update('div.post-preview .edit-button', before, after)
@step(u'I change the handout from "([^"]*)" to "([^"]*)"$')
def change_existing_handout(_step, before, after):
verify_text_in_editor_and_update('div.course-handouts .edit-button', before, after)
@step(u'I delete the update$')
def click_button(_step):
button_css = 'div.post-preview .delete-button'
world.css_click(button_css)
@step(u'I edit the date to "([^"]*)"$')
def change_date(_step, new_date):
button_css = 'div.post-preview .edit-button'
world.css_click(button_css)
date_css = 'input.date'
date = world.css_find(date_css)
for __ 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_click(save_css)
@step(u'I should see the date "([^"]*)"$')
def check_date(_step, date):
date_css = 'span.date-display'
assert_in(date, world.css_html(date_css))
@step(u'I modify the handout to "([^"]*)"$')
def edit_handouts(_step, text):
edit_css = 'div.course-handouts > .edit-button'