From: Jan Provaznik <[email protected]>
---
src/features/instance.feature | 56 ++++++++++++++++++++++++++++-
src/features/step_definitions/instance.rb | 33 +++++++++++++++++
src/features/support/paths.rb | 8 ++++-
src/spec/factories/pool.rb | 1 +
4 files changed, 96 insertions(+), 2 deletions(-)
diff --git a/src/features/instance.feature b/src/features/instance.feature
index c0a01fc..31a4f84 100644
--- a/src/features/instance.feature
+++ b/src/features/instance.feature
@@ -7,6 +7,7 @@ Feature: Mange Instances
Background:
Given I am an authorised user
And I am logged in
+ And I am using new UI
Scenario: Download an Instance Key
Given a mock running instance exists
@@ -23,4 +24,57 @@ Feature: Mange Instances
Scenario: Get useful error when going to wrong url
Given a mock pending instance exists
When I manually go to the key action for this instance
- Then I should see "SSH Key not found for this Instance."
\ No newline at end of file
+ Then I should see "SSH Key not found for this Instance."
+
+ Scenario: I want to view all instances
+ Given there is a "mock1" instance
+ And I am on the home page
+ When I follow "Resource Management"
+ Then I should be on the pools page
+ When I follow "Instances"
+ Then I should be on the instances page
+ And I should see "mock1"
+
+ Scenario: Launch instance
+ Given there is an uploaded image for a template
+ And I am on the instances page
+ And there is "mock_profile" aggregator hardware profile
+ And there is "mock_realm" aggregator realm
+ And there is "mock_pool" pool
+ When I press "Create"
+ #Then I should be on the select template instance page
+ Then I should see "Show Templates"
+ When I press "Launch"
+ Then I should be on the new instance page
+ When I fill in "instance_name" with "mock1"
+ And I select "mock_profile" from "instance_hardware_profile_id"
+ And I select "mock_pool" from "instance_pool_id"
+ And I select "mock_realm" from "instance_realm_id"
+ And I press "Launch"
+ Then I should be on the instances page
+ And I should see "mock1"
+
+ Scenario: Show instance details
+ Given there is a "mock1" instance
+ And I am on the instances page
+ When I follow "mock1"
+ #Then I should see "Instance Details"
+ And I should see "Name"
+ And I should see "Status"
+ And I should see "Base Template"
+
+ Scenario: Remove failed instances
+ Given there is a "mock1" failed instance
+ And I am on the instances page
+ When I check "mock1" instance
+ And I press "Remove failed"
+ Then I should be on the instances page
+ And I should see "mock1: remove failed action was successfully queued"
+
+ Scenario: Stop instance
+ Given there is a "mock1" running instance
+ And I am on the instances page
+ When I check "mock1" instance
+ And I press "Stop"
+ Then I should be on the instances page
+ And I should see "mock1: stop action was successfully queued"
diff --git a/src/features/step_definitions/instance.rb
b/src/features/step_definitions/instance.rb
index a708fd1..f93d08c 100644
--- a/src/features/step_definitions/instance.rb
+++ b/src/features/step_definitions/instance.rb
@@ -37,3 +37,36 @@ Then /^I should see the Save dialog for a (.+) file$/ do
|filetype|
response.headers["Content-Disposition"].should
match(/^attachment;\sfilename=.*#{filetype}$/)
end
+
+Given /^there is a "([^"]*)" instance$/ do |name|
+ Factory :instance, :name => name
+end
+
+Given /^there is a "([^"]*)" failed instance$/ do |name|
+ Factory :instance, :name => name, :state => Instance::STATE_ERROR
+end
+
+Given /^there is a "([^"]*)" running instance$/ do |name|
+ Factory :instance, :name => name, :state => Instance::STATE_RUNNING
+end
+
+Given /^there is an uploaded image for a template$/ do
+ Factory :replicated_image
+end
+
+Given /^there is "([^"]*)" aggregator hardware profile$/ do |name|
+ Factory :mock_hwp2, :name => name
+end
+
+Given /^there is "([^"]*)" aggregator realm$/ do |name|
+ Factory :frontend_realm, :provider_id => nil, :name => name
+end
+
+Given /^there is "([^"]*)" pool$/ do |arg1|
+ Factory :pool, :name => arg1
+end
+
+When /^I check "([^"]*)" instance$/ do |name|
+ inst = Instance.find_by_name(name)
+ check("inst_ids_#{inst.id}")
+end
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index c60b940..c3309fe 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -41,6 +41,9 @@ module NavigationHelpers
when /the settings page/
settings_path
+ when /the pools page/
+ resources_pools_path
+
when /the new pool page/
new_pool_path
@@ -54,7 +57,10 @@ module NavigationHelpers
dashboard_path
when /the instances page/
- instance_path
+ resources_instances_path
+
+ when /the new instance page/
+ new_resources_instance_path
when /the pool hardware profiles page/
hardware_profiles_pool_path
diff --git a/src/spec/factories/pool.rb b/src/spec/factories/pool.rb
index b21f844..9c6b1f0 100644
--- a/src/spec/factories/pool.rb
+++ b/src/spec/factories/pool.rb
@@ -1,6 +1,7 @@
Factory.define :pool do |p|
p.sequence(:name) { |n| "mypool#{n}" }
p.association :zone, :factory => :zone
+ p.association :quota
end
Factory.define :tpool, :parent => :pool do |p|
--
1.7.2.3
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel