mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing blogs spec flows.
--HG-- branch : 1.x
This commit is contained in:
@@ -221,6 +221,23 @@ namespace Orchard.Specs.Bindings {
|
|||||||
WhenIGoTo(urlPath);
|
WhenIGoTo(urlPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[When(@"I follow ""([^""]+)"" where class name has ""([^""]+)""")]
|
||||||
|
public void WhenIFollowClass(string linkText, string className) {
|
||||||
|
var link = _doc.DocumentNode
|
||||||
|
.SelectNodes("//a[@href]").Where(elt =>
|
||||||
|
(elt.InnerText == linkText ||
|
||||||
|
(elt.Attributes["title"] != null && elt.Attributes["title"].Value == linkText)) &&
|
||||||
|
elt.Attributes["class"].Value.IndexOf(className, StringComparison.OrdinalIgnoreCase) != -1).SingleOrDefault();
|
||||||
|
|
||||||
|
if (link == null) {
|
||||||
|
throw new InvalidOperationException(string.Format("Could not find an anchor with matching text '{0}' and class '{1}'. Document: {2}", linkText, className, _doc.DocumentNode.InnerHtml));
|
||||||
|
}
|
||||||
|
var href = link.Attributes["href"].Value;
|
||||||
|
var urlPath = HttpUtility.HtmlDecode(href);
|
||||||
|
|
||||||
|
WhenIGoTo(urlPath);
|
||||||
|
}
|
||||||
|
|
||||||
[When(@"I fill in")]
|
[When(@"I fill in")]
|
||||||
public void WhenIFillIn(Table table) {
|
public void WhenIFillIn(Table table) {
|
||||||
var inputs = _doc.DocumentNode
|
var inputs = _doc.DocumentNode
|
||||||
|
@@ -17,7 +17,7 @@ Scenario: I can create a new blog and blog post
|
|||||||
And I hit "Save"
|
And I hit "Save"
|
||||||
And I go to "admin/blogs"
|
And I go to "admin/blogs"
|
||||||
And I follow "My Blog"
|
And I follow "My Blog"
|
||||||
And I follow "New Post"
|
And I follow "New Post" where class name has "primaryAction"
|
||||||
And I fill in
|
And I fill in
|
||||||
| name | value |
|
| name | value |
|
||||||
| Routable.Title | My Post |
|
| Routable.Title | My Post |
|
||||||
@@ -39,7 +39,7 @@ Scenario: I can create a new blog with multiple blog posts each with the same ti
|
|||||||
And I hit "Save"
|
And I hit "Save"
|
||||||
And I go to "admin/blogs"
|
And I go to "admin/blogs"
|
||||||
And I follow "My Blog"
|
And I follow "My Blog"
|
||||||
And I follow "New Post"
|
And I follow "New Post" where class name has "primaryAction"
|
||||||
And I fill in
|
And I fill in
|
||||||
| name | value |
|
| name | value |
|
||||||
| Routable.Title | My Post |
|
| Routable.Title | My Post |
|
||||||
@@ -50,7 +50,7 @@ Scenario: I can create a new blog with multiple blog posts each with the same ti
|
|||||||
And I should see "Hi there."
|
And I should see "Hi there."
|
||||||
When I go to "admin/blogs"
|
When I go to "admin/blogs"
|
||||||
And I follow "My Blog"
|
And I follow "My Blog"
|
||||||
And I follow "New Post"
|
And I follow "New Post" where class name has "primaryAction"
|
||||||
And I fill in
|
And I fill in
|
||||||
| name | value |
|
| name | value |
|
||||||
| Routable.Title | My Post |
|
| Routable.Title | My Post |
|
||||||
@@ -61,7 +61,7 @@ Scenario: I can create a new blog with multiple blog posts each with the same ti
|
|||||||
And I should see "Hi there, again."
|
And I should see "Hi there, again."
|
||||||
When I go to "admin/blogs"
|
When I go to "admin/blogs"
|
||||||
And I follow "My Blog"
|
And I follow "My Blog"
|
||||||
And I follow "New Post"
|
And I follow "New Post" where class name has "primaryAction"
|
||||||
And I fill in
|
And I fill in
|
||||||
| name | value |
|
| name | value |
|
||||||
| Routable.Title | My Post |
|
| Routable.Title | My Post |
|
||||||
@@ -83,7 +83,7 @@ Scenario: I can create a new blog and blog post and when I change the slug of th
|
|||||||
Then I should see "<h1[^>]*>.*?My Blog.*?</h1>"
|
Then I should see "<h1[^>]*>.*?My Blog.*?</h1>"
|
||||||
When I go to "admin/blogs"
|
When I go to "admin/blogs"
|
||||||
And I follow "My Blog"
|
And I follow "My Blog"
|
||||||
And I follow "New Post"
|
And I follow "New Post" where class name has "primaryAction"
|
||||||
And I fill in
|
And I fill in
|
||||||
| name | value |
|
| name | value |
|
||||||
| Routable.Title | My Post |
|
| Routable.Title | My Post |
|
||||||
@@ -114,7 +114,7 @@ Scenario: When viewing a blog the user agent is given an RSS feed of the blog's
|
|||||||
And I hit "Save"
|
And I hit "Save"
|
||||||
And I go to "admin/blogs"
|
And I go to "admin/blogs"
|
||||||
And I follow "My Blog"
|
And I follow "My Blog"
|
||||||
And I follow "New Post"
|
And I follow "New Post" where class name has "primaryAction"
|
||||||
And I fill in
|
And I fill in
|
||||||
| name | value |
|
| name | value |
|
||||||
| Routable.Title | My Post |
|
| Routable.Title | My Post |
|
||||||
@@ -151,7 +151,7 @@ Scenario: The virtual path of my installation when not at the root is reflected
|
|||||||
And I hit "Save"
|
And I hit "Save"
|
||||||
And I go to "admin/blogs"
|
And I go to "admin/blogs"
|
||||||
And I follow "My Blog"
|
And I follow "My Blog"
|
||||||
And I follow "New Post"
|
And I follow "New Post" where class name has "primaryAction"
|
||||||
Then I should see "<span>http\://localhost/OrchardLocal/my-blog/</span>"
|
Then I should see "<span>http\://localhost/OrchardLocal/my-blog/</span>"
|
||||||
|
|
||||||
Scenario: The virtual path of my installation when at the root is reflected in the URL example for the slug field when creating a blog or blog post
|
Scenario: The virtual path of my installation when at the root is reflected in the URL example for the slug field when creating a blog or blog post
|
||||||
@@ -164,7 +164,7 @@ Scenario: The virtual path of my installation when at the root is reflected in t
|
|||||||
And I hit "Save"
|
And I hit "Save"
|
||||||
And I go to "admin/blogs"
|
And I go to "admin/blogs"
|
||||||
And I follow "My Blog"
|
And I follow "My Blog"
|
||||||
And I follow "New Post"
|
And I follow "New Post" where class name has "primaryAction"
|
||||||
Then I should see "<span>http\://localhost/my-blog/</span>"
|
Then I should see "<span>http\://localhost/my-blog/</span>"
|
||||||
|
|
||||||
Scenario: I set my blog to be the content for the home page and the posts for the blog be rooted to the app
|
Scenario: I set my blog to be the content for the home page and the posts for the blog be rooted to the app
|
||||||
@@ -177,7 +177,7 @@ Scenario: I set my blog to be the content for the home page and the posts for th
|
|||||||
And I hit "Save"
|
And I hit "Save"
|
||||||
And I go to "admin/blogs"
|
And I go to "admin/blogs"
|
||||||
And I follow "My Blog"
|
And I follow "My Blog"
|
||||||
And I follow "New Post"
|
And I follow "New Post" where class name has "primaryAction"
|
||||||
And I fill in
|
And I fill in
|
||||||
| name | value |
|
| name | value |
|
||||||
| Routable.Title | My Post |
|
| Routable.Title | My Post |
|
||||||
|
22
src/Orchard.Specs/Blogs.feature.cs
generated
22
src/Orchard.Specs/Blogs.feature.cs
generated
@@ -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.4.0.0
|
// SpecFlow Version:1.5.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.4.0.0")]
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.5.0.0")]
|
||||||
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[NUnit.Framework.TestFixtureAttribute()]
|
[NUnit.Framework.TestFixtureAttribute()]
|
||||||
[NUnit.Framework.DescriptionAttribute("Blog")]
|
[NUnit.Framework.DescriptionAttribute("Blog")]
|
||||||
@@ -97,7 +97,7 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
#line 19
|
#line 19
|
||||||
testRunner.And("I follow \"My Blog\"");
|
testRunner.And("I follow \"My Blog\"");
|
||||||
#line 20
|
#line 20
|
||||||
testRunner.And("I follow \"New Post\"");
|
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
|
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
|
||||||
"name",
|
"name",
|
||||||
@@ -157,7 +157,7 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
#line 41
|
#line 41
|
||||||
testRunner.And("I follow \"My Blog\"");
|
testRunner.And("I follow \"My Blog\"");
|
||||||
#line 42
|
#line 42
|
||||||
testRunner.And("I follow \"New Post\"");
|
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
|
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
|
||||||
"name",
|
"name",
|
||||||
@@ -183,7 +183,7 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
#line 52
|
#line 52
|
||||||
testRunner.And("I follow \"My Blog\"");
|
testRunner.And("I follow \"My Blog\"");
|
||||||
#line 53
|
#line 53
|
||||||
testRunner.And("I follow \"New Post\"");
|
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||||
#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",
|
||||||
@@ -209,7 +209,7 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
#line 63
|
#line 63
|
||||||
testRunner.And("I follow \"My Blog\"");
|
testRunner.And("I follow \"My Blog\"");
|
||||||
#line 64
|
#line 64
|
||||||
testRunner.And("I follow \"New Post\"");
|
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
|
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
|
||||||
"name",
|
"name",
|
||||||
@@ -270,7 +270,7 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
#line 85
|
#line 85
|
||||||
testRunner.And("I follow \"My Blog\"");
|
testRunner.And("I follow \"My Blog\"");
|
||||||
#line 86
|
#line 86
|
||||||
testRunner.And("I follow \"New Post\"");
|
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
|
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
|
||||||
"name",
|
"name",
|
||||||
@@ -349,7 +349,7 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
#line 116
|
#line 116
|
||||||
testRunner.And("I follow \"My Blog\"");
|
testRunner.And("I follow \"My Blog\"");
|
||||||
#line 117
|
#line 117
|
||||||
testRunner.And("I follow \"New Post\"");
|
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
|
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
|
||||||
"name",
|
"name",
|
||||||
@@ -452,7 +452,7 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
#line 153
|
#line 153
|
||||||
testRunner.And("I follow \"My Blog\"");
|
testRunner.And("I follow \"My Blog\"");
|
||||||
#line 154
|
#line 154
|
||||||
testRunner.And("I follow \"New Post\"");
|
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||||
#line 155
|
#line 155
|
||||||
testRunner.Then("I should see \"<span>http\\://localhost/OrchardLocal/my-blog/</span>\"");
|
testRunner.Then("I should see \"<span>http\\://localhost/OrchardLocal/my-blog/</span>\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
@@ -490,7 +490,7 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
#line 166
|
#line 166
|
||||||
testRunner.And("I follow \"My Blog\"");
|
testRunner.And("I follow \"My Blog\"");
|
||||||
#line 167
|
#line 167
|
||||||
testRunner.And("I follow \"New Post\"");
|
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||||
#line 168
|
#line 168
|
||||||
testRunner.Then("I should see \"<span>http\\://localhost/my-blog/</span>\"");
|
testRunner.Then("I should see \"<span>http\\://localhost/my-blog/</span>\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
@@ -529,7 +529,7 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
#line 179
|
#line 179
|
||||||
testRunner.And("I follow \"My Blog\"");
|
testRunner.And("I follow \"My Blog\"");
|
||||||
#line 180
|
#line 180
|
||||||
testRunner.And("I follow \"New Post\"");
|
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
|
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
|
||||||
"name",
|
"name",
|
||||||
|
Reference in New Issue
Block a user