summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-02-16 10:27:25 +0100
committerGitHub <noreply@github.com>2018-02-16 10:27:25 +0100
commit66654bbd18c2e5bf6ccf5785b653643e641c3193 (patch)
tree8590eb263e321a9102ee59475fb8f42038a4313d
parent620ee00ac5d176e85ba0dd9dd10cff6d1ef5172f (diff)
parent81fdbc6554a7a9f3227e1a66a529bcd1f132b810 (diff)
downloadnextcloud-server-66654bbd18c2e5bf6ccf5785b653643e641c3193.tar.gz
nextcloud-server-66654bbd18c2e5bf6ccf5785b653643e641c3193.zip
Merge pull request #8382 from nextcloud/make-acceptance-tests-for-comments-more-consistent-with-the-others
Make acceptance tests for comments more consistent with the others
-rw-r--r--.drone.yml9
-rw-r--r--tests/acceptance/features/app-comments.feature2
-rw-r--r--tests/acceptance/features/bootstrap/CommentsAppContext.php64
3 files changed, 41 insertions, 34 deletions
diff --git a/.drone.yml b/.drone.yml
index 614c0dc40c2..9ccd231832c 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -549,6 +549,13 @@ pipeline:
when:
matrix:
TESTS-ACCEPTANCE: access-levels
+ acceptance-app-comments:
+ image: nextcloudci/integration-php7.0:integration-php7.0-6
+ commands:
+ - tests/acceptance/run-local.sh --timeout-multiplier 10 --nextcloud-server-domain acceptance-app-comments --selenium-server selenium:4444 allow-git-repository-modifications features/app-comments.feature
+ when:
+ matrix:
+ TESTS-ACCEPTANCE: app-comments
acceptance-app-files:
image: nextcloudci/integration-php7.0:integration-php7.0-6
commands:
@@ -727,6 +734,8 @@ matrix:
- TESTS: acceptance
TESTS-ACCEPTANCE: access-levels
- TESTS: acceptance
+ TESTS-ACCEPTANCE: access-comments
+ - TESTS: acceptance
TESTS-ACCEPTANCE: app-files
- TESTS: acceptance
TESTS-ACCEPTANCE: app-theming
diff --git a/tests/acceptance/features/app-comments.feature b/tests/acceptance/features/app-comments.feature
index 81fc6f89ad1..a5bdb0aa745 100644
--- a/tests/acceptance/features/app-comments.feature
+++ b/tests/acceptance/features/app-comments.feature
@@ -5,4 +5,4 @@ Feature: app-comments
And I open the details view for "welcome.txt"
And I open the "Comments" tab in the details view
When I create a new comment with "Hello world" as message
- Then I see that a comment was added
+ Then I see a comment with "Hello world" as message
diff --git a/tests/acceptance/features/bootstrap/CommentsAppContext.php b/tests/acceptance/features/bootstrap/CommentsAppContext.php
index 64d1dc69bc4..7e804cfac23 100644
--- a/tests/acceptance/features/bootstrap/CommentsAppContext.php
+++ b/tests/acceptance/features/bootstrap/CommentsAppContext.php
@@ -26,57 +26,55 @@ use Behat\Behat\Context\Context;
class CommentsAppContext implements Context, ActorAwareInterface {
use ActorAware;
-
/**
- * @When /^I create a new comment with "([^"]*)" as message$/
+ * @return Locator
*/
- public function iCreateANewCommentWithAsMessage($commentText) {
- $this->actor->find(self::newCommentField(), 2)->setValue($commentText);
- $this->actor->find(self::submitNewCommentButton(), 2)->click();
+ 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");
}
/**
- * @Then /^I see that a comment was added$/
+ * @return Locator
*/
- public function iSeeThatACommentWasAdded() {
- $self = $this;
-
- $result = Utils::waitFor(function () use ($self) {
- return $self->isCommentAdded();
- }, 5, 0.5);
-
- PHPUnit_Framework_Assert::assertTrue($result);
+ 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");
}
- public function isCommentAdded() {
- try {
- $locator = self::commentFields();
- $comments = $this->actor->getSession()->getPage()->findAll($locator->getSelector(), $locator->getLocator());
- PHPUnit_Framework_Assert::assertSame(1, count($comments));
- } catch (PHPUnit_Framework_ExpectationFailedException $e) {
- return false;
- }
- return true;
+ /**
+ * @return Locator
+ */
+ public static function commentList() {
+ return Locator::forThe()->css("ul.comments")->
+ descendantOf(FilesAppContext::currentSectionDetailsView())->
+ describedAs("Comment list in current section details view in Files app");
}
/**
* @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 commentWithText($text) {
+ return Locator::forThe()->xpath("//div[normalize-space() = '$text']/ancestor::li")->
+ descendantOf(self::commentList())->
+ describedAs("Comment with text \"$text\" in current section 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");
+ /**
+ * @When /^I create a new comment with "([^"]*)" as message$/
+ */
+ public function iCreateANewCommentWithAsMessage($commentText) {
+ $this->actor->find(self::newCommentField(), 10)->setValue($commentText);
+ $this->actor->find(self::submitNewCommentButton())->click();
}
/**
- * @return Locator
+ * @Then /^I see a comment with "([^"]*)" as message$/
*/
- 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");
+ public function iSeeACommentWithAsMessage($commentText) {
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::commentWithText($commentText), 10)->isVisible());
}
}