diff --git a/RoboFile.php b/RoboFile.php index 1d5022ceced82..ac7010482910d 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -273,6 +273,15 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop']) ->run() ->stopOnFail(); + $this->taskCodecept($pathToCodeception) + ->arg('--steps') + ->arg('--debug') + ->arg('--fail-fast') + ->arg('--env ' . $opts['env']) + ->arg('tests/acceptance/content.feature') + ->run() + ->stopOnFail(); + $this->taskCodecept($pathToCodeception) ->arg('--steps') ->arg('--debug') diff --git a/tests/_support/AcceptanceHelper.php b/tests/_support/AcceptanceHelper.php index c7ff62738149e..b127afaffb7ed 100644 --- a/tests/_support/AcceptanceHelper.php +++ b/tests/_support/AcceptanceHelper.php @@ -1,22 +1,28 @@ config[$element]; + + return self::$acceptanceSuiteConfiguration; } } \ No newline at end of file diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 1b7f1cb3ba432..872a35ce60d73 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -1,7 +1,5 @@ getConfiguration('window_size')); + $suiteConfiguration = $I->getSuiteConfiguration(); + $screenWidth = explode("x", $suiteConfiguration['modules']['config']['JoomlaBrowser']['window_size']); - if ($screenSize[0] <= 480) + if ($screenWidth[0] <= 480) { $I->click('Toolbar'); } diff --git a/tests/_support/Page/Acceptance/Administrator/ArticleManagerPage.php b/tests/_support/Page/Acceptance/Administrator/ArticleManagerPage.php new file mode 100644 index 0000000000000..2b65fc5f6449c --- /dev/null +++ b/tests/_support/Page/Acceptance/Administrator/ArticleManagerPage.php @@ -0,0 +1,20 @@ + 'jform_title']; + + public static $articleContentField = ['id' => 'jform_articletext']; + + public static $toggleEditor = "Toggle editor"; + + public static $filterSearch = ['id' => 'filter_search']; + + public static $iconSearch = ['class' => 'icon-search']; + + public static $pageURL = "/administrator/index.php?option=com_content&view=articles"; + +} diff --git a/tests/_support/Step/Acceptance/Administrator/Content.php b/tests/_support/Step/Acceptance/Administrator/Content.php new file mode 100644 index 0000000000000..50cb09b03fafc --- /dev/null +++ b/tests/_support/Step/Acceptance/Administrator/Content.php @@ -0,0 +1,172 @@ +amOnPage(ArticleManagerPage::$pageURL); + $I->clickToolbarButton('New'); + } + + /** + * @When I create new content with field title as :title and content as a :content + */ + public function iCreateNewContent($title, $content) + { + $I = $this; + $I->fillField(ArticleManagerPage::$articleTitleField, $title); + $I->click(ArticleManagerPage::$toggleEditor); + $I->fillField(ArticleManagerPage::$articleContentField, $content); + } + + /** + * @When I save an article + */ + public function iSaveAnArticle() + { + $I = $this; + $I->clickToolbarButton('Save'); + } + + /** + * @Then I should see the :arg1 message + */ + public function iShouldSeeTheMessage($message) + { + $I = $this; + $I->waitForPageTitle('Articles'); + $I->see($message, AdminPage::$systemMessageContainer); + } + + /** + * @Given I search and select content article with title :arg1 + */ + public function iSearchAndSelectContentArticleWithTitle($title) + { + $I = $this; + $I->amOnPage(ArticleManagerPage::$pageURL); + $I->fillField(ArticleManagerPage::$filterSearch, $title); + $I->click(ArticleManagerPage::$iconSearch); + $I->checkAllResults(); + } + + /** + * @When I featured the article + */ + public function iFeatureTheContentWithTitle() + { + $I = $this; + $I->clickToolbarButton('featured'); + } + + /** + * @Then I save and see the :arg1 message + */ + public function iSaveAndSeeTheMessage($message) + { + $I = $this; + $I->waitForPageTitle('Articles'); + $I->see($message, AdminPage::$systemMessageContainer); + } + + /** + * @Given I select the content article with title :arg1 + */ + public function iSelectTheContentArticleWithTitle($title) + { + $I = $this; + $I->amOnPage(ArticleManagerPage::$pageURL); + $I->fillField(ArticleManagerPage::$filterSearch, $title); + $I->click(ArticleManagerPage::$iconSearch); + $I->checkAllResults(); + $I->clickToolbarButton('edit'); + } + + /** + * @Given I set access level as a :arg1 + */ + public function iSetAccessLevelAsA($accessLevel) + { + $I = $this; + $I->selectOptionInChosenById('jform_access', $accessLevel); + } + + /** + * @When I save the article + */ + public function iSaveTheArticle() + { + $I = $this; + $I->clickToolbarButton('Save & Close'); + } + + /** + * @Given I have article with name :arg1 + */ + public function iHaveArticleWithName($title) + { + $I = $this; + $I->amOnPage(ArticleManagerPage::$pageURL); + $I->fillField(ArticleManagerPage::$filterSearch, $title); + $I->click(ArticleManagerPage::$iconSearch); + $I->checkAllResults(); + } + + /** + * @When I unpublish the article + */ + public function iUnpublish() + { + $I = $this; + $I->clickToolbarButton('unpublish'); + } + /** + * @Then I see article unpublish message :arg1 + */ + public function iSeeArticleUnpublishMessage($message) + { + $I = $this; + $I->waitForPageTitle('Articles'); + $I->see($message, AdminPage::$systemMessageContainer); + } + + + /** + * @Given I have :arg1 content article which needs to be Trash + */ + public function iHaveContentArticleWhichNeedsToBeTrash($title) + { + $I = $this; + $I->amOnPage(ArticleManagerPage::$pageURL); + $I->fillField(ArticleManagerPage::$filterSearch, $title); + $I->click(ArticleManagerPage::$iconSearch); + $I->checkAllResults(); + } + + /** + * @When I Trash the article + */ + public function iTrashTheArticleWithName() + { + $I = $this; + $I->clickToolbarButton('trash'); + } + + /** + * @Then I see article trash message :arg1 + */ + public function iSeeArticleTrashMessage($message) + { + $I = $this; + $I->waitForPageTitle('Articles'); + $I->see($message, AdminPage::$systemMessageContainer); + } +} \ No newline at end of file diff --git a/tests/acceptance.suite.dist.yml b/tests/acceptance.suite.dist.yml index a0fe3118b29a6..b28adc81651cc 100644 --- a/tests/acceptance.suite.dist.yml +++ b/tests/acceptance.suite.dist.yml @@ -8,7 +8,7 @@ class_name: AcceptanceTester modules: enabled: - JoomlaBrowser - - AcceptanceHelper + - AcceptanceHelper - Asserts config: JoomlaBrowser: @@ -38,3 +38,4 @@ gherkin: - AcceptanceTester - Step\Acceptance\Administrator\User - Page\Acceptance\Administrator\Login + - Step\Acceptance\Administrator\Content \ No newline at end of file diff --git a/tests/acceptance/content.feature b/tests/acceptance/content.feature new file mode 100644 index 0000000000000..b7ee1010d0051 --- /dev/null +++ b/tests/acceptance/content.feature @@ -0,0 +1,37 @@ +Feature: content + In order to manage content article in the web + As an owner + I need to create modify trash publish and Unpublish content article + + Background: + Given Joomla CMS is installed + When Login into Joomla administrator with username "admin" and password "admin" + Then I see administrator dashboard + + Scenario: Create an Article + Given There is a add content link + When I create new content with field title as "My_Article" and content as a "This is my first article" + And I save an article + Then I should see the "Article successfully saved." message + + Scenario: Feature an Article + Given I search and select content article with title "My_Article" + When I featured the article + Then I save and see the "1 article featured." message + + Scenario: Modify an article + Given I select the content article with title "My_Article" + And I set access level as a "Registered" + When I save the article + Then I should see the "Article successfully saved" message + + Scenario: Unpublish an article + Given I have article with name "My_Article" + When I unpublish the article + Then I see article unpublish message "1 article unpublished." + + Scenario: Trash an article + Given I have "My_Article" content article which needs to be Trash + When I Trash the article + Then I see article trash message "1 article trashed." +