Adding some spec tests around setting a page as the home page

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-11-30 14:00:21 -08:00
parent b136fbe02b
commit f512e634b1
3 changed files with 150 additions and 27 deletions

View File

@@ -213,6 +213,23 @@ namespace Orchard.Specs.Bindings {
else if (radio.Attributes.Contains("checked"))
radio.Attributes.Remove("checked");
}
break;
case "checkbox":
if (string.Equals(row["value"], "true", StringComparison.OrdinalIgnoreCase)) {
input.Attributes.Add("checked", "checked");
}
else {
input.Attributes.Remove("checked");
}
var hiddenForCheckbox = inputs.Where(
x =>
x.GetAttributeValue("type", "") == "hidden" &&
x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]
).FirstOrDefault();
if (hiddenForCheckbox != null)
hiddenForCheckbox.Attributes.Add("value", row["value"]);
break;
default:
input.Attributes.Add("value", row["value"]);

View File

@@ -39,4 +39,30 @@ Scenario: If I create a page which gets a conflicting path generated its path is
And I hit "Publish Now"
And I go to "super-duper-2"
Then I should see "<h1[^>]*>.*?Super Duper.*?</h1>"
And I should see "This is super number two."
And I should see "This is super number two."
Scenario: A new page marked to be the home page and publish does take over the home page and is not accessible from its own standard path.
Given I have installed Orchard
When I go to "admin/contents/create/page"
And I fill in
| name | value |
| Routable.Title | Super Duper |
| Body.Text | This is a draft of the new home page. |
| Routable.PromoteToHomePage | true |
And I hit "Publish Now"
And I go to "/Default.aspx"
Then I should see "<h1>Super Duper</h1>"
When I go to "super-duper"
Then the status should be 404 "Not Found"
Scenario: A new page marked to be the home page but only saved as draft does not take over the home page
Given I have installed Orchard
When I go to "admin/contents/create/page"
And I fill in
| name | value |
| Routable.Title | Drafty |
| Body.Text | This is a draft of the new home page. |
| Routable.PromoteToHomePage | true |
And I hit "Save"
And I go to "/Default.aspx"
Then I should see "<h1>Welcome to Orchard!</h1>"

View File

@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// 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
//
// Changes to this file may cause incorrect behavior and will be lost if
@@ -14,7 +14,7 @@ namespace Orchard.Specs
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()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Pages")]
@@ -31,7 +31,7 @@ namespace Orchard.Specs
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Pages", "In order to add content pages to my site\r\nAs an author\r\nI want to create, publish" +
" and edit pages", ((string[])(null)));
" and edit pages", GenerationTargetLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
@@ -61,11 +61,11 @@ namespace Orchard.Specs
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 8
testRunner.When("I go to \"admin\"");
testRunner.When("I go to \"admin\"");
#line 9
testRunner.Then("I should see \"<a href=\"/Admin/Contents/Create/Page\">Page</a>\"");
testRunner.Then("I should see \"<a href=\"/Admin/Contents/Create/Page\">Page</a>\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -78,9 +78,9 @@ testRunner.Then("I should see \"<a href=\"/Admin/Contents/Create/Page\">Page</a>
#line 11
this.ScenarioSetup(scenarioInfo);
#line 12
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 13
testRunner.When("I go to \"admin/contents/create/page\"");
testRunner.When("I go to \"admin/contents/create/page\"");
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -92,15 +92,15 @@ testRunner.When("I go to \"admin/contents/create/page\"");
"Body.Text",
"This is super."});
#line 14
testRunner.And("I fill in", ((string)(null)), table1);
testRunner.And("I fill in", ((string)(null)), table1);
#line 18
testRunner.And("I hit \"Publish Now\"");
testRunner.And("I hit \"Publish Now\"");
#line 19
testRunner.And("I go to \"super-duper\"");
testRunner.And("I go to \"super-duper\"");
#line 20
testRunner.Then("I should see \"<h1[^>]*>.*?Super Duper.*?</h1>\"");
testRunner.Then("I should see \"<h1[^>]*>.*?Super Duper.*?</h1>\"");
#line 21
testRunner.And("I should see \"This is super.\"");
testRunner.And("I should see \"This is super.\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -115,9 +115,9 @@ testRunner.And("I should see \"This is super.\"");
#line 23
this.ScenarioSetup(scenarioInfo);
#line 24
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 25
testRunner.When("I go to \"admin/contents/create/page\"");
testRunner.When("I go to \"admin/contents/create/page\"");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -129,17 +129,17 @@ testRunner.When("I go to \"admin/contents/create/page\"");
"Body.Text",
"This is super."});
#line 26
testRunner.And("I fill in", ((string)(null)), table2);
testRunner.And("I fill in", ((string)(null)), table2);
#line 30
testRunner.And("I hit \"Publish Now\"");
testRunner.And("I hit \"Publish Now\"");
#line 31
testRunner.And("I go to \"super-duper\"");
testRunner.And("I go to \"super-duper\"");
#line 32
testRunner.Then("I should see \"<h1[^>]*>.*?Super Duper.*?</h1>\"");
testRunner.Then("I should see \"<h1[^>]*>.*?Super Duper.*?</h1>\"");
#line 33
testRunner.And("I should see \"This is super.\"");
testRunner.And("I should see \"This is super.\"");
#line 34
testRunner.When("I go to \"admin/contents/create/page\"");
testRunner.When("I go to \"admin/contents/create/page\"");
#line hidden
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -151,15 +151,95 @@ testRunner.When("I go to \"admin/contents/create/page\"");
"Body.Text",
"This is super number two."});
#line 35
testRunner.And("I fill in", ((string)(null)), table3);
testRunner.And("I fill in", ((string)(null)), table3);
#line 39
testRunner.And("I hit \"Publish Now\"");
testRunner.And("I hit \"Publish Now\"");
#line 40
testRunner.And("I go to \"super-duper-2\"");
testRunner.And("I go to \"super-duper-2\"");
#line 41
testRunner.Then("I should see \"<h1[^>]*>.*?Super Duper.*?</h1>\"");
testRunner.Then("I should see \"<h1[^>]*>.*?Super Duper.*?</h1>\"");
#line 42
testRunner.And("I should see \"This is super number two.\"");
testRunner.And("I should see \"This is super number two.\"");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("A new page marked to be the home page and publish does take over the home page an" +
"d is not accessible from its own standard path.")]
public virtual void ANewPageMarkedToBeTheHomePageAndPublishDoesTakeOverTheHomePageAndIsNotAccessibleFromItsOwnStandardPath_()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new page marked to be the home page and publish does take over the home page an" +
"d is not accessible from its own standard path.", ((string[])(null)));
#line 44
this.ScenarioSetup(scenarioInfo);
#line 45
testRunner.Given("I have installed Orchard");
#line 46
testRunner.When("I go to \"admin/contents/create/page\"");
#line hidden
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table4.AddRow(new string[] {
"Routable.Title",
"Super Duper"});
table4.AddRow(new string[] {
"Body.Text",
"This is a draft of the new home page."});
table4.AddRow(new string[] {
"Routable.PromoteToHomePage",
"true"});
#line 47
testRunner.And("I fill in", ((string)(null)), table4);
#line 52
testRunner.And("I hit \"Publish Now\"");
#line 53
testRunner.And("I go to \"/Default.aspx\"");
#line 54
testRunner.Then("I should see \"<h1>Super Duper</h1>\"");
#line 55
testRunner.When("I go to \"super-duper\"");
#line 56
testRunner.Then("the status should be 404 \"Not Found\"");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("A new page marked to be the home page but only saved as draft does not take over " +
"the home page")]
public virtual void ANewPageMarkedToBeTheHomePageButOnlySavedAsDraftDoesNotTakeOverTheHomePage()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new page marked to be the home page but only saved as draft does not take over " +
"the home page", ((string[])(null)));
#line 58
this.ScenarioSetup(scenarioInfo);
#line 59
testRunner.Given("I have installed Orchard");
#line 60
testRunner.When("I go to \"admin/contents/create/page\"");
#line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table5.AddRow(new string[] {
"Routable.Title",
"Drafty"});
table5.AddRow(new string[] {
"Body.Text",
"This is a draft of the new home page."});
table5.AddRow(new string[] {
"Routable.PromoteToHomePage",
"true"});
#line 61
testRunner.And("I fill in", ((string)(null)), table5);
#line 66
testRunner.And("I hit \"Save\"");
#line 67
testRunner.And("I go to \"/Default.aspx\"");
#line 68
testRunner.Then("I should see \"<h1>Welcome to Orchard!</h1>\"");
#line hidden
testRunner.CollectScenarioErrors();
}