[PATCH conductor 1/2] Make tests more I18n-friendly

tsedovic at redhat.com tsedovic at redhat.com
Mon Jan 9 16:37:12 UTC 2012


From: Tomas Sedovic <tomas at sedovic.cz>

Our tests still heavily depend on the strings that we use in the English
locale. As a result, we can't run the tests on a different locale and expect
them to pass.

The changes here move us a bit closer to that goal and allow us to modify the
names of the top-level objects in the UI (like Cloud Forms is doing) without
having the tests fail.
---
 src/app/views/layouts/_new_notification.html.haml  |    9 ++-
 src/features/breadcrumbs.feature                   |   14 +++--
 src/features/deployment.feature                    |   62 +++++++-------------
 src/features/hardware_profile.feature              |    4 +-
 src/features/image.feature                         |    6 +-
 src/features/instance.feature                      |    4 +-
 src/features/pool.feature                          |   29 +++------
 src/features/pool_family.feature                   |   10 ++--
 src/features/provider.feature                      |    8 +-
 src/features/realm.feature                         |   22 ++++----
 src/features/step_definitions/breadcrumb_steps.rb  |   19 ++++++
 src/features/step_definitions/general_steps.rb     |   28 +++++++++
 .../step_definitions/hardware_profile_steps.rb     |    8 +++
 src/features/step_definitions/image_steps.rb       |    5 ++
 src/features/step_definitions/instance_steps.rb    |    6 ++
 src/features/step_definitions/pool_steps.rb        |   24 ++++++++
 src/features/step_definitions/provider_steps.rb    |    4 +
 src/features/support/paths.rb                      |    3 +
 src/spec/models/instance_spec.rb                   |   14 ++--
 19 files changed, 173 insertions(+), 106 deletions(-)
 create mode 100644 src/features/step_definitions/breadcrumb_steps.rb

diff --git a/src/app/views/layouts/_new_notification.html.haml b/src/app/views/layouts/_new_notification.html.haml
index 8ae73b0..5b7988a 100644
--- a/src/app/views/layouts/_new_notification.html.haml
+++ b/src/app/views/layouts/_new_notification.html.haml
@@ -31,10 +31,11 @@
 
     -if flash[:error]
       -if flash[:error].kind_of?(String)
-        .flash-subset
-          %div.heading
-            =image_tag 'flash_error_icon.png', :alt => 'Errors'
-          =flash[:error]
+        .error.flash-group
+          .flash-subset
+            %div.heading
+              =image_tag 'flash_error_icon.png', :alt => 'Errors'
+            =flash[:error]
       -elsif flash[:error].kind_of?(Hash)
         -unless flash[:error][:successes].blank?
           .notice.flash-group
diff --git a/src/features/breadcrumbs.feature b/src/features/breadcrumbs.feature
index abad08a..6ccf73d 100644
--- a/src/features/breadcrumbs.feature
+++ b/src/features/breadcrumbs.feature
@@ -13,12 +13,14 @@ Feature: Breadcrumbs
     When I go to the pools page
     Then I should see "testpool"
     When I follow "testpool"
-    Then I should see "Pools"
-    When I follow "Pools"
+    Then I should see "Pools" within "#nav_history"
+    When I follow "Pools" within "#nav_history"
     Then I should be on the pools page
 
-  Scenario: Dont create breadcrumb when reloading or pointing to the same route
-    Given I am on the deployments page
+  Scenario: Don't show breadcrumbs on the top level section
+    Given a pool "testpool" exists
+    And I am on the page for the pool "testpool"
+    When I go to the pools page
+    Then I should not see the breadcrumbs section
     When I go to the pools page
-    And I go to the pools page
-    Then I should see "Deployments"
+    Then I should not see the breadcrumbs section
diff --git a/src/features/deployment.feature b/src/features/deployment.feature
index 518660f..440768e 100644
--- a/src/features/deployment.feature
+++ b/src/features/deployment.feature
@@ -36,14 +36,13 @@ Feature: Manage Deployments
     And there is a provider account "my_mock_provider" related to pool family "default"
     When I am viewing the pool "mockpool"
     And I follow "new_deployment_button"
-    Then I should see "New Deployment"
+    Then I should be on the launch new deployments page
     When I select "test_catalog_entry" from "deployable_id"
     When I fill in "deployment_name" with "mynewdeployment"
     When I press "next_button"
     Then I should see "Are you sure you wish to deploy"
     When I press "launch_deployment_button"
-    Then I should see "Deployment launched"
-    Then I should see "mynewdeployment Deployment"
+    Then I should see a confirmation message
     And I should see "mynewdeployment/frontend"
     And I should see "mynewdeployment/backend"
 
@@ -57,7 +56,7 @@ Feature: Manage Deployments
     And I request XHR
     And I follow "new_deployment_button"
     Then I should get back a partial
-    Then I should see "New Deployment"
+    And I should be on the launch new deployments page
     When I select "test_catalog_entry" from "deployable_id"
     When I fill in "deployment_name" with "mynewdeployment"
     When I press "next_button"
@@ -72,7 +71,7 @@ Feature: Manage Deployments
     And there is "front_hwp2" conductor hardware profile
     When I am viewing the pool "Disabled"
     And I follow "new_deployment_button"
-    Then I should see "pool has been disabled"
+    Then I should see a warning message
     And I should be on the page for the pool "Disabled"
 
   Scenario: Stop deployments
@@ -100,27 +99,6 @@ Feature: Manage Deployments
     And I follow "testdeployment"
     Then I should see "testdeployment"
 
-  Scenario: Edit deployment name
-    Given there is a deployment named "Hudson" belonging to "QA Infrastructure" owned by "joe"
-    When I go to Hudson's edit deployment page
-    Then I should see "Edit deployment"
-    When I fill in "deployment_name" with "Jenkins"
-    And I press "save_button"
-    Then I should be on Jenkins's deployment page
-    And I should see "Jenkins"
-
-  Scenario: Edit deployment name using XHR
-    Given there is a deployment named "Hudson" belonging to "QA Infrastructure" owned by "joe"
-    And I request XHR
-    When I go to Hudson's edit deployment page
-    Then I should get back a partial
-    And I should see "Edit deployment"
-    When I fill in "deployment_name" with "Jenkins"
-    And I press "save_button"
-    Then I should get back a partial
-    And I should be on Jenkins's deployment page
-    And I should see "Jenkins"
-
   Scenario: View all deployments in JSON format
     Given there are 2 deployments
     And I accept JSON
@@ -172,18 +150,20 @@ Feature: Manage Deployments
     And I am on the pools page
     When I follow "testdeployment"
     And I press "delete"
-    Then I should see "The deployment testdeployment was scheduled for deletion"
+    Then I should see a confirmation message
 
   Scenario: Delete multiple deployments
     Given a deployment "mydeployment1" exists
     And a deployment "mydeployment2" exists
     And I am on the pools page
     When I follow link with ID "filter_view"
-    And I follow "Deployments"
+    And I follow "details_deployments"
     And I check "mydeployment1" deployment
     And I check "mydeployment2" deployment
     And I press "delete_button"
-    Then I should see "The deployments mydeployment1 and mydeployment2 were scheduled for deletion"
+    Then I should see "mydeployment1"
+    Then I should see "mydeployment2"
+    Then I should see a confirmation message
 
   Scenario: Delete a deployment with running instances
     Given a deployment "mockdeployment" exists
@@ -192,7 +172,7 @@ Feature: Manage Deployments
     And I am on the pools page
     When I follow "mockdeployment"
     And I press "delete"
-    Then I should see "The deployment mockdeployment was scheduled for deletion"
+    Then I should see a confirmation message
 
   Scenario: Launch a deployment which is not launchable
     Given a pool "mockpool" exists
@@ -200,14 +180,14 @@ Feature: Manage Deployments
     And "test" has catalog_entry "test_catalog_entry"
     And there is "front_hwp1" conductor hardware profile
     When I am viewing the pool "mockpool"
-    And I follow "New Deployment"
-    Then I should see "New Deployment"
+    And I follow "new_deployment_button"
+    Then I should be on the launch new deployments page
     When I select "test_catalog_entry" from "deployable_id"
     When I fill in "deployment_name" with "mynewdeployment"
-    When I press "Next"
+    When I press "next_button"
     Then I should see "Are you sure you wish to deploy"
-    And I should see "Some assemblies will not be launched:"
-    And I should see "backend: Hardware Profile front_hwp2 not found."
+    And I should see an error message
+    And I should see "front_hwp2 not found."
 
   Scenario: Verify that the launch parameters are displayed
     Given a pool "mockpool" exists
@@ -218,11 +198,11 @@ Feature: Manage Deployments
     And there is mock provider account "my_mock_provider"
     And there is a provider account "my_mock_provider" related to pool family "default"
     When  I am viewing the pool "mockpool"
-    And   I follow "New Deployment"
-    Then  I should see "New Deployment"
+    And   I follow "new_deployment_button"
+    Then  I should be on the launch new deployments page
     When  I select "test_catalog_entry" from "deployable_id"
     And   I fill in "deployment_name" with "deployment_with_launch_parameters"
-    And   I press "Next"
+    And   I press "next_button"
     Then  I should see "Configure launch-time parameters"
     And   I should see "Parameter 1"
     And   I should see "Parameter 2"
@@ -237,11 +217,11 @@ Feature: Manage Deployments
     And there is a provider account "my_mock_provider" related to pool family "default"
     And there is a mock config server "https://mock:443" for account "my_mock_provider"
     When  I am viewing the pool "mockpool"
-    And   I follow "New Deployment"
-    Then  I should see "New Deployment"
+    And   I follow "new_deployment_button"
+    Then  I should be on the launch new deployments page
     When  I select "test_catalog_entry" from "deployable_id"
     And   I fill in "deployment_name" with "deployment_with_launch_parameters"
-    And   I press "Next"
+    And   I press "next_button"
     Then  I should see "Configure launch-time parameters"
     And   I should see "Launch Parameter 1"
     And   I should see "Launch Parameter 2"
diff --git a/src/features/hardware_profile.feature b/src/features/hardware_profile.feature
index 805929e..c7b77db 100644
--- a/src/features/hardware_profile.feature
+++ b/src/features/hardware_profile.feature
@@ -14,8 +14,8 @@ Feature: Manage Hardware Profiles
     | m1-large  | 4096   | 4   | 850     | x86_64       |
     | m1-xlarge | 8192   | 8   | 1690    | x86_64       |
     And I am on the the hardware profiles page
-    Then I should see the following:
-    | Hardware Profile Name | Memory | Virtual CPU | Storage   | Architecture |
+    Then I should see the hardware profiles table
+    And I should see the following:
     | m1-small              | 1740   | 2           | 160       | i386         |
     | m1-large              | 4096   | 4           | 850       | x86_64       |
     | m1-xlarge             | 8192   | 8           | 1690      | x86_64       |
diff --git a/src/features/image.feature b/src/features/image.feature
index 7cc4a24..e87de68 100644
--- a/src/features/image.feature
+++ b/src/features/image.feature
@@ -9,10 +9,8 @@ Feature: Manage Images
 
   Scenario: Uploading a template without specifying the file
     Given there is a pool family named "testpoolfamily"
-    And I am on the pool families page
-    And I follow "New Image"
-    Then I should be on the new image page
-    When I fill in "name" with "my template"
+    When I the New Image page for "testpoolfamily"
+    And I fill in "name" with "my template"
     And I press "file_button"
     Then I should see "You must specify the template XML file"
 
diff --git a/src/features/instance.feature b/src/features/instance.feature
index 8ee0832..997a6ed 100644
--- a/src/features/instance.feature
+++ b/src/features/instance.feature
@@ -54,9 +54,7 @@ Feature: Manage Instances
     Given there is a "mock1" instance
     And I am on the instances page
     When I follow "mock1"
-    And I should see "Name"
-    And I should see "Status"
-    And I should see "Assembly"
+    Then I should see instance details
 
   Scenario: Show instance details over XHR
     Given there is a "mock1" instance
diff --git a/src/features/pool.feature b/src/features/pool.feature
index b52d7f6..b837dfc 100644
--- a/src/features/pool.feature
+++ b/src/features/pool.feature
@@ -12,20 +12,18 @@ Feature: Manage Pools
     And there is not a pool named "mockpool"
     When I follow "new_pool_button"
     Then I should be on the new pool page
-    And I should see "Create New Pool"
     When I fill in "pool_name" with "mockpool"
     And I select "default" from "pool_pool_family_id"
     And I fill in "quota_instances" with "unlimited"
     And I press "save_button"
     Then I should be on the page for the pool "mockpool"
-    And I should see "mockpool Pool"
+    And I should see "mockpool"
     And I should have a pool named "mockpool"
 
   Scenario: Create a new Pool over XHR
     Given I request XHR
     And I am on the new pool page
     Then I should get back a partial
-    And I should see "Create New Pool"
     When I fill in "pool_name" with "mockpool"
     And I select "default" from "pool_pool_family_id"
     And I fill in "quota_instances" with "unlimited"
@@ -40,8 +38,7 @@ Feature: Manage Pools
     | maximum_running_instances | 10       |
     | running_instances         | 8        |
     And I am on the pools page
-    Then I should see the following:
-    | mockpool | Deployments 0	| Instances 0 | Quota Used 80 |
+    Then I should see the quota usage for the "mockpool" pool
 
   Scenario: Enter invalid characters into Name field
     Given I am on the new pool page
@@ -72,24 +69,22 @@ Feature: Manage Pools
     When I follow link with ID "filter_view"
     And I follow "new_pool_button"
     Then I should be on the new pool page
-    And I should see "Create New Pool"
     When I fill in "pool_name" with "mockpool"
     And I select "default" from "pool_pool_family_id"
     And I press "save_button"
     Then I should be on the page for the pool "mockpool"
-    And I should see "Pool added"
+    And I should see a confirmation message
     And I should see "mockpool"
     And I should have a pool named "mockpool"
     When I go to the pools page
     And I follow link with ID "filter_view"
     And I follow "new_pool_button"
     Then I should be on the new pool page
-    And I should see "Create New Pool"
     When I fill in "pool_name" with "foopool"
     And I select "default" from "pool_pool_family_id"
     And I press "save_button"
     Then I should be on the page for the pool "foopool"
-    And I should see "Pool added"
+    And I should see a confirmation message
     And I should have a pool named "mockpool"
     And I should have a pool named "foopool"
 
@@ -98,7 +93,7 @@ Feature: Manage Pools
     When I follow link with ID "filter_view"
     And I check "Default" pool
     And I press "delete_button"
-    Then I should see "The default pool cannot be deleted"
+    Then I should see an error message
     And I should see "Default"
 
   Scenario: Cannot delete default_pool by renaming it
@@ -107,7 +102,7 @@ Feature: Manage Pools
     When I follow link with ID "filter_view"
     And I check "pool_default" pool
     And I press "delete_button"
-    Then I should see "The default pool cannot be deleted"
+    Then I should see an error message
     And I should see "pool_default"
 
   Scenario: Cannot delete pool with running instances
@@ -117,7 +112,7 @@ Feature: Manage Pools
     When I follow link with ID "filter_view"
     And I check "Amazon Startrek Pool" pool
     And I press "delete_button"
-    Then I should see "was not deleted"
+    Then I should see an error message
 
   Scenario: View all pools in JSON format
     Given there are 2 pools
@@ -149,23 +144,19 @@ Feature: Manage Pools
     And I request XHR
     When I go to the "mockpool42" pool filter view page
     Then I should get back a partial
-    And I should see "Deployment Name"
-    And I should see "mockdeployment"
+    And I should see the "mockdeployment" deployment
 
   Scenario: Switch pretty view to filtred view on pools index
     Given I am on the pools page
     And I see "Overview"
     And I follow link with ID "filter_view"
-    Then I should see "Pools" within "#tab-container-1-nav"
-    And I should see "Instances" within "#tab-container-1-nav"
-    And I should see "Deployments" within "#tab-container-1-nav"
+    Then I should see the filter_view contents for pools index
 
   Scenario: Switch from filtred view to pretty view on pools index
     Given I am on the pools page
     And I follow link with ID "filter_view"
-    And I should see "Pools" within "#tab-container-1-nav"
     When I follow link with ID "pretty_view"
-    Then I should see "Your Pools" within "section.pools"
+    Then I should see the pretty_view contents for pools index
 
   Scenario: Display alerts
     And there is a "fail1" failed instance owned by "admin"
diff --git a/src/features/pool_family.feature b/src/features/pool_family.feature
index 3d3d1d0..ff85423 100644
--- a/src/features/pool_family.feature
+++ b/src/features/pool_family.feature
@@ -25,8 +25,7 @@ Feature: Pool Families
     Given I am logged in
     And I can view pool family "testpoolfamily"
     When I go to the pool families page
-    Then I should see "Pool Families"
-    And I should see "testpoolfamily"
+    Then I should see "testpoolfamily"
 
   Scenario: Show pool family details
     Given I am an authorised user
@@ -34,7 +33,8 @@ Feature: Pool Families
     And there is a pool family named "testpoolfamily"
     And I am on the pool families page
     When I follow "testpoolfamily"
-    Then I should see "Pools"
+    Then I should be on the page for the pool family "testpoolfamily"
+    And I should see "testpoolfamily"
 
   Scenario: Create a new Pool family
     Given I am an authorised user
@@ -47,7 +47,7 @@ Feature: Pool Families
     When I fill in "pool_family[quota_attributes][maximum_running_instances]" with "2"
     And I press "pool_family_submit"
     Then I should be on the pool families page
-    And I should see "Pool family was added."
+    And I should see a confirmation message
     And I should have a pool family named "testpoolfamily"
 
   Scenario: Delete a pool family
@@ -67,7 +67,7 @@ Feature: Pool Families
     Then I should see "default"
     When I follow "default"
     And I press "delete_pool_family_button"
-    Then I should see "Pool Family cannot be deleted!"
+    Then I should see an error message
     And I should see "default"
 
 #  Scenario: Search for pool families
diff --git a/src/features/provider.feature b/src/features/provider.feature
index 44c3c11..bcce43c 100644
--- a/src/features/provider.feature
+++ b/src/features/provider.feature
@@ -61,14 +61,14 @@ Feature: Manage Providers
   Scenario: Create a new Provider failure when using wrong url
     Given I am on the providers page
     And there is not a provider named "testprovider"
-    When I follow "New Provider"
+    When I follow "create_new_provider"
     Then I should be on the new provider page
     When I fill in "provider[name]" with "testprovider"
     And I fill in "provider[url]" with "http://localhost:3010/api"
     And I select "Amazon EC2" from "provider_provider_type_id"
     And I press "save"
     Then I should be on the providers page
-    And I should see "Failed to connect to Provider"
+    And I should see a warning message
 
   Scenario: Delete a provider
     Given I am on the homepage
@@ -96,10 +96,10 @@ Feature: Manage Providers
     Given there is a provider named "provider1"
     And there is a provider named "provider2"
     When I am on the provider1's edit provider page
-    And I follow "Cloud Providers"
+    And I click on the Providers icon in the menu
     Then I should be on the provider1's edit provider page
     When I am on the provider2's edit provider page
-    And I follow "Cloud Providers"
+    And I click on the Providers icon in the menu
     Then I should be on the provider2's edit provider page
 
 
diff --git a/src/features/realm.feature b/src/features/realm.feature
index 3f0d660..6ec9f22 100644
--- a/src/features/realm.feature
+++ b/src/features/realm.feature
@@ -12,19 +12,19 @@ Feature: Manage Realms
   Scenario: Create new frontend realm
     Given I am on the realms page
     When I follow "new_realm_button"
-    Then I should see "Create New Realm"
+    Then I should be on the new realm page
     When I fill in "frontend_realm_name" with "testrealm2"
     And I press "Save"
-    Then I should see "Realm was added."
+    Then I should see a confirmation message
 
   Scenario: Validate unique frontend realm name
     Given I am on the realms page
     And there is a realm "testrealm1"
     When I follow "new_realm_button"
-    Then I should see "Create New Realm"
+    Then I should be on the new realm page
     When I fill in "frontend_realm_name" with "testrealm1"
     And I press "frontend_realm_submit"
-    Then I should see "Name has already been taken"
+    Then I should see an error message
 
   Scenario: Add realm mapping
     Given I am on the realms page
@@ -32,9 +32,9 @@ Feature: Manage Realms
     And a provider "provider1" exists
     When I follow "testrealm1"
     And I follow "mapping_to_provider_button"
-    Then I should see "Create a new Realm Mapping"
+    Then I should be on the new realm mapping page
     When I press "realm_backend_target_submit"
-    Then I should see "Realm mapping was added."
+    Then I should see a confirmation message
 
   Scenario: Add a realm mapping w/o selecting backend target
     Given I am on the realms page
@@ -42,7 +42,7 @@ Feature: Manage Realms
     And there is no provider
     When I follow "testrealm1"
     And I follow "mapping_to_provider_button"
-    Then I should see "Create a new Realm Mapping"
+    Then I should be on the new realm mapping page
     And I press "realm_backend_target_submit"
     Then I should see "Realm or provider can't be blank"
 
@@ -54,7 +54,7 @@ Feature: Manage Realms
     Then I should see "Properties"
     When I fill in "frontend_realm_name" with "testrealm2"
     And I press "frontend_realm_submit"
-    Then I should see "Realm updated successfully!"
+    Then I should see a confirmation message
 
   Scenario: Show realm detials
     Given a realm "testrealm2" exists
@@ -71,20 +71,20 @@ Feature: Manage Realms
     And I press "delete_button"
     Then there should be only 0 realms
     And I should be on the realms page
-    And I should see "These Realms were deleted: testrealm1, testrealm2"
+    And I should see a confirmation message
 
   Scenario: Delete realm without selecting one
     Given I am on the realms page
     When I press "delete_button"
     Then I should be on the realms page
-    And I should see "You must select at least one realm to delete."
+    And I should see an error message
 
   Scenario: Delete realm mapping without selecting one
     Given I am on the realms page
     And there is a realm "testrealm1"
     When I follow "testrealm1"
     And I press "delete_button"
-    Then I should see "You must select at least one mapping to delete"
+    Then I should see an error message
 
   Scenario: Search Realms
     Given a realm "myrealm" exists
diff --git a/src/features/step_definitions/breadcrumb_steps.rb b/src/features/step_definitions/breadcrumb_steps.rb
new file mode 100644
index 0000000..ce8a93d
--- /dev/null
+++ b/src/features/step_definitions/breadcrumb_steps.rb
@@ -0,0 +1,19 @@
+#
+#   Copyright 2011 Red Hat, Inc.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+
+Then /^I should not see the breadcrumbs section$/ do
+  page.should_not have_selector("#nav_history")
+end
diff --git a/src/features/step_definitions/general_steps.rb b/src/features/step_definitions/general_steps.rb
index 082c332..79047fe 100644
--- a/src/features/step_definitions/general_steps.rb
+++ b/src/features/step_definitions/general_steps.rb
@@ -16,3 +16,31 @@
 Then /^I should see an input "([^\"]*)"$/ do |value|
   response.should have_selector("form input[value=#{value}]")
 end
+
+Then /^I should see a confirmation message$/ do
+  page.should have_selector '.flash-group.notice .flash-subset'
+end
+
+Then /^I should see a warning message$/ do
+  page.should have_selector '.flash-group.warning .flash-subset'
+end
+
+Then /^I should see an error message$/ do
+  page.should have_selector '.flash-group.error .flash-subset'
+end
+
+module LocalizationHelpers
+  def localized_text_present(selector)
+    text = I18n.translate!(selector)
+    text_present(text)
+  end
+
+  def text_present(text)
+    if page.respond_to? :should
+      page.should have_content(text)
+    else
+      assert page.has_content?(text)
+    end
+  end
+end
+World(LocalizationHelpers)
diff --git a/src/features/step_definitions/hardware_profile_steps.rb b/src/features/step_definitions/hardware_profile_steps.rb
index 22e875b..a2b7b94 100644
--- a/src/features/step_definitions/hardware_profile_steps.rb
+++ b/src/features/step_definitions/hardware_profile_steps.rb
@@ -70,3 +70,11 @@ def create_provider_hardware_profiles(provider, table)
     create_hwp(hash, provider)
   end
 end
+
+Then /^I should see the hardware profiles table$/ do
+  localized_text_present 'hardware_profiles.index.hardware_profile_name'
+  localized_text_present 'hardware_profiles.index.memory'
+  localized_text_present 'hardware_profiles.index.virtual_cpu'
+  localized_text_present 'hardware_profiles.index.storage'
+  localized_text_present 'hardware_profiles.index.architecture'
+end
diff --git a/src/features/step_definitions/image_steps.rb b/src/features/step_definitions/image_steps.rb
index e718e86..b033f25 100644
--- a/src/features/step_definitions/image_steps.rb
+++ b/src/features/step_definitions/image_steps.rb
@@ -28,3 +28,8 @@ Then /^I should see the image's name$/ do
     assert page.has_content?(@image.name)
   end
 end
+
+When /^I the New Image page for "(\w*)"$/ do |name|
+  pool_family = PoolFamily.find_by_name(name)
+  visit new_image_path(:environment => pool_family)
+end
diff --git a/src/features/step_definitions/instance_steps.rb b/src/features/step_definitions/instance_steps.rb
index fbad005..268fcdb 100644
--- a/src/features/step_definitions/instance_steps.rb
+++ b/src/features/step_definitions/instance_steps.rb
@@ -167,3 +167,9 @@ Then /^I should get back JSON object with success and errors$/ do
   data['success'].should_not be_nil
   data['errors'].should_not be_nil
 end
+
+Then /^I should see instance details$/ do
+  localized_text_present('instances.properties.name')
+  localized_text_present('instances.properties.status')
+  localized_text_present('instances.properties.assembly')
+end
diff --git a/src/features/step_definitions/pool_steps.rb b/src/features/step_definitions/pool_steps.rb
index ecb1442..3ec1db2 100644
--- a/src/features/step_definitions/pool_steps.rb
+++ b/src/features/step_definitions/pool_steps.rb
@@ -158,3 +158,27 @@ Given /^"([^"]*)" has catalog_entry with parameters "([^"]*)"$/ do |catalog_name
   catalog_entry.catalog = catalog
   catalog_entry.save!
 end
+
+Then /^I should see the quota usage for the "([^"]*)" pool$/ do |pool|
+  text_present(pool)
+  text_present(I18n.t('deployments.deployments') + ' 0')
+  text_present(I18n.t('instances.instances.other') + ' 0')
+  text_present(I18n.t('quota_used') + ' 80')
+end
+
+Then /^I should see the "([^"]*)" deployment$/ do |name|
+  text_present(name)
+  localized_text_present('deployments.deployment_name')
+end
+
+Then /^I should see the filter_view contents for pools index$/ do
+  within("#tab-container-1-nav") do
+    localized_text_present('pools.pools')
+    localized_text_present('instances.instances.other')
+    localized_text_present('deployments.deployments')
+  end
+end
+
+Then /^I should see the pretty_view contents for pools index$/ do
+  within("section.pools") { localized_text_present('pools.index.your_pools') }
+end
diff --git a/src/features/step_definitions/provider_steps.rb b/src/features/step_definitions/provider_steps.rb
index a0b3eb9..9699211 100644
--- a/src/features/step_definitions/provider_steps.rb
+++ b/src/features/step_definitions/provider_steps.rb
@@ -113,3 +113,7 @@ Given /^this provider has a provider account with (\d+) running instances$/ do |
     FactoryGirl.create(:instance, :provider_account => pa, :state => 'running')
   end
 end
+
+When /^I click on the Providers icon in the menu$/ do
+  find('#administer_nav a.providers').click
+end
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index 5e73bd0..b812abe 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -89,6 +89,9 @@ module NavigationHelpers
     when /the page for the pool "([^"]*)"/
       pool_path(Pool.find_by_name($1))
 
+    when /the page for the pool family "([^"]*)"/
+      pool_family_path(PoolFamily.find_by_name($1))
+
     when /the pool realms page/
       pool_realms_path
 
diff --git a/src/spec/models/instance_spec.rb b/src/spec/models/instance_spec.rb
index 279f3e5..e6ddfcc 100644
--- a/src/spec/models/instance_spec.rb
+++ b/src/spec/models/instance_spec.rb
@@ -140,7 +140,7 @@ describe Instance do
     @quota.maximum_running_instances = 1
     @quota.running_instances = 1
     @quota.save!
-    @instance.matches.last.should include('Pool quota reached')
+    @instance.matches.last.should include(I18n.t('instances.errors.pool_quota_reached'))
   end
 
   it "shouldn't return any matches if pool family quota is reached" do
@@ -148,7 +148,7 @@ describe Instance do
     quota.maximum_running_instances = 1
     quota.running_instances = 1
     quota.save!
-    @instance.matches.last.should include('Pool family quota reached')
+    @instance.matches.last.should include(I18n.t('instances.errors.pool_family_quota_reached'))
   end
 
   it "shouldn't return any matches if user quota is reached" do
@@ -161,7 +161,7 @@ describe Instance do
 
   it "shouldn't return any matches if there are no provider accounts associated with pool family" do
     @instance.pool.pool_family.provider_accounts = []
-    @instance.matches.last.should include('There are no provider accounts associated with pool family of selected pool.')
+    @instance.matches.last.should include(I18n.t('instances.errors.no_provider_accounts'))
   end
 
   it "should not return matches if account quota is exceeded" do
@@ -194,20 +194,20 @@ describe Instance do
 
   it "shouldn't match provider accounts where image is not pushed" do
     @pool.pool_family.provider_accounts = [FactoryGirl.create(:mock_provider_account, :label => 'testaccount')]
-    @instance.matches.last.should include('testaccount: image is not pushed to this provider account')
+    @instance.matches.last.should include(I18n.t('instances.errors.image_not_pushed_to_provider', :account_name => 'testaccount'))
   end
 
   it "shouldn't match provider accounts where matching hardware profile not found" do
     account = FactoryGirl.create(:mock_provider_account, :label => 'testaccount')
     account.provider.hardware_profiles.destroy_all
     @pool.pool_family.provider_accounts << account
-    @instance.matches.last.should include('testaccount: hardware profile match not found')
+    @instance.matches.last.should include(I18n.t('instances.errors.hw_profile_match_not_found', :account_name => 'testaccount'))
   end
 
   it "shouldn't return any matches if instance hwp architecture doesn't match image architecture" do
     @pool.pool_family.provider_accounts = [FactoryGirl.create(:mock_provider_account, :label => 'testaccount')]
     @instance.hardware_profile.architecture.value = 'i386'
-    @instance.matches.last.should include("Assembly hardware profile architecture (i386) doesn't match image hardware profile architecture (x86_64).")
+    @instance.matches.last.should include(I18n.t('instances.errors.architecture_mismatch', :inst_arch => 'i386', :img_arch => 'x86_64'))
   end
 
   it "should return a match if all requirements are satisfied" do
@@ -254,7 +254,7 @@ describe Instance do
     instance.pool.pool_family.provider_accounts << FactoryGirl.create(:disabled_provider_account)
     instance.should_not be_valid
     instance.errors[:pool].should_not be_empty
-    instance.errors[:pool].first.should == "has all associated providers disabled"
+    instance.errors[:pool].first.should == I18n.t('pools.errors.providers_disabled')
   end
 
   context "When more instances of deployment are starting" do
-- 
1.7.6.5




More information about the aeolus-devel mailing list