Fix some specflow tests to not being ignored anymore

--HG--
branch : 1.x
This commit is contained in:
Renaud Paquay
2011-01-08 10:56:54 -08:00
parent c1e272028b
commit 83b11865eb
3 changed files with 41 additions and 45 deletions

View File

@@ -294,29 +294,22 @@ namespace Orchard.Specs.Bindings {
Assert.That(Details.ResponseHeaders["Content-Type"], Is.StringMatching(contentType));
}
[Then(@"I should see ""([^""]*)""")]
[Then(@"I should see ""(.*)""")]
public void ThenIShouldSee(string text) {
Assert.That(Details.ResponseText, Is.StringMatching(text));
}
[Then(@"I should not see ""([^""]*)""")]
[Then(@"I should not see ""(.*)""")]
public void ThenIShouldNotSee(string text) {
Assert.That(Details.ResponseText, Is.Not.StringContaining(text));
}
[Then(@"the title contains ""([^""]*)""")]
[Then(@"the title contains ""(.*)""")]
public void ThenTheTitleContainsText(string text) {
ScenarioContext.Current.Pending();
}
[Then(@"I should see ""([^""]*)"" when I go to ""([^""]*)""")]
public void ThenIShouldSeeWhenIGoTo(string text, string urlPath) {
WhenIGoTo(urlPath);
ThenIShouldSee(text);
}
[Then(@"I should be denied access when I go to ""([^""]*)""")]
[Then(@"I should be denied access when I go to ""(.*)""")]
public void ThenIShouldBeDeniedAccessWhenIGoTo(string urlPath) {
WhenIGoTo(urlPath);
WhenIAmRedirected();

View File

@@ -1,28 +1,29 @@
Feature: Addition
In order to prevent security model regressions
As a user with specific permissions
I should to be granted or denied access to various actions
In order to prevent security model regressions
As a user with specific permissions
I should to be granted or denied access to various actions
@security
Scenario: Login can be automated
Given I have installed Orchard
And I have a user "bob" with permissions "AccessFrontEnd"
When I go to "users/account/logoff"
And I go to "users/account/logon"
And I fill in
| name | value |
| userNameOrEmail | bob |
| password | qwerty123! |
And I hit "Sign In"
And I am redirected
Then I should see "Welcome"
And I should see "bob"
Given I have installed Orchard
And I have a user "bob" with permissions "AccessFrontEnd"
When I go to "users/account/logoff"
And I go to "users/account/logon"
And I fill in
| name | value |
| userNameOrEmail | bob |
| password | qwerty123! |
And I hit "Sign In"
And I am redirected
Then I should see "Welcome"
And I should see "bob"
@security
Scenario: Anonymous user can see the home page but not the dashboard
Given I have installed Orchard
And I have a user "bob" with permissions "AccessFrontEnd"
When I sign in as "bob"
Then I should see "this is the homepage of your new site" when I go to "/"
And I should be denied access when I go to "admin"
Given I have installed Orchard
And I have a user "bob" with permissions "AccessFrontEnd"
When I sign in as "bob"
And I go to "/"
Then I should see "this is the homepage of your new site"
And I should be denied access when I go to "admin"

View File

@@ -63,13 +63,13 @@ namespace Orchard.Specs
#line 7
this.ScenarioSetup(scenarioInfo);
#line 8
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 9
testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\"");
testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\"");
#line 10
testRunner.When("I go to \"users/account/logoff\"");
testRunner.When("I go to \"users/account/logoff\"");
#line 11
testRunner.And("I go to \"users/account/logon\"");
testRunner.And("I go to \"users/account/logon\"");
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -81,15 +81,15 @@ this.ScenarioSetup(scenarioInfo);
"password",
"qwerty123!"});
#line 12
testRunner.And("I fill in", ((string)(null)), table1);
testRunner.And("I fill in", ((string)(null)), table1);
#line 16
testRunner.And("I hit \"Sign In\"");
testRunner.And("I hit \"Sign In\"");
#line 17
testRunner.And("I am redirected");
testRunner.And("I am redirected");
#line 18
testRunner.Then("I should see \"Welcome\"");
testRunner.Then("I should see \"Welcome\"");
#line 19
testRunner.And("I should see \"bob\"");
testRunner.And("I should see \"bob\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -104,15 +104,17 @@ this.ScenarioSetup(scenarioInfo);
#line 22
this.ScenarioSetup(scenarioInfo);
#line 23
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 24
testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\"");
testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\"");
#line 25
testRunner.When("I sign in as \"bob\"");
testRunner.When("I sign in as \"bob\"");
#line 26
testRunner.Then("I should see \"this is the homepage of your new site\" when I go to \"/\"");
testRunner.And("I go to \"/\"");
#line 27
testRunner.And("I should be denied access when I go to \"admin\"");
testRunner.Then("I should see \"this is the homepage of your new site\"");
#line 28
testRunner.And("I should be denied access when I go to \"admin\"");
#line hidden
testRunner.CollectScenarioErrors();
}