From 4c2ccd01d4b04a77b5112ad5376a306d62fec996 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Mon, 4 Mar 2013 23:34:29 -0300 Subject: [PATCH] Fixed test: features/manage_product_price_details.feature --- features/manage_product_price_details.feature | 21 +++++++++++---------- features/step_definitions/custom_web_steps.rb | 8 ++++++++ features/step_definitions/noosfero_steps.rb | 4 +++- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/features/manage_product_price_details.feature b/features/manage_product_price_details.feature index a6d0a19..5418ee4 100644 --- a/features/manage_product_price_details.feature +++ b/features/manage_product_price_details.feature @@ -51,9 +51,9 @@ Feature: manage product price details And I follow "Price composition" And I follow "Describe here the cost of production" And I follow "New cost" - And I select "Taxes" + And I select "Taxes" from "price_details__production_cost_id" within "#display-product-price-details" And I fill in "$" with "5.00" - And I leave the ".price-details-price" field + And I leave the "#price_details__price" field And I press "Save" Then I should not see "Save" And I should see "Describe here the cost of production" @@ -67,15 +67,15 @@ Feature: manage product price details And I follow "Price composition" And I follow "Describe here the cost of production" And I follow "New cost" - And I select "Taxes" + And I select "Taxes" from "price_details__production_cost_id" within "#display-product-price-details" And I fill in "$" with "20.00" And I leave the ".price-details-price" field And I press "Save" Then I should not see "Save" And I should see "Taxes" within "#display-price-details" When I follow "Describe here the cost of production" - And I select "Energy" - And I leave the ".price-details-price" field + And I select "Energy" from "price_details__production_cost_id" within "#display-product-price-details" + And I leave the "#price_details__price" field And I press "Save" And I should not see "Taxes" within "#display-price-details" And I should see "Energy" within "#display-price-details" @@ -102,7 +102,7 @@ Feature: manage product price details And I follow "Price composition" And I follow "Describe here the cost of production" And I follow "New cost" - And I select "Taxes" + And I select "Taxes" from "price_details__production_cost_id" within "#display-product-price-details" And I fill in "$" with "20.00" And I press "Save" Then I should see "Inputs" within ".price-detail-name" @@ -114,10 +114,10 @@ Feature: manage product price details And I follow "Price composition" And I follow "Describe here the cost of production" And I follow "New cost" + And I select "Other cost" from "price_details__production_cost_id" within "#display-product-price-details" And I want to add "Energy" as cost - And I select "Other cost" And I fill in "$" with "10.00" - And I leave the ".price-details-price" field + And I leave the "#price_details__price" field And I press "Save" When I follow "Describe here the cost of production" Then I should see "Energy" within ".production-cost-selection" @@ -127,8 +127,9 @@ Feature: manage product price details Given I go to Rede Moinho's page of product Abbey Road And I follow "Price composition" And I follow "Describe here the cost of production" + And I follow "New cost" + And I select "Other cost" from "price_details__production_cost_id" within "#display-product-price-details" And I want to add "Energy" as cost - And I select "Other cost" Then I should see "Energy" within "#new-cost-fields" @selenium @@ -160,7 +161,7 @@ Feature: manage product price details Then I should see "$ 60.00 of $ 80.00" within "#progressbar-text" And I follow "New cost" And I fill in "$" with "10.00" - And I leave the ".price-details-price" field + And I leave the "#price_details__price" field Then I should see "$ 70.00 of $ 80.00" within "#progressbar-text" @selenium diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index bdc3231..e693537 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -36,3 +36,11 @@ When /^I reload and wait for the page$/ do raise "Why why need this? Remove!" visit page.driver.browser.current_url end + +When /^I leave the "([^\"]+)" field$/ do |selector| + page.execute_script "jQuery('#{selector}').trigger('blur')" +end + +When /^I confirm$/ do + page.driver.browser.switch_to.alert.accept +end diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index ccee812..e50435f 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -602,7 +602,9 @@ Given /^the following enterprise homepages?$/ do |table| end And /^I want to add "([^\"]*)" as cost$/ do |string| - selenium.answer_on_next_prompt(string) + prompt = page.driver.browser.switch_to.alert + prompt.send_keys(string) + prompt.accept end Given /^([^\s]+) (enabled|disabled) translation redirection in (?:his|her) profile$/ do -- libgit2 0.21.2