mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Adding SpecFlow bindings for integration testing user's permissions
Enables automated testing of urls and redirects with querystring Adds bindings for: -Creating account with a fixed set of permissions -Login of a user -Success criteria for seeing text on a page -Success criteria for being denied access to a page --HG-- branch : dev extra : rebase_source : 66e7b33cf7a596050d27eda6351605ed86420af2
This commit is contained in:
@@ -294,20 +294,34 @@ 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 ""([^""]*)""")]
|
||||
public void ThenIShouldBeDeniedAccessWhenIGoTo(string urlPath) {
|
||||
WhenIGoTo(urlPath);
|
||||
WhenIAmRedirected();
|
||||
ThenIShouldSee("Access Denied");
|
||||
}
|
||||
}
|
||||
|
||||
public class Form {
|
||||
|
Reference in New Issue
Block a user