Watir test for the rollback
This commit is contained in:
parent
7247e5ac99
commit
a9bf736cbd
1 changed files with 60 additions and 22 deletions
|
@ -80,19 +80,57 @@ class E2EInstikiTest < Test::Unit::TestCase
|
||||||
assert_match /Test Edit Page, revision 1/, ie.text
|
assert_match /Test Edit Page, revision 1/, ie.text
|
||||||
|
|
||||||
# subsequent revision by the anonymous author
|
# subsequent revision by the anonymous author
|
||||||
enter_markup('TestEditPage', 'Test Edit Page, revision 2')
|
enter_markup('TestEditPage', 'Test Edit Page, revision 1, altered')
|
||||||
assert_match /Test Edit Page, revision 2/, ie.text
|
assert_match /Test Edit Page, revision 1, altered/, ie.text
|
||||||
assert_match Regexp.new('Created on ' + date_pattern + ' by Anonymous Coward\?'), ie.text
|
assert_match Regexp.new('Created on ' + date_pattern + ' by Anonymous Coward\?'), ie.text
|
||||||
|
|
||||||
# revision by a named author
|
# revision by a named author
|
||||||
enter_markup('TestEditPage', 'Test Edit Page, revision 3', 'Author')
|
enter_markup('TestEditPage', 'Test Edit Page, revision 2', 'Author')
|
||||||
assert_match /Test Edit Page, revision 3/, ie.text
|
assert_match /Test Edit Page, revision 2/, ie.text
|
||||||
assert_match Regexp.new('Revised on ' + date_pattern + ' by Author\?'), ie.text
|
assert_match Regexp.new('Revised on ' + date_pattern + ' by Author\?'), ie.text
|
||||||
|
|
||||||
link_to_previous_revision = ie.link(:name, 'to_previous_revision')
|
link_to_previous_revision = ie.link(:name, 'to_previous_revision')
|
||||||
assert_equal url(:revision, 'TestEditPage') + '?rev=0', link_to_previous_revision.href
|
assert_equal url(:revision, 'TestEditPage', 0), link_to_previous_revision.href
|
||||||
assert_equal 'Back in time', link_to_previous_revision.text
|
assert_equal 'Back in time', link_to_previous_revision.text
|
||||||
assert_match /Edit \| Back in time \(1 revisions\) \| See changes/, ie.text
|
assert_match /Edit \| Back in time \(1 revisions\) \| See changes/, ie.text
|
||||||
|
|
||||||
|
# another anonymous revision
|
||||||
|
enter_markup('TestEditPage', 'Test Edit Page, revision 3')
|
||||||
|
assert_match /Test Edit Page, revision 3/, ie.text
|
||||||
|
assert_match /Edit \| Back in time \(2 revisions\) \| See changes \| Hide changes /, ie.text
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_00040_traversing_revisions
|
||||||
|
ie.goto url(:revision, 'TestEditPage', 1)
|
||||||
|
assert_match /Test Edit Page, revision 2/, ie.text
|
||||||
|
assert_match(Regexp.new(
|
||||||
|
'Forward in time \(1 more\) \| Back in time \(1 more\) \| ' +
|
||||||
|
'See current \| See changes \| Hide changes \| Rollback'),
|
||||||
|
ie.text)
|
||||||
|
|
||||||
|
ie.link(:name, 'to_previous_revision').click
|
||||||
|
assert_match /Test Edit Page, revision 1, altered/, ie.text
|
||||||
|
assert_match /Forward in time \(2 more\) \| See current \| Rollback/, ie.text
|
||||||
|
|
||||||
|
ie.link(:name, 'to_next_revision').click
|
||||||
|
assert_match /Test Edit Page, revision 2/, ie.text
|
||||||
|
|
||||||
|
ie.link(:name, 'to_next_revision').click
|
||||||
|
assert_match /Test Edit Page, revision 3/, ie.text
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_00050_rollback
|
||||||
|
ie.goto url(:revision, 'TestEditPage', 1)
|
||||||
|
assert_match /Test Edit Page, revision 2/, ie.text
|
||||||
|
ie.link(:name, 'rollback').click
|
||||||
|
assert_equal url(:rollback, 'TestEditPage', 1), ie.url
|
||||||
|
assert_equal 'Test Edit Page, revision 2', ie.text_field(:name, 'content').value
|
||||||
|
|
||||||
|
ie.text_field(:name, 'content').set('Test Edit Page, revision 2, rolled back')
|
||||||
|
ie.button(:value, 'Update').click
|
||||||
|
|
||||||
|
assert_equal url(:show, 'TestEditPage'), ie.url
|
||||||
|
assert_match /Test Edit Page, revision 2, rolled back/, ie.text
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -162,10 +200,10 @@ class E2EInstikiTest < Test::Unit::TestCase
|
||||||
assert_equal url(:show, 'HomePage'), ie.url
|
assert_equal url(:show, 'HomePage'), ie.url
|
||||||
end
|
end
|
||||||
|
|
||||||
def url(operation, page_name = nil)
|
def url(operation, page_name = nil, revision = nil)
|
||||||
case operation
|
case operation
|
||||||
when :edit, :new, :show, :print, :revision
|
when :edit, :new, :show, :print, :revision, :rollback
|
||||||
"#{HOME}/wiki/#{operation}/#{page_name}"
|
"#{HOME}/wiki/#{operation}/#{page_name}" + (revision ? "?rev=#{revision}" : '')
|
||||||
else
|
else
|
||||||
raise "Unsupported operation: '#{operation}"
|
raise "Unsupported operation: '#{operation}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue