Adding SpecFlow Pages feature test(s)

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-11-14 14:34:32 -08:00
parent 12eccd479a
commit 1b58c00d00
6 changed files with 140 additions and 52 deletions

View File

@@ -1,6 +1,4 @@
using System.Diagnostics; using System.Linq;
using System.Linq;
using System.Text;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
using Orchard.Environment.Descriptor; using Orchard.Environment.Descriptor;
using Orchard.Environment.Descriptor.Models; using Orchard.Environment.Descriptor.Models;
@@ -16,7 +14,7 @@ namespace Orchard.Specs.Bindings {
var webApp = Binding<WebAppHosting>(); var webApp = Binding<WebAppHosting>();
webApp.GivenIHaveACleanSiteWith(TableData( webApp.GivenIHaveACleanSiteWith(TableData(
new { extension = "module", names = "Orchard.Setup, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Widgets, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce" }, new { extension = "module", names = "Orchard.Setup, Orchard.Pages, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Widgets, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce" },
new { extension = "core", names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" }, new { extension = "core", names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" },
new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" })); new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));
@@ -34,9 +32,7 @@ namespace Orchard.Specs.Bindings {
public void GivenIHaveInstalled(string name) { public void GivenIHaveInstalled(string name) {
var webApp = Binding<WebAppHosting>(); var webApp = Binding<WebAppHosting>();
webApp.GivenIHaveModule(name); webApp.GivenIHaveModule(name);
webApp.Host.Execute(() => { webApp.Host.Execute(MvcApplication.ReloadExtensions);
MvcApplication.ReloadExtensions();
});
GivenIHaveEnabled(name); GivenIHaveEnabled(name);
} }

View File

@@ -154,6 +154,11 @@
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<DependentUpon>MultiTenancy.feature</DependentUpon> <DependentUpon>MultiTenancy.feature</DependentUpon>
</Compile> </Compile>
<Compile Include="Pages.feature.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Pages.feature</DependentUpon>
</Compile>
<Compile Include="Util\PathExtensions.cs" /> <Compile Include="Util\PathExtensions.cs" />
<Compile Include="WebHosting.feature.cs"> <Compile Include="WebHosting.feature.cs">
<DependentUpon>WebHosting.feature</DependentUpon> <DependentUpon>WebHosting.feature</DependentUpon>
@@ -220,6 +225,10 @@
<Generator>SpecFlowSingleFileGenerator</Generator> <Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>MultiTenancy.feature.cs</LastGenOutput> <LastGenOutput>MultiTenancy.feature.cs</LastGenOutput>
</None> </None>
<None Include="Pages.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>Pages.feature.cs</LastGenOutput>
</None>
<None Include="WebHosting.feature"> <None Include="WebHosting.feature">
<Generator>SpecFlowSingleFileGenerator</Generator> <Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>WebHosting.feature.cs</LastGenOutput> <LastGenOutput>WebHosting.feature.cs</LastGenOutput>

View File

@@ -0,0 +1,9 @@
Feature: Content Page management
In order to add content pages to my site
As an author
I want to create, publish and edit pages
Scenario: The "Page" content type is available to create from the admin menu
Given I have installed Orchard
When I go to ""
Then I should see "<a href="/Admin/Contents/Create/Page">Page</a>"

74
src/Orchard.Specs/Pages.feature.cs generated Normal file
View File

@@ -0,0 +1,74 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.4.0.0
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
namespace Orchard.Specs
{
using TechTalk.SpecFlow;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Content Page management")]
public partial class ContentPageManagementFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "Pages.feature"
#line hidden
[NUnit.Framework.TestFixtureSetUpAttribute()]
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Content Page management", "In order to add content pages to my site\r\nAs an author\r\nI want to create, publish" +
" and edit pages", GenerationTargetLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
[NUnit.Framework.TestFixtureTearDownAttribute()]
public virtual void FeatureTearDown()
{
testRunner.OnFeatureEnd();
testRunner = null;
}
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
{
testRunner.OnScenarioStart(scenarioInfo);
}
[NUnit.Framework.TearDownAttribute()]
public virtual void ScenarioTearDown()
{
testRunner.OnScenarioEnd();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("The \"Page\" content type is available to create from the admin menu")]
public virtual void ThePageContentTypeIsAvailableToCreateFromTheAdminMenu()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("The \"Page\" content type is available to create from the admin menu", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
testRunner.Given("I have installed Orchard");
#line 8
testRunner.When("I go to \"\"");
#line 9
testRunner.Then("I should see \"<a href=\"/Admin/Contents/Create/Page\">Page</a>\"");
#line hidden
testRunner.CollectScenarioErrors();
}
}
}
#endregion

View File

@@ -6,7 +6,7 @@ Feature: Setup
Scenario: Root request shows setup form Scenario: Root request shows setup form
Given I have a clean site with Given I have a clean site with
| extension | names | | extension | names |
| module | Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.Themes, Orchard.jQuery, TinyMce | | module | Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Pages, Orchard.Comments, Orchard.Themes, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.PublishLater, Scheduling, Settings, Shapes, XmlRpc | | core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.PublishLater, Scheduling, Settings, Shapes, XmlRpc |
| theme | SafeMode | | theme | SafeMode |
When I go to "/Default.aspx" When I go to "/Default.aspx"
@@ -17,7 +17,7 @@ Scenario: Root request shows setup form
Scenario: Setup folder also shows setup form Scenario: Setup folder also shows setup form
Given I have a clean site with Given I have a clean site with
| extension | names | | extension | names |
| module | Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.Themes, Orchard.jQuery, TinyMce | | module | Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Pages, Orchard.Comments, Orchard.Themes, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.PublishLater, Scheduling, Settings, Shapes, XmlRpc | | core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.PublishLater, Scheduling, Settings, Shapes, XmlRpc |
| theme | SafeMode | | theme | SafeMode |
When I go to "/Setup" When I go to "/Setup"
@@ -28,7 +28,7 @@ Scenario: Setup folder also shows setup form
Scenario: Some of the initial form values are required Scenario: Some of the initial form values are required
Given I have a clean site with Given I have a clean site with
| extension | names | | extension | names |
| module | Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.Themes, Orchard.jQuery, TinyMce | | module | Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Pages, Orchard.Comments, Orchard.Themes, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.PublishLater, Scheduling, Settings, Shapes, XmlRpc | | core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.PublishLater, Scheduling, Settings, Shapes, XmlRpc |
| theme | SafeMode | | theme | SafeMode |
When I go to "/Setup" When I go to "/Setup"
@@ -39,7 +39,7 @@ Scenario: Some of the initial form values are required
Scenario: Calling setup on a brand new install Scenario: Calling setup on a brand new install
Given I have a clean site with Given I have a clean site with
| extension | names | | extension | names |
| module | Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce | | module | Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Pages, Orchard.Comments, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce |
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.PublishLater, Scheduling, Settings, Shapes, XmlRpc | | core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.PublishLater, Scheduling, Settings, Shapes, XmlRpc |
| theme | SafeMode, TheThemeMachine | | theme | SafeMode, TheThemeMachine |
And I am on "/Setup" And I am on "/Setup"

View File

@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/). // This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.3.2.0 // SpecFlow Version:1.4.0.0
// Runtime Version:4.0.30319.1 // Runtime Version:4.0.30319.1
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
@@ -14,7 +14,7 @@ namespace Orchard.Specs
using TechTalk.SpecFlow; using TechTalk.SpecFlow;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")] [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()] [NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Setup")] [NUnit.Framework.DescriptionAttribute("Setup")]
@@ -31,7 +31,7 @@ namespace Orchard.Specs
{ {
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Setup", "In order to install orchard\r\nAs a new user\r\nI want to setup a new site from the d" + TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Setup", "In order to install orchard\r\nAs a new user\r\nI want to setup a new site from the d" +
"efault screen", ((string[])(null))); "efault screen", GenerationTargetLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo); testRunner.OnFeatureStart(featureInfo);
} }
@@ -66,25 +66,25 @@ this.ScenarioSetup(scenarioInfo);
"names"}); "names"});
table1.AddRow(new string[] { table1.AddRow(new string[] {
"module", "module",
"Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.Themes, Or" + "Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Pages, Orchard.Comments, Orc" +
"chard.jQuery, TinyMce, Orchard.PublishLater"}); "hard.Themes, Orchard.jQuery, TinyMce"});
table1.AddRow(new string[] { table1.AddRow(new string[] {
"core", "core",
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable," + "Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.Publi" +
" Scheduling, Settings, Shapes, XmlRpc"}); "shLater, Scheduling, Settings, Shapes, XmlRpc"});
table1.AddRow(new string[] { table1.AddRow(new string[] {
"theme", "theme",
"SafeMode"}); "SafeMode"});
#line 7 #line 7
testRunner.Given("I have a clean site with", ((string)(null)), table1); testRunner.Given("I have a clean site with", ((string)(null)), table1);
#line 12 #line 12
testRunner.When("I go to \"/Default.aspx\""); testRunner.When("I go to \"/Default.aspx\"");
#line 13 #line 13
testRunner.Then("I should see \"Welcome to Orchard\""); testRunner.Then("I should see \"Welcome to Orchard\"");
#line 14 #line 14
testRunner.And("I should see \"Finish Setup\""); testRunner.And("I should see \"Finish Setup\"");
#line 15 #line 15
testRunner.And("the status should be 200 \"OK\""); testRunner.And("the status should be 200 \"OK\"");
#line hidden #line hidden
testRunner.CollectScenarioErrors(); testRunner.CollectScenarioErrors();
} }
@@ -102,25 +102,25 @@ this.ScenarioSetup(scenarioInfo);
"names"}); "names"});
table2.AddRow(new string[] { table2.AddRow(new string[] {
"module", "module",
"Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.Themes, Or" + "Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Pages, Orchard.Comments, Orc" +
"chard.jQuery, TinyMce, Orchard.PublishLater"}); "hard.Themes, Orchard.jQuery, TinyMce"});
table2.AddRow(new string[] { table2.AddRow(new string[] {
"core", "core",
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable," + "Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.Publi" +
" Scheduling, Settings, Shapes, XmlRpc"}); "shLater, Scheduling, Settings, Shapes, XmlRpc"});
table2.AddRow(new string[] { table2.AddRow(new string[] {
"theme", "theme",
"SafeMode"}); "SafeMode"});
#line 18 #line 18
testRunner.Given("I have a clean site with", ((string)(null)), table2); testRunner.Given("I have a clean site with", ((string)(null)), table2);
#line 23 #line 23
testRunner.When("I go to \"/Setup\""); testRunner.When("I go to \"/Setup\"");
#line 24 #line 24
testRunner.Then("I should see \"Welcome to Orchard\""); testRunner.Then("I should see \"Welcome to Orchard\"");
#line 25 #line 25
testRunner.And("I should see \"Finish Setup\""); testRunner.And("I should see \"Finish Setup\"");
#line 26 #line 26
testRunner.And("the status should be 200 \"OK\""); testRunner.And("the status should be 200 \"OK\"");
#line hidden #line hidden
testRunner.CollectScenarioErrors(); testRunner.CollectScenarioErrors();
} }
@@ -138,26 +138,26 @@ this.ScenarioSetup(scenarioInfo);
"names"}); "names"});
table3.AddRow(new string[] { table3.AddRow(new string[] {
"module", "module",
"Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.Themes, Or" + "Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Pages, Orchard.Comments, Orc" +
"chard.jQuery, TinyMce, Orchard.PublishLater"}); "hard.Themes, Orchard.jQuery, TinyMce"});
table3.AddRow(new string[] { table3.AddRow(new string[] {
"core", "core",
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable," + "Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.Publi" +
" Scheduling, Settings, Shapes, XmlRpc"}); "shLater, Scheduling, Settings, Shapes, XmlRpc"});
table3.AddRow(new string[] { table3.AddRow(new string[] {
"theme", "theme",
"SafeMode"}); "SafeMode"});
#line 29 #line 29
testRunner.Given("I have a clean site with", ((string)(null)), table3); testRunner.Given("I have a clean site with", ((string)(null)), table3);
#line 34 #line 34
testRunner.When("I go to \"/Setup\""); testRunner.When("I go to \"/Setup\"");
#line 35 #line 35
testRunner.And("I hit \"Finish Setup\""); testRunner.And("I hit \"Finish Setup\"");
#line 36 #line 36
testRunner.Then("I should see \"<input autofocus=\"autofocus\" class=\"input-validation-error\" id=\"Sit" + testRunner.Then("I should see \"<input autofocus=\"autofocus\" class=\"input-validation-error\" id=\"Sit" +
"eName\" name=\"SiteName\" type=\"text\" value=\"\" />\""); "eName\" name=\"SiteName\" type=\"text\" value=\"\" />\"");
#line 37 #line 37
testRunner.And("I should see \"<input class=\"input-validation-error\" id=\"AdminPassword\" name=\"Admi" + testRunner.And("I should see \"<input class=\"input-validation-error\" id=\"AdminPassword\" name=\"Admi" +
"nPassword\" type=\"password\" />\""); "nPassword\" type=\"password\" />\"");
#line hidden #line hidden
testRunner.CollectScenarioErrors(); testRunner.CollectScenarioErrors();
@@ -176,19 +176,19 @@ this.ScenarioSetup(scenarioInfo);
"names"}); "names"});
table4.AddRow(new string[] { table4.AddRow(new string[] {
"module", "module",
"Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.Themes, Or" + "Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Pages, Orchard.Comments, Orc" +
"chard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce, Orchard.PublishLater"}); "hard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce"});
table4.AddRow(new string[] { table4.AddRow(new string[] {
"core", "core",
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable," + "Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Orchard.Publi" +
" Scheduling, Settings, Shapes, XmlRpc"}); "shLater, Scheduling, Settings, Shapes, XmlRpc"});
table4.AddRow(new string[] { table4.AddRow(new string[] {
"theme", "theme",
"SafeMode, TheThemeMachine"}); "SafeMode, TheThemeMachine"});
#line 40 #line 40
testRunner.Given("I have a clean site with", ((string)(null)), table4); testRunner.Given("I have a clean site with", ((string)(null)), table4);
#line 45 #line 45
testRunner.And("I am on \"/Setup\""); testRunner.And("I am on \"/Setup\"");
#line hidden #line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] { TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
"name", "name",
@@ -203,15 +203,15 @@ testRunner.And("I am on \"/Setup\"");
"ConfirmPassword", "ConfirmPassword",
"6655321"}); "6655321"});
#line 46 #line 46
testRunner.When("I fill in", ((string)(null)), table5); testRunner.When("I fill in", ((string)(null)), table5);
#line 51 #line 51
testRunner.And("I hit \"Finish Setup\""); testRunner.And("I hit \"Finish Setup\"");
#line 52 #line 52
testRunner.And("I go to \"/Default.aspx\""); testRunner.And("I go to \"/Default.aspx\"");
#line 53 #line 53
testRunner.Then("I should see \"My Site\""); testRunner.Then("I should see \"My Site\"");
#line 54 #line 54
testRunner.And("I should see \"Welcome, <strong>admin</strong>!\""); testRunner.And("I should see \"Welcome, <strong>admin</strong>!\"");
#line hidden #line hidden
testRunner.CollectScenarioErrors(); testRunner.CollectScenarioErrors();
} }