Add cukes for warning message when closing work package modal with changes

pull/1395/head
Ion Biziiac 11 years ago
parent 28848b06ec
commit a9ae0300d1
  1. 4
      features/step_definitions/custom_web_steps.rb
  2. 4
      features/step_definitions/timelines_then_steps.rb
  3. 14
      features/step_definitions/web_steps.rb
  4. 5
      features/support/env.rb
  5. 17
      features/timelines/timeline_modal_views.feature

@ -37,6 +37,10 @@ When /^I click(?:| on) "([^"]*)"$/ do |name|
click_link_or_button(name) click_link_or_button(name)
end end
When /^I click(?:| on) the div "([^"]*)"$/ do |name|
find("##{name}").click
end
When /^(?:|I )jump to [Pp]roject "([^\"]*)"$/ do |project| When /^(?:|I )jump to [Pp]roject "([^\"]*)"$/ do |project|
click_link('Projects') click_link('Projects')
# supports both variants of finding: by class and by id # supports both variants of finding: by class and by id

@ -74,6 +74,10 @@ Then(/^I should see a modal window$/) do
steps 'Then I should see a modal window with selector "#modalDiv"' steps 'Then I should see a modal window with selector "#modalDiv"'
end end
Then(/^I should not see a modal window$/) do
page.should_not have_selector("#modalDiv")
end
Then(/^(.*) in the modal$/) do |step| Then(/^(.*) in the modal$/) do |step|
step(step + ' in the iframe "modalIframe"') step(step + ' in the iframe "modalIframe"')
end end

@ -435,6 +435,11 @@ When /^(?:|I )click on the first button matching "([^"]*)"$/ do |button|
first(:button, button).click first(:button, button).click
end end
When /^(?:|I )click on the first anchor matching "([^"]*)"$/ do |anchor|
find(:xpath, "(//a[text()='#{anchor}'])[1]").click
end
def find_lowest_containing_element text, selector def find_lowest_containing_element text, selector
elements = [] elements = []
@ -473,3 +478,12 @@ end
Then(/^I should see a confirm dialog$/) do Then(/^I should see a confirm dialog$/) do
page.should have_selector("#confirm_dialog") page.should have_selector("#confirm_dialog")
end end
Then /^I confirm the JS confirm dialog$/ do
page.driver.browser.switch_to.alert.accept rescue Selenium::WebDriver::Error::NoAlertOpenError
end
Then /^I should see a JS confirm dialog$/ do
page.driver.browser.switch_to.alert.text.should_not be_nil
page.driver.browser.switch_to.alert.accept
end

@ -105,6 +105,11 @@ end
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature # See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
Cucumber::Rails::Database.javascript_strategy = :truncation Cucumber::Rails::Database.javascript_strategy = :truncation
# Remove any modal dialog remaining from the scenarios which finish in an unclean state
Before do |scenario|
page.driver.browser.switch_to.alert.accept rescue Selenium::WebDriver::Error::NoAlertOpenError
end
# Capybara.register_driver :selenium do |app| # Capybara.register_driver :selenium do |app|
# Capybara::Selenium::Driver.new(app, :browser => :chrome) # Capybara::Selenium::Driver.new(app, :browser => :chrome)
# end # end

@ -88,3 +88,20 @@ Feature: Timeline View Tests
When I ctrl-click on "#2" in the modal When I ctrl-click on "#2" in the modal
Then I should see "February" in the new window Then I should see "February" in the new window
Then I should see "Avocado Rincon" in the new window Then I should see "Avocado Rincon" in the new window
@javascript
Scenario: closing the modal window with changes should display a warning message
When the role "manager" may have the following rights:
| view_timelines |
| edit_timelines |
| view_work_packages |
| edit_work_packages |
And there is a timeline "Testline" for project "ecookbook"
And I go to the page of the timeline "Testline" of the project called "ecookbook"
And I wait for timeline to load table
And I click on the Planning Element with name "January"
And I click on the first anchor matching "Update" in the modal
And I fill in "work_package_notes" with "A new comment" in the modal
And I click on the div "ui-dialog-closer"
Then I confirm the JS confirm dialog
And I should not see a modal window

Loading…
Cancel
Save