-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from javigomez/gherkin-feature-contentb
Adding content.feature scenarios
- Loading branch information
Showing
7 changed files
with
256 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
<?php | ||
namespace Codeception\Module; | ||
|
||
use Codeception\Configuration; | ||
|
||
// here you can define custom actions | ||
// all public methods declared in helper class will be available in $I | ||
class AcceptanceHelper extends \Codeception\Module | ||
{ | ||
protected static $acceptanceSuiteConfiguration = []; | ||
|
||
/** | ||
* Function to getConfiguration from the YML and return in the test | ||
* Function to get Configuration from the acceptance.suite.yml to be used by a test | ||
* | ||
* @param null $element | ||
* @return array | ||
* | ||
* @return mixed | ||
* @throws InvalidArgumentException | ||
*/ | ||
public function getConfiguration($element = null) | ||
public function getSuiteConfiguration() | ||
{ | ||
if (is_null($element)) { | ||
throw new InvalidArgumentException('empty value or non existing element was requested from configuration'); | ||
if (empty(self::$acceptanceSuiteConfiguration)) | ||
{ | ||
self::$acceptanceSuiteConfiguration = Configuration::suiteSettings('acceptance', Configuration::config()); | ||
} | ||
return $this->config[$element]; | ||
|
||
return self::$acceptanceSuiteConfiguration; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tests/_support/Page/Acceptance/Administrator/ArticleManagerPage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
namespace Page\Acceptance\Administrator; | ||
|
||
use Page\Acceptance\Administrator\AdminPage; | ||
|
||
class ArticleManagerPage extends AdminPage | ||
{ | ||
public static $articleTitleField = ['id' => '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"; | ||
|
||
} |
172 changes: 172 additions & 0 deletions
172
tests/_support/Step/Acceptance/Administrator/Content.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
<?php | ||
namespace Step\Acceptance\Administrator; | ||
|
||
use Page\Acceptance\Administrator\AdminPage; | ||
use Page\Acceptance\Administrator\ArticleManagerPage; | ||
|
||
class Content extends \AcceptanceTester | ||
{ | ||
/** | ||
* @Given There is a add content link | ||
*/ | ||
public function thereIsAAddContentLink() | ||
{ | ||
$I = $this; | ||
$I->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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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." | ||
|