mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Adding another Pages spec test and Blogs feature tests
--HG-- branch : dev
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Orchard.Specs.Bindings {
|
||||
var webApp = Binding<WebAppHosting>();
|
||||
|
||||
webApp.GivenIHaveACleanSiteWith(TableData(
|
||||
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 = "module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, 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, Messaging, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" },
|
||||
new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));
|
||||
|
||||
|
||||
64
src/Orchard.Specs/Blogs.feature
Normal file
64
src/Orchard.Specs/Blogs.feature
Normal file
@@ -0,0 +1,64 @@
|
||||
Feature: Blog management
|
||||
In order to add blogs to my site
|
||||
As an author
|
||||
I want to create blogs and create, publish and edit blog posts
|
||||
|
||||
Scenario: In the admin (menu) there is a link to create a Blog
|
||||
Given I have installed Orchard
|
||||
When I go to "admin"
|
||||
Then I should see "<a href="/Admin/Blogs/Create">Blogs</a>"
|
||||
|
||||
Scenario: I can create a new blog and blog post
|
||||
Given I have installed Orchard
|
||||
When I go to "admin/blogs/create"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Routable.Title | My Blog |
|
||||
And I hit "Save"
|
||||
And I go to "my-blog"
|
||||
Then I should see "<h1[^>]*>.*?My Blog.*?</h1>"
|
||||
When I go to "admin/blogs/my-blog/posts/create"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Routable.Title | My Post |
|
||||
| Body.Text | Hi there. |
|
||||
And I hit "Publish Now"
|
||||
And I go to "my-blog/my-post"
|
||||
Then I should see "<h1[^>]*>.*?My Post.*?</h1>"
|
||||
And I should see "Hi there."
|
||||
|
||||
Scenario: I can create a new blog with multiple blog posts each with the same title and unique slugs are generated or given for said posts
|
||||
Given I have installed Orchard
|
||||
When I go to "admin/blogs/create"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Routable.Title | My Blog |
|
||||
And I hit "Save"
|
||||
And I go to "admin/blogs/my-blog/posts/create"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Routable.Title | My Post |
|
||||
| Body.Text | Hi there. |
|
||||
And I hit "Publish Now"
|
||||
And I go to "my-blog/my-post"
|
||||
Then I should see "<h1[^>]*>.*?My Post.*?</h1>"
|
||||
And I should see "Hi there."
|
||||
When I go to "admin/blogs/my-blog/posts/create"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Routable.Title | My Post |
|
||||
| Body.Text | Hi there, again. |
|
||||
And I hit "Publish Now"
|
||||
And I go to "my-blog/my-post-2"
|
||||
Then I should see "<h1[^>]*>.*?My Post.*?</h1>"
|
||||
And I should see "Hi there, again."
|
||||
When I go to "admin/blogs/my-blog/posts/create"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Routable.Title | My Post |
|
||||
| Routable.Slug | my-post |
|
||||
| Body.Text | Are you still there? |
|
||||
And I hit "Publish Now"
|
||||
And I go to "my-blog/my-post-3"
|
||||
Then I should see "<h1[^>]*>.*?My Post.*?</h1>"
|
||||
And I should see "Are you still there?"
|
||||
223
src/Orchard.Specs/Blogs.feature.cs
generated
Normal file
223
src/Orchard.Specs/Blogs.feature.cs
generated
Normal file
@@ -0,0 +1,223 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// <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("Blog management")]
|
||||
public partial class BlogManagementFeature
|
||||
{
|
||||
|
||||
private static TechTalk.SpecFlow.ITestRunner testRunner;
|
||||
|
||||
#line 1 "Blogs.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"), "Blog management", "In order to add blogs to my site\r\nAs an author\r\nI want to create blogs and create" +
|
||||
", publish and edit blog posts", 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("In the admin (menu) there is a link to create a Blog")]
|
||||
public virtual void InTheAdminMenuThereIsALinkToCreateABlog()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("In the admin (menu) there is a link to create a Blog", ((string[])(null)));
|
||||
#line 6
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 7
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 8
|
||||
testRunner.When("I go to \"admin\"");
|
||||
#line 9
|
||||
testRunner.Then("I should see \"<a href=\"/Admin/Blogs/Create\">Blogs</a>\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("I can create a new blog and blog post")]
|
||||
public virtual void ICanCreateANewBlogAndBlogPost()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can create a new blog and blog post", ((string[])(null)));
|
||||
#line 11
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 12
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 13
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table1.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Blog"});
|
||||
#line 14
|
||||
testRunner.And("I fill in", ((string)(null)), table1);
|
||||
#line 17
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 18
|
||||
testRunner.And("I go to \"my-blog\"");
|
||||
#line 19
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
|
||||
#line 20
|
||||
testRunner.When("I go to \"admin/blogs/my-blog/posts/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table2.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Post"});
|
||||
table2.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Hi there."});
|
||||
#line 21
|
||||
testRunner.And("I fill in", ((string)(null)), table2);
|
||||
#line 25
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 26
|
||||
testRunner.And("I go to \"my-blog/my-post\"");
|
||||
#line 27
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 28
|
||||
testRunner.And("I should see \"Hi there.\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("I can create a new blog with multiple blog posts each with the same title and uni" +
|
||||
"que slugs are generated or given for said posts")]
|
||||
public virtual void ICanCreateANewBlogWithMultipleBlogPostsEachWithTheSameTitleAndUniqueSlugsAreGeneratedOrGivenForSaidPosts()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can create a new blog with multiple blog posts each with the same title and uni" +
|
||||
"que slugs are generated or given for said posts", ((string[])(null)));
|
||||
#line 30
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 31
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 32
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table3.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Blog"});
|
||||
#line 33
|
||||
testRunner.And("I fill in", ((string)(null)), table3);
|
||||
#line 36
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 37
|
||||
testRunner.And("I go to \"admin/blogs/my-blog/posts/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table4.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Post"});
|
||||
table4.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Hi there."});
|
||||
#line 38
|
||||
testRunner.And("I fill in", ((string)(null)), table4);
|
||||
#line 42
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 43
|
||||
testRunner.And("I go to \"my-blog/my-post\"");
|
||||
#line 44
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 45
|
||||
testRunner.And("I should see \"Hi there.\"");
|
||||
#line 46
|
||||
testRunner.When("I go to \"admin/blogs/my-blog/posts/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table5.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Post"});
|
||||
table5.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Hi there, again."});
|
||||
#line 47
|
||||
testRunner.And("I fill in", ((string)(null)), table5);
|
||||
#line 51
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 52
|
||||
testRunner.And("I go to \"my-blog/my-post-2\"");
|
||||
#line 53
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 54
|
||||
testRunner.And("I should see \"Hi there, again.\"");
|
||||
#line 55
|
||||
testRunner.When("I go to \"admin/blogs/my-blog/posts/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table6.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Post"});
|
||||
table6.AddRow(new string[] {
|
||||
"Routable.Slug",
|
||||
"my-post"});
|
||||
table6.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Are you still there?"});
|
||||
#line 56
|
||||
testRunner.And("I fill in", ((string)(null)), table6);
|
||||
#line 61
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 62
|
||||
testRunner.And("I go to \"my-blog/my-post-3\"");
|
||||
#line 63
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 64
|
||||
testRunner.And("I should see \"Are you still there?\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -127,6 +127,11 @@
|
||||
<Compile Include="Bindings\CommandLine.cs" />
|
||||
<Compile Include="Bindings\ContentRights.cs" />
|
||||
<Compile Include="Bindings\OrchardSiteFactory.cs" />
|
||||
<Compile Include="Blogs.feature.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Blogs.feature</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ContentRights.feature.cs">
|
||||
<DependentUpon>ContentRights.feature</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
@@ -200,6 +205,10 @@
|
||||
<Content Include="Hosting\Orchard.Web\Config\Sites.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Blogs.feature">
|
||||
<Generator>SpecFlowSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Blogs.feature.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="ContentRights.feature">
|
||||
<Generator>SpecFlowSingleFileGenerator</Generator>
|
||||
<LastGenOutput>ContentRights.feature.cs</LastGenOutput>
|
||||
|
||||
@@ -17,5 +17,26 @@ Scenario: I can create and publish a new Page
|
||||
| Body.Text | This is super. |
|
||||
And I hit "Publish Now"
|
||||
And I go to "super-duper"
|
||||
Then I should see "<h1>Super Duper</h1>"
|
||||
And I should see "This is super."
|
||||
Then I should see "<h1[^>]*>.*?Super Duper.*?</h1>"
|
||||
And I should see "This is super."
|
||||
|
||||
Scenario: If I create a page which gets a conflicting path generated its path is made to be unique
|
||||
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 super. |
|
||||
And I hit "Publish Now"
|
||||
And I go to "super-duper"
|
||||
Then I should see "<h1[^>]*>.*?Super Duper.*?</h1>"
|
||||
And I should see "This is super."
|
||||
When I go to "admin/contents/create/page"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Routable.Title | Super Duper |
|
||||
| Body.Text | This is super number two. |
|
||||
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."
|
||||
61
src/Orchard.Specs/Pages.feature.cs
generated
61
src/Orchard.Specs/Pages.feature.cs
generated
@@ -98,9 +98,68 @@ this.ScenarioSetup(scenarioInfo);
|
||||
#line 19
|
||||
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.\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("If I create a page which gets a conflicting path generated its path is made to be" +
|
||||
" unique")]
|
||||
public virtual void IfICreateAPageWhichGetsAConflictingPathGeneratedItsPathIsMadeToBeUnique()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("If I create a page which gets a conflicting path generated its path is made to be" +
|
||||
" unique", ((string[])(null)));
|
||||
#line 23
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 24
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 25
|
||||
testRunner.When("I go to \"admin/contents/create/page\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table2.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"Super Duper"});
|
||||
table2.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"This is super."});
|
||||
#line 26
|
||||
testRunner.And("I fill in", ((string)(null)), table2);
|
||||
#line 30
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 31
|
||||
testRunner.And("I go to \"super-duper\"");
|
||||
#line 32
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?Super Duper.*?</h1>\"");
|
||||
#line 33
|
||||
testRunner.And("I should see \"This is super.\"");
|
||||
#line 34
|
||||
testRunner.When("I go to \"admin/contents/create/page\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table3.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"Super Duper"});
|
||||
table3.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"This is super number two."});
|
||||
#line 35
|
||||
testRunner.And("I fill in", ((string)(null)), table3);
|
||||
#line 39
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 40
|
||||
testRunner.And("I go to \"super-duper-2\"");
|
||||
#line 41
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?Super Duper.*?</h1>\"");
|
||||
#line 42
|
||||
testRunner.And("I should see \"This is super number two.\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user