From 2cd0f6ce542461ece2ba987ab98dc0153eadc82b Mon Sep 17 00:00:00 2001 From: David Cardwell Date: Thu, 5 Mar 2015 17:41:03 -0500 Subject: [PATCH] Add integration test for the history page Test if visiting the history page and clicking "Preview Message" works and brings up the modal dialog. Also test closing the dialog. --- test/selenium/specs/tc_history.rb | 48 +++++++++++++++++++++++++++++ test/selenium/specs/ts_all_specs.rb | 1 + 2 files changed, 49 insertions(+) create mode 100644 test/selenium/specs/tc_history.rb diff --git a/test/selenium/specs/tc_history.rb b/test/selenium/specs/tc_history.rb new file mode 100644 index 0000000..14ec0dc --- /dev/null +++ b/test/selenium/specs/tc_history.rb @@ -0,0 +1,48 @@ +#Test the history page +class TestHistory < Test::Unit::TestCase + + # Helps perform authentication with the content server + require_relative "auth_helper" + + include AuthHelper # Helps with login/logout + include Capybara::DSL # Provides for Webdriving + + def setup + page.driver.browser.get(@@privly_test_set[0][:url]) + login(@@privly_test_set[0][:content_server]) + + #Create a message to test with + click_on ('New Message') + fill_in 'content', :with => "Hello WebDriver!" + click_on ('save') + end + + def test_preview_button + #Navigate to the history page + click_on ('History') + assert page.has_text?("History") + assert page.has_text?("Created") + assert page.has_text?("Burnt After") + assert page.has_text?("Updated") + + #Click the first preview button link + find(".btn", match: :first).click + modal_dialog = page.find(:css,".modal-dialog") + assert modal_dialog.visible? + assert page.has_text?("Hide Preview") + assert page.has_text?("Destroy Content") + + #Close the pop-up and make sure that it closed + click_on ('Hide Preview') + assert page.has_no_text?("Hide Preview") + assert page.has_no_text?("Destroy Content") + end + + def teardown + page.driver.browser.get(@@privly_test_set[0][:url]) + logout + Capybara.reset_sessions! + Capybara.use_default_driver + end + +end diff --git a/test/selenium/specs/ts_all_specs.rb b/test/selenium/specs/ts_all_specs.rb index 44a101d..e145bec 100644 --- a/test/selenium/specs/ts_all_specs.rb +++ b/test/selenium/specs/ts_all_specs.rb @@ -3,3 +3,4 @@ require_relative "tc_show" require_relative "tc_show_injected" require_relative "tc_extension_options" +require_relative "tc_history"