Working SpecFlow POST support

Step named: When I hit "x"
locates input type submit with value "x"
locates the form surrounding that input
and sends a POST request to the embedded web host with all of the input values of that form element
Also added step: Given I have a clean site with
as a large-grained copier of extensions

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-04-20 14:27:43 -07:00
parent 5b3c213de4
commit 299a4ba74d
3 changed files with 203 additions and 6 deletions

View File

@@ -57,6 +57,27 @@ namespace Orchard.Specs.Bindings {
_webHost.CopyExtension("Core", moduleName);
}
[Given(@"I have a clean site with")]
public void GivenIHaveACleanSiteWith(Table table) {
GivenIHaveACleanSite();
foreach (var row in table.Rows) {
switch (row["extension"]) {
case "core":
GivenIHaveCore(row["name"]);
break;
case "module":
GivenIHaveModule(row["name"]);
break;
case "theme":
GivenIHaveTheme(row["name"]);
break;
default:
Assert.Fail("Unknown extension type {0}", row["extension"]);
break;
}
}
}
[Given(@"I am on ""(.*)""")]
public void GivenIAmOn(string urlPath) {
WhenIGoTo(urlPath);

View File

@@ -30,10 +30,13 @@ Scenario: Some of the initial form values are required
Then I should see "Site name is required"
And I should see "Password is required"
Scenario: Initializing the site
Given I have a clean site
And I have module "Orchard.Setup"
And I have theme "SafeMode"
Scenario: Calling setup on a brand new install
Given I have a clean site with
| extension | name |
| module | Orchard.Setup |
| core | Themes |
| core | Settings |
| theme | SafeMode |
And I am on "/Setup"
When I fill in
| name | value |

View File

@@ -1,2 +1,175 @@
startIndex cannot be larger than length of string.
Parameter name: startIndex
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.2.0.0
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
namespace Orchard.Specs
{
using TechTalk.SpecFlow;
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Setup")]
public partial class SetupFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "Setup.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"), "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)));
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("Root request shows setup form")]
public virtual void RootRequestShowsSetupForm()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Root request shows setup form", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
testRunner.Given("I have a clean site");
#line 8
testRunner.And("I have module \"Orchard.Setup\"");
#line 9
testRunner.And("I have theme \"SafeMode\"");
#line 10
testRunner.When("I go to \"/Default.aspx\"");
#line 11
testRunner.Then("I should see \"Welcome to Orchard\"");
#line 12
testRunner.And("I should see \"Finish Setup\"");
#line 13
testRunner.And("the status should be 200 OK");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Setup folder also shows setup form")]
public virtual void SetupFolderAlsoShowsSetupForm()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Setup folder also shows setup form", ((string[])(null)));
#line 15
this.ScenarioSetup(scenarioInfo);
#line 16
testRunner.Given("I have a clean site");
#line 17
testRunner.And("I have module \"Orchard.Setup\"");
#line 18
testRunner.And("I have theme \"SafeMode\"");
#line 19
testRunner.When("I go to \"/Setup\"");
#line 20
testRunner.Then("I should see \"Welcome to Orchard\"");
#line 21
testRunner.And("I should see \"Finish Setup\"");
#line 22
testRunner.And("the status should be 200 OK");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Some of the initial form values are required")]
public virtual void SomeOfTheInitialFormValuesAreRequired()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Some of the initial form values are required", ((string[])(null)));
#line 24
this.ScenarioSetup(scenarioInfo);
#line 25
testRunner.Given("I have a clean site");
#line 26
testRunner.And("I have module \"Orchard.Setup\"");
#line 27
testRunner.And("I have theme \"SafeMode\"");
#line 28
testRunner.When("I go to \"/Setup\"");
#line 29
testRunner.And("I hit \"Finish Setup\"");
#line 30
testRunner.Then("I should see \"Site name is required\"");
#line 31
testRunner.And("I should see \"Password is required\"");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Calling setup on a brand new install")]
public virtual void CallingSetupOnABrandNewInstall()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Calling setup on a brand new install", ((string[])(null)));
#line 33
this.ScenarioSetup(scenarioInfo);
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"extension",
"name"});
table1.AddRow(new string[] {
"module",
"Orchard.Setup"});
table1.AddRow(new string[] {
"core",
"Themes"});
table1.AddRow(new string[] {
"core",
"Settings"});
table1.AddRow(new string[] {
"theme",
"SafeMode"});
#line 34
testRunner.Given("I have a clean site with", ((string)(null)), table1);
#line 40
testRunner.And("I am on \"/Setup\"");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table2.AddRow(new string[] {
"SiteName",
"My Site"});
table2.AddRow(new string[] {
"AdminPassword",
"6655321"});
#line 41
testRunner.When("I fill in", ((string)(null)), table2);
#line 45
testRunner.And("I hit \"Finish Setup\"");
#line 46
testRunner.Then("I should see \"Blah\"");
#line hidden
testRunner.CollectScenarioErrors();
}
}
}