Move locators above step definitions

The locators are moved above the step definitions for consistency with
other context files; besides that I made some minor adjustments for
consistency too in the locator descriptions and identation, and moved
the locators for ".newCommentRow" descendants together.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2018-02-15 16:34:48 +01:00
parent 38a03f3193
commit f6737e43e9
1 changed files with 26 additions and 21 deletions

View File

@ -26,6 +26,32 @@ use Behat\Behat\Context\Context;
class CommentsAppContext implements Context, ActorAwareInterface { class CommentsAppContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
/**
* @return Locator
*/
public static function newCommentField() {
return Locator::forThe()->css("div.newCommentRow .message")->
descendantOf(FilesAppContext::currentSectionDetailsView())->
describedAs("New comment field in current section details view in Files app");
}
/**
* @return Locator
*/
public static function submitNewCommentButton() {
return Locator::forThe()->css("div.newCommentRow .submit")->
descendantOf(FilesAppContext::currentSectionDetailsView())->
describedAs("Submit new comment button in current section details view in Files app");
}
/**
* @return Locator
*/
public static function commentFields() {
return Locator::forThe()->css(".comments .comment .message")->
descendantOf(FilesAppContext::currentSectionDetailsView())->
describedAs("Comment fields in current section details view in Files app");
}
/** /**
* @When /^I create a new comment with "([^"]*)" as message$/ * @When /^I create a new comment with "([^"]*)" as message$/
@ -58,25 +84,4 @@ class CommentsAppContext implements Context, ActorAwareInterface {
} }
return true; return true;
} }
/**
* @return Locator
*/
public static function newCommentField() {
return Locator::forThe()->css("div.newCommentRow .message")->descendantOf(FilesAppContext::currentSectionDetailsView())->
describedAs("New comment field in the details view in Files app");
}
public static function commentFields() {
return Locator::forThe()->css(".comments .comment .message")->descendantOf(FilesAppContext::currentSectionDetailsView())->
describedAs("Comment fields in the details view in Files app");
}
/**
* @return Locator
*/
public static function submitNewCommentButton() {
return Locator::forThe()->css("div.newCommentRow .submit")->descendantOf(FilesAppContext::currentSectionDetailsView())->
describedAs("Submit new comment button in the details view in Files app");
}
} }