---
src/features/deployment.feature | 62 +++++++++++++++++++++
src/features/instance.feature | 50 ++++++++++++++++-
src/features/pool.feature | 25 ++++++++
src/features/step_definitions/deployment_steps.rb | 7 ++
src/features/step_definitions/instance_steps.rb | 4 +
5 files changed, 147 insertions(+), 1 deletions(-)
diff --git a/src/features/deployment.feature b/src/features/deployment.feature
index 3907c5e..67f6a62 100644
--- a/src/features/deployment.feature
+++ b/src/features/deployment.feature
@@ -14,6 +14,15 @@ Feature: Manage Deployments
Then I should see "MySQL Cluster"
And I should see "bob"
+ Scenario: List deployments over XHR
+ Given I am on the homepage
+ And there is a deployment named "MySQL Cluster" belonging to
"Databases" owned by "bob"
+ And I request XHR
+ When I go to the deployments page
+ Then I should get back a partial
+ Then I should see "MySQL Cluster"
+ And I should see "bob"
+
Scenario: Launch new deployment
Given there is a deployable named "testdeployable"
And There is a mock pulp repository
@@ -27,6 +36,22 @@ Feature: Manage Deployments
When I press "Launch"
Then I should see "Launch deployable"
+ Scenario: Launch new deployment over XHR
+ Given there is a deployable named "testdeployable"
+ And There is a mock pulp repository
+ And there is a "testtemplate" template
+ And there is an assembly named "testassembly" belonging to
"testdeployable"
+ And there is an assembly named "testassembly" belonging to
"testtemplate" template
+ And I request XHR
+ When I go to the deployments page
+ And I press "Launch new"
+ Then I should see "Launch new deployment via"
+ And I should get back a partial
+ When I select "testdeployable" from "deployable_id"
+ When I press "Launch"
+ Then I should get back a partial
+ And I should see "Launch deployable"
+
Scenario: Stop deployments
Given there is a deployment named "testdeployment" belonging to
"testdeployable" owned by "testuser"
When I go to the deployments page
@@ -35,6 +60,17 @@ Feature: Manage Deployments
And I press "Stop"
Then I should see "testdeployment"
+ Scenario: Stop a deployment over XHR
+ Given there is a deployment named "testdeployment" belonging to
"testdeployable" owned by "testuser"
+ And I request XHR
+ When I go to the deployments page
+ Then I should get back a partial
+ And I should see "testdeployment"
+ When I check "testdeployment" deployment
+ And I press "Stop"
+ Then I should get back a partial
+ And I should see "testdeployment"
+
Scenario: Show operational status of deployment
Given there is a deployment named "testdeployment" belonging to
"testdeployable" owned by "testuser"
When I am on the operational status of deployment page
@@ -50,6 +86,18 @@ Feature: Manage Deployments
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 "name" with "Jenkins"
+ And I press "Save"
+ 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 is a mock pulp repository
And there are 2 deployments
@@ -64,12 +112,26 @@ Feature: Manage Deployments
When I am viewing the deployment "mockdeployment"
Then I should see deployment "mockdeployment" in JSON format
+ Scenario: View a deployment via XHR
+ Given There is a mock pulp repository
+ And a deployment "mockdeployment" exists
+ And I request XHR
+ When I am viewing the deployment "mockdeployment"
+ Then I should get back a partial
+ And I should see "mockdeployment"
+
Scenario: Create a deployment and get JSON response
Given There is a mock pulp repository
And I accept JSON
When I create a deployment
Then I should get back a deployment in JSON format
+ Scenario: Create a deployment and get XHR response
+ Given There is a mock pulp repository
+ And I request XHR
+ When I create a deployment
+ Then I should get back a partial
+
Scenario: Stop a deployment
Given a deployment "mockdeployment" exists
And There is a mock pulp repository
diff --git a/src/features/instance.feature b/src/features/instance.feature
index 9b05a2b..92139ea 100644
--- a/src/features/instance.feature
+++ b/src/features/instance.feature
@@ -1,5 +1,5 @@
# language: en
-Feature: Mange Instances
+Feature: Manage Instances
In order to manage my cloud infrastructure
As a user
I want to manage instances
@@ -16,6 +16,14 @@ Feature: Mange Instances
When I follow "Download"
Then I should see the Save dialog for a .pem file
+ Scenario: Download an Instance Key over XHR
+ Given a mock running instance exists
+ And I request XHR
+ When I am viewing the mock instance detail
+ And I see "SSH key"
+ When I follow "Download"
+ Then I should see the Save dialog for a .pem file
+
Scenario: Don't see' an Instance Key
Given a mock pending instance exists
When I am viewing the pending instance detail
@@ -35,6 +43,13 @@ Feature: Mange Instances
Then I should be on the instances page
And I should see "mock1"
+ Scenario: I want to view all instances over XHR
+ Given there is a "mock1" instance
+ And I request XHR
+ When I am on the instances page
+ Then I should get back a partial
+ And I should see "mock1"
+
Scenario: Launch instance
Given there is an uploaded image for a template
And I am on the instances page
@@ -61,6 +76,13 @@ Feature: Mange Instances
And I should see "Status"
And I should see "Base Template"
+ Scenario: Show instance details over XHR
+ Given there is a "mock1" instance
+ And I request XHR
+ When I am on mock1's instance page
+ Then I should get back a partial
+ And I should see "Name"
+
Scenario: Remove failed instances
Given there is a "mock1" failed instance
And I am on the instances page
@@ -155,23 +177,49 @@ Feature: Mange Instances
Then I should be on Tomcat's instance page
And I should see "Tomcat"
+ Scenario: Edit an instance name over XHR
+ Given there is a "Tomct" instance
+ And I request XHR
+ When I am on Tomct's edit instance page
+ And I fill in "name" with "Tomcat"
+ And I press "Save"
+ Then I should get back a partial
+ And I should see "Tomcat"
+
Scenario: View all instances in JSON format
Given there are 2 instances
And I accept JSON
When I go to the instances page
Then I should see 2 instances in JSON format
+ Scenario: View all instances over XHR
+ Given there are 2 instances
+ And I request XHR
+ When I go to the instances page
+ Then I should get back a partial
+
Scenario: View an instance in JSON format
Given a mock running instance exists
And I accept JSON
When I am viewing the mock instance
Then I should see mock instance in JSON format
+ Scenario: View an instance over XHR
+ Given a mock running instance exists
+ And I request XHR
+ When I am viewing the mock instance
+ Then I should get back a partial
+
Scenario: Create an instance and get JSON response
Given I accept JSON
When I create mock instance
Then I should get back instance in JSON format
+ Scenario: Create an instance over XHR
+ Given I request XHR
+ When I create mock instance
+ Then I should get back a partial
+
Scenario: Stop an instance
Given there is a "mock1" running instance
And I accept JSON
diff --git a/src/features/pool.feature b/src/features/pool.feature
index 55aab9f..c650008 100644
--- a/src/features/pool.feature
+++ b/src/features/pool.feature
@@ -24,6 +24,18 @@ Feature: Manage Pools
And I should see "unlimited"
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 a 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"
+ Then I should get back a partial
+ And I should see "mockpool"
+
@tag
Scenario: View Pool's Quota Usage
Given I have Pool Creator permissions on a pool named "mockpool"
@@ -107,12 +119,25 @@ Feature: Manage Pools
When I go to the pools page
Then I should see 2 pools in JSON format
+ Scenario: View all pools over XHR
+ Given there are 2 pools
+ And I request XHR
+ When I go to the pools page
+ Then I should get back a partial
+
Scenario: View a pool in JSON format
Given a pool "mockpool" exists
And I accept JSON
When I am viewing the pool "mockpool"
Then I should see pool "mockpool" in JSON format
+ Scenario: View a pool over XHR
+ Given a pool "mockpool" exists
+ And I request XHR
+ When I am viewing the pool "mockpool"
+ Then I should get back a partial
+ And I should see "mockpool"
+
Scenario: Create a pool and get JSON response
Given I accept JSON
When I create a pool
diff --git a/src/features/step_definitions/deployment_steps.rb
b/src/features/step_definitions/deployment_steps.rb
index 465cbbb..eeb90c5 100644
--- a/src/features/step_definitions/deployment_steps.rb
+++ b/src/features/step_definitions/deployment_steps.rb
@@ -48,6 +48,13 @@ Then /^I should get back a deployment in JSON format$/ do
data['deployment'].should_not be_nil
end
+Then /^I should get back a partial$/ do
+ response.body.should_not match('<html')
+ response.body.should_not match('Copyright')
+ response.body.should_not == ""
+ response.body.should match('<')
+end
+
When /^I stop "([^"]*)" deployment$/ do |arg1|
visit(multi_stop_deployments_url, :post, 'deployments_selected[]' =>
Deployment.find_by_name(arg1).id)
end
diff --git a/src/features/step_definitions/instance_steps.rb
b/src/features/step_definitions/instance_steps.rb
index b3c9eed..3fab8e5 100644
--- a/src/features/step_definitions/instance_steps.rb
+++ b/src/features/step_definitions/instance_steps.rb
@@ -109,6 +109,10 @@ Given /^I accept JSON$/ do
header 'Accept', 'application/json'
end
+Given /^I request XHR$/ do
+ header 'X-Requested-With', 'XMLHttpRequest'
+end
+
Then /^I should see (\d+) instances in JSON format$/ do |count|
ActiveSupport::JSON.decode(response.body).length.should == count.to_i
end
--
1.7.4.4