--HG--
branch : 1.x
This commit is contained in:
Nathan Heskew
2011-04-07 15:59:37 -07:00
54 changed files with 640 additions and 348 deletions

View File

@@ -222,6 +222,23 @@ namespace Orchard.Specs.Bindings {
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")]
public void WhenIFillIn(Table table) {
var inputs = _doc.DocumentNode

View File

@@ -17,7 +17,7 @@ Scenario: I can create a new blog and blog post
And I hit "Save"
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post"
And I follow "New Post" where class name has "primaryAction"
And I fill in
| name | value |
| 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 go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post"
And I follow "New Post" where class name has "primaryAction"
And I fill in
| name | value |
| 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."
When I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post"
And I follow "New Post" where class name has "primaryAction"
And I fill in
| name | value |
| 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."
When I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post"
And I follow "New Post" where class name has "primaryAction"
And I fill in
| name | value |
| 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>"
When I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post"
And I follow "New Post" where class name has "primaryAction"
And I fill in
| name | value |
| 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 go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post"
And I follow "New Post" where class name has "primaryAction"
And I fill in
| name | value |
| 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 go to "admin/blogs"
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>"
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 go to "admin/blogs"
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>"
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 go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post"
And I follow "New Post" where class name has "primaryAction"
And I fill in
| name | value |
| Routable.Title | My Post |

View File

@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// 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
//
// 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.4.0.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.5.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Blog")]
@@ -97,7 +97,7 @@ this.ScenarioSetup(scenarioInfo);
#line 19
testRunner.And("I follow \"My Blog\"");
#line 20
testRunner.And("I follow \"New Post\"");
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -157,7 +157,7 @@ this.ScenarioSetup(scenarioInfo);
#line 41
testRunner.And("I follow \"My Blog\"");
#line 42
testRunner.And("I follow \"New Post\"");
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -183,7 +183,7 @@ this.ScenarioSetup(scenarioInfo);
#line 52
testRunner.And("I follow \"My Blog\"");
#line 53
testRunner.And("I follow \"New Post\"");
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -209,7 +209,7 @@ this.ScenarioSetup(scenarioInfo);
#line 63
testRunner.And("I follow \"My Blog\"");
#line 64
testRunner.And("I follow \"New Post\"");
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -270,7 +270,7 @@ this.ScenarioSetup(scenarioInfo);
#line 85
testRunner.And("I follow \"My Blog\"");
#line 86
testRunner.And("I follow \"New Post\"");
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -349,7 +349,7 @@ this.ScenarioSetup(scenarioInfo);
#line 116
testRunner.And("I follow \"My Blog\"");
#line 117
testRunner.And("I follow \"New Post\"");
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -452,7 +452,7 @@ this.ScenarioSetup(scenarioInfo);
#line 153
testRunner.And("I follow \"My Blog\"");
#line 154
testRunner.And("I follow \"New Post\"");
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line 155
testRunner.Then("I should see \"<span>http\\://localhost/OrchardLocal/my-blog/</span>\"");
#line hidden
@@ -490,7 +490,7 @@ this.ScenarioSetup(scenarioInfo);
#line 166
testRunner.And("I follow \"My Blog\"");
#line 167
testRunner.And("I follow \"New Post\"");
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line 168
testRunner.Then("I should see \"<span>http\\://localhost/my-blog/</span>\"");
#line hidden
@@ -529,7 +529,7 @@ this.ScenarioSetup(scenarioInfo);
#line 179
testRunner.And("I follow \"My Blog\"");
#line 180
testRunner.And("I follow \"New Post\"");
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
"name",

View File

@@ -12,7 +12,7 @@ Scenario: HTML markup in any given comment is encoded
And I hit "Save"
And I go to "admin/blogs"
And I follow "My Blog"
And I follow "New Post"
And I follow "New Post" where class name has "primaryAction"
And I fill in
| name | value |
| Routable.Title | My Post |

View File

@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// 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
//
// 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.4.0.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.5.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Comments")]
@@ -80,7 +80,7 @@ this.ScenarioSetup(scenarioInfo);
#line 14
testRunner.And("I follow \"My Blog\"");
#line 15
testRunner.And("I follow \"New Post\"");
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",

View File

@@ -1,11 +1,11 @@
Feature: Lists
In order to add new lists to my site
As an administrator
I want to create lists
Scenario: I can create a new list
Given I have installed Orchard
When I go to "Admin/Contents/Create/List"
Feature: Lists
In order to add new lists to my site
As an administrator
I want to create lists
Scenario: I can create a new list
Given I have installed Orchard
When I go to "Admin/Contents/Create/List"
And I fill in
| name | value |
| Routable.Title | MyList |
@@ -13,25 +13,25 @@ Scenario: I can create a new list
And I go to "Admin/Contents/List/List"
Then I should see "MyList"
Scenario: I can add content items to a list
Given I have installed Orchard
And I have a containable content type "MyType"
When I go to "Admin/Contents/Create/List"
Scenario: I can add content items to a list
Given I have installed Orchard
And I have a containable content type "MyType"
When I go to "Admin/Contents/Create/List"
And I fill in
| name | value |
| Routable.Title | MyList |
And I hit "Save"
And I go to "Admin/Contents/List/List"
Then I should see "MyList"
When I follow "Contained Items"
Then I should see "The 'MyList' List has no content items."
When I follow "Create New Content" where href has "ReturnUrl"
Then I should see "MyType"
When I follow "MyType" where href has "ReturnUrl"
When I follow "Contained Items"
Then I should see "The 'MyList' List has no content items."
When I follow "Create New Content" where href has "ReturnUrl"
Then I should see "MyType"
When I follow "MyType" where href has "ReturnUrl"
And I fill in
| name | value |
| Routable.Title | MyContentItem |
And I hit "Save"
And I am redirected
Then I should see "Manage Content for MyList"
And I should see "MyContentItem"
And I am redirected
Then I should see "Manage MyList"
And I should see "MyContentItem"

View File

@@ -30,7 +30,8 @@ namespace Orchard.Specs
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Lists", "In order to add new lists to my site\nAs an administrator\nI want to create lists", GenerationTargetLanguage.CSharp, ((string[])(null)));
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Lists", "In order to add new lists to my site\r\nAs an administrator\r\nI want to create lists" +
"", GenerationTargetLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
@@ -60,9 +61,9 @@ 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/Contents/Create/List\"");
testRunner.When("I go to \"Admin/Contents/Create/List\"");
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -90,11 +91,11 @@ this.ScenarioSetup(scenarioInfo);
#line 16
this.ScenarioSetup(scenarioInfo);
#line 17
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 18
testRunner.And("I have a containable content type \"MyType\"");
testRunner.And("I have a containable content type \"MyType\"");
#line 19
testRunner.When("I go to \"Admin/Contents/Create/List\"");
testRunner.When("I go to \"Admin/Contents/Create/List\"");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -111,15 +112,15 @@ this.ScenarioSetup(scenarioInfo);
#line 25
testRunner.Then("I should see \"MyList\"");
#line 26
testRunner.When("I follow \"Contained Items\"");
testRunner.When("I follow \"Contained Items\"");
#line 27
testRunner.Then("I should see \"The \'MyList\' List has no content items.\"");
testRunner.Then("I should see \"The \'MyList\' List has no content items.\"");
#line 28
testRunner.When("I follow \"Create New Content\" where href has \"ReturnUrl\"");
testRunner.When("I follow \"Create New Content\" where href has \"ReturnUrl\"");
#line 29
testRunner.Then("I should see \"MyType\"");
testRunner.Then("I should see \"MyType\"");
#line 30
testRunner.When("I follow \"MyType\" where href has \"ReturnUrl\"");
testRunner.When("I follow \"MyType\" where href has \"ReturnUrl\"");
#line hidden
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -132,11 +133,11 @@ this.ScenarioSetup(scenarioInfo);
#line 34
testRunner.And("I hit \"Save\"");
#line 35
testRunner.And("I am redirected");
testRunner.And("I am redirected");
#line 36
testRunner.Then("I should see \"Manage Content for MyList\"");
testRunner.Then("I should see \"Manage MyList\"");
#line 37
testRunner.And("I should see \"MyContentItem\"");
testRunner.And("I should see \"MyContentItem\"");
#line hidden
testRunner.CollectScenarioErrors();
}

View File

@@ -7,7 +7,7 @@ Scenario: Media admin is available
Given I have installed Orchard
And I have installed "Orchard.Media"
When I go to "admin/media"
Then I should see "Manage Media Folders"
Then I should see "Media"
And the status should be 200 "OK"
Scenario: Creating a folder
@@ -19,7 +19,7 @@ Scenario: Creating a folder
| Name | Hello World |
And I hit "Save"
And I am redirected
Then I should see "Manage Media Folders"
Then I should see "Media"
And I should see "Hello World"
And the status should be 200 "OK"
@@ -28,6 +28,6 @@ Scenario: Limited access
And I have installed "Orchard.Media"
When I go to "admin/media/edit?name=..\..\bin&mediaPath=..\..\bin"
And I am redirected
Then I should see "Manage Media Folders"
Then I should see "Media"
And I should see "Editing failed: Invalid path"
And the status should be 200 "OK"

View File

@@ -67,7 +67,7 @@ this.ScenarioSetup(scenarioInfo);
#line 9
testRunner.When("I go to \"admin/media\"");
#line 10
testRunner.Then("I should see \"Manage Media Folders\"");
testRunner.Then("I should see \"Media\"");
#line 11
testRunner.And("the status should be 200 \"OK\"");
#line hidden
@@ -101,7 +101,7 @@ this.ScenarioSetup(scenarioInfo);
#line 21
testRunner.And("I am redirected");
#line 22
testRunner.Then("I should see \"Manage Media Folders\"");
testRunner.Then("I should see \"Media\"");
#line 23
testRunner.And("I should see \"Hello World\"");
#line 24
@@ -126,7 +126,7 @@ this.ScenarioSetup(scenarioInfo);
#line 30
testRunner.And("I am redirected");
#line 31
testRunner.Then("I should see \"Manage Media Folders\"");
testRunner.Then("I should see \"Media\"");
#line 32
testRunner.And("I should see \"Editing failed: Invalid path\"");
#line 33

View File

@@ -7,14 +7,14 @@
Scenario: There is only one user by default
Given I have installed Orchard
When I go to "admin/users"
Then I should see "Manage Users"
Then I should see "Users"
And I should see "<a[^>]*>admin</a>"
@management
Scenario: I can create a new user
Given I have installed Orchard
When I go to "admin/users"
Then I should see "Manage Users"
Then I should see "Users"
When I follow "Add a new user"
And I fill in
| name | value |

View File

@@ -2,7 +2,7 @@
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.5.0.0
// Runtime Version:4.0.30319.225
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -67,7 +67,7 @@ this.ScenarioSetup(scenarioInfo);
#line 9
testRunner.When("I go to \"admin/users\"");
#line 10
testRunner.Then("I should see \"Manage Users\"");
testRunner.Then("I should see \"Users\"");
#line 11
testRunner.And("I should see \"<a[^>]*>admin</a>\"");
#line hidden
@@ -88,7 +88,7 @@ this.ScenarioSetup(scenarioInfo);
#line 16
testRunner.When("I go to \"admin/users\"");
#line 17
testRunner.Then("I should see \"Manage Users\"");
testRunner.Then("I should see \"Users\"");
#line 18
testRunner.When("I follow \"Add a new user\"");
#line hidden