From 44e1ff7a6ce3329f747cb6a52c91bc47a0c8c93c Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Wed, 20 Aug 2014 14:59:46 -0300 Subject: removing fake service --- .../features/step_definitions/compose.rb | 27 --------- .../features/step_definitions/mail_list.rb | 55 ------------------ .../features/step_definitions/mail_view.rb | 67 ---------------------- .../features/step_definitions/search.rb | 12 ---- .../features/step_definitions/tag_list.rb | 15 ----- py-fake-service/features/support/env.rb | 31 ---------- 6 files changed, 207 deletions(-) delete mode 100644 py-fake-service/features/step_definitions/compose.rb delete mode 100644 py-fake-service/features/step_definitions/mail_list.rb delete mode 100644 py-fake-service/features/step_definitions/mail_view.rb delete mode 100644 py-fake-service/features/step_definitions/search.rb delete mode 100644 py-fake-service/features/step_definitions/tag_list.rb delete mode 100644 py-fake-service/features/support/env.rb (limited to 'py-fake-service') diff --git a/py-fake-service/features/step_definitions/compose.rb b/py-fake-service/features/step_definitions/compose.rb deleted file mode 100644 index e92d16f6..00000000 --- a/py-fake-service/features/step_definitions/compose.rb +++ /dev/null @@ -1,27 +0,0 @@ -Given /^I compose a message with$/ do |table| - find('#compose-mails-trigger').click - data = table.hashes.first - fill_in('Subject', with: data['subject']) - fill_in('Body', with: data['body']) -end - -Given /^for the '(.*)' field I type '(.*)' and chose the first contact that shows$/ do |recipients_field, to_type| - recipients_field.downcase! - within("#recipients-#{recipients_field}-area") do - find('.tt-input').native.send_keys(to_type) - sleep 1 - first('.tt-dropdown-menu div div').click - end -end - -Given /^I save the draft$/ do - click_button("Save Draft") -end - -When /^I open the saved draft and send it$/ do - step "I select the tag 'drafts'" - step "I open the first mail in the mail list" - page.should_not have_css("#send-button[disabled]") - click_button('Send') - find('#user-alerts').should have_content("Your message was sent!") -end diff --git a/py-fake-service/features/step_definitions/mail_list.rb b/py-fake-service/features/step_definitions/mail_list.rb deleted file mode 100644 index d41a62a0..00000000 --- a/py-fake-service/features/step_definitions/mail_list.rb +++ /dev/null @@ -1,55 +0,0 @@ -When(/^I open the first mail in the '(.*)'$/) do |tag| - page.execute_script("window.scrollBy(0, -200)") - step "I select the tag '#{tag}'" - step 'I open the first mail in the mail list' -end - -When(/^I open the first mail in the mail list$/) do - within('#mail-list') do - mail_link = first('a') - @current_mail_id = mail_link.native.attribute('href').scan(/\/(\d+)$/).flatten.first - begin - mail_link.click - rescue # in Chrome, the 'a' in mail_list is not clickable because it's hidden inside the 'li' - mail_link_parent_li = mail_link.find(:xpath, '../..') - mail_link_parent_li.click - end - end -end - -When(/I see that mail under the '(.*)' tag/) do |tag| - step "I select the tag '#{tag}'" - check_current_mail_is_visible -end - -And(/^I open the mail I previously tagged$/) do - open_current_mail -end - -When(/^I open that mail$/) do - open_current_mail -end - -Then(/^I see the mail I sent$/) do - check_current_mail_is_visible -end - -Then(/^the deleted mail is there$/) do - check_current_mail_is_visible -end - -def open_current_mail - within('#mail-list') do - begin - first("#mail-#{@current_mail_id} a").click - rescue # in Chrome, the 'a' in mail_list is not clickable because it's hidden inside the 'li' - first("#mail-#{@current_mail_id}").click - end - end -end - -def check_current_mail_is_visible - within('#mail-list') do - have_selector?("#mail-#{@current_mail_id}").should be_true - end -end diff --git a/py-fake-service/features/step_definitions/mail_view.rb b/py-fake-service/features/step_definitions/mail_view.rb deleted file mode 100644 index 19ca5736..00000000 --- a/py-fake-service/features/step_definitions/mail_view.rb +++ /dev/null @@ -1,67 +0,0 @@ -A_MAIL = /[^\s@]+@[^\s@]+\.[^\s@]+/ - -Then(/^I see the mail has a cc and a bcc recipient$/) do - within('.msg-header') do - first('.cc').text.should =~ A_MAIL - first('.bcc').text.should =~ A_MAIL - end -end - -Then(/^that email has the '(.*)' tag$/) do |tag| - within('#mail-view') do |e| - all('.tagsArea .tag').map(&:text).map(&:downcase).to_a.should include(tag) - end -end - -When(/I add the tag '(.*)' to that mail/) do |tag| - page.execute_script("$('#new-tag-button').click();") - page.execute_script("$('#new-tag-input').val('#{tag}');") - find('#new-tag-input').native.send_keys [:return] -end - -And(/^I reply to it$/) do - click_button('Reply') - click_button('Send') -end - -Then(/^I choose to forward this mail$/) do - click_button('Forward') -end - -Then(/^I forward this mail$/) do - click_button('Send') -end - - -Then(/^I remove all tags$/) do - within('.tagsArea') do - all('.tag').each do |tag| - tag.click - end - end -end - -Then(/^I choose to trash$/) do - click_button('Trash message') -end - -When(/^I try to delete the first mail$/) do - step 'I open the first mail in the mail list' - within('#mail-view') do - page.driver.find_css('#view-more-actions')[0].click - page.driver.execute_script("$('#delete-button-top').click();") - end - find('#user-alerts').text.should == 'Your message was moved to trash!' -end - -Then(/^I see that the subject reads '(.*)'$/) do |expected_subject| - find('#mail-view .subject').text.should == expected_subject -end - -Then(/^I see that the body reads '(.*)'$/) do |expected_body| - find('#mail-view .bodyArea').text.should == expected_body -end - -Then(/^I see if the mail has html content/) do - find('#mail-view .bodyArea').should have_css('h2[style*=\'color: #3f4944\']', :text => "cborim") -end diff --git a/py-fake-service/features/step_definitions/search.rb b/py-fake-service/features/step_definitions/search.rb deleted file mode 100644 index de89759c..00000000 --- a/py-fake-service/features/step_definitions/search.rb +++ /dev/null @@ -1,12 +0,0 @@ -When(/^I search for a mail with the words "(.*)"$/) do |search_term| - search_field = find('#search-trigger input[type="search"]').native - search_field.send_keys(search_term) - search_field.send_keys(:return) -end - -Then(/^I see one or more mails in the search results$/) do - within('#mail-list') do - all('li').length.should >= 1 - end -end - diff --git a/py-fake-service/features/step_definitions/tag_list.rb b/py-fake-service/features/step_definitions/tag_list.rb deleted file mode 100644 index 678f5ce9..00000000 --- a/py-fake-service/features/step_definitions/tag_list.rb +++ /dev/null @@ -1,15 +0,0 @@ -When(/^I select the tag '(.*)'$/) do |tag| - wait_for_user_alert_to_disapear # in Chrome, the 'flash message is on top of the toggle - first('.left-off-canvas-toggle').click - page.execute_script("window.scrollBy(0, -200)") - within('#tag-list') { find('li', text: /#{tag}/i).click } -end - -def wait_for_user_alert_to_disapear - begin - while find('#user-alerts') - sleep 0.1 - end - rescue #if it couldn't find it, go ahead - end -end diff --git a/py-fake-service/features/support/env.rb b/py-fake-service/features/support/env.rb deleted file mode 100644 index 2386da9b..00000000 --- a/py-fake-service/features/support/env.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'capybara' -require 'capybara-screenshot' -require 'capybara-screenshot/cucumber' - -RACK_PORT = ENV['RACK_PORT'] || '4567' -HOST = "http://localhost:#{RACK_PORT}" - -Capybara.register_driver :selenium_chrome do |app| - Capybara::Selenium::Driver.new(app, :browser => :firefox) -end - -Capybara::Screenshot.register_driver(:selenium_chrome) do |driver, path| - driver.browser.save_screenshot(path) -end - -driver = ENV['CUCUMBER_DRIVER'] ? ENV['CUCUMBER_DRIVER'].to_sym : :selenium_chrome - -Capybara.configure do |config| - config.run_server = false - config.default_driver = driver - config.app_host = HOST -end - -include Capybara::DSL - -Before do - #{ }`curl -d '' #{HOST}/control/mailset/mediumtagged/load` - sleep 3 - visit '/?lang=en' - page.driver.browser.manage.window.maximize -end -- cgit v1.2.3