Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,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/banner.feature')
->run()
->stopOnFail();

/* $this->taskCodecept($pathToCodeception)
->arg('--steps')
->arg('--debug')
Expand Down
3 changes: 3 additions & 0 deletions tests/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public function clickToolbarButton($button)
case "archive":
$I->click(['xpath' => "//div[@id='toolbar-archive']//button"]);
break;
case "unarchive":
$I->click(['xpath' => "//div[@id='toolbar-unarchive']//button"]);
break;
case "check-in":
$I->click(['xpath' => "//div[@id='toolbar-checkin']//button"]);
break;
Expand Down
19 changes: 19 additions & 0 deletions tests/_support/Page/Acceptance/Administrator/BannerPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
namespace Page\Acceptance\Administrator;

use Page\Acceptance\Administrator\AdminPage;

class BannerPage extends AdminPage
{
public static $url = "/administrator/index.php?option=com_banners";

public static $titleField = ['id' => 'jform_name'];

public static $aliasField = ['id' => 'jform_alias'];

public static $searchField = ['id' => 'filter_search'];

public static $searchButton = ['class' => 'icon-search'];

public static $searchToolButton = ['css' => 'button[data-original-title="Filter the list items."]'];
}
219 changes: 219 additions & 0 deletions tests/_support/Step/Acceptance/Administrator/Banner.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
<?php
namespace Step\Acceptance\Administrator;

use Page\Acceptance\Administrator\BannerPage;


class Banner extends \AcceptanceTester
{
/**
* @Given There is an add Banner link
*/
public function thereIsAnAddBannerLink()
{
$I = $this;
$I->amOnPage(BannerPage::$url);
$I->clickToolbarButton('New');
}

/**
* @When I create a new banner with field title as :title
*/
public function iCreateANewBannerWithFieldTitleAs($title)
{
$I = $this;
$I->fillField(BannerPage::$titleField, $title);
}

/**
* @When I save a Banner
*/
public function iSaveABanner()
{
$I = $this;
$I->clickToolbarButton('Save & Close');
}

/**
* @Then I should see the :Banner successfully saved. message
*/
public function iShouldSeeTheMessage($message)
{
$I = $this;
$I->waitForText($message, TIMEOUT, AdminPage::$systemMessageContainer);
$I->see($message, AdminPage::$systemMessageContainer);
}

/**
* @Given There is a Banner listing page
*/
public function thereIsABannerListingPage()
{
$I = $this;
$I->amOnPage(BannerPage::$url);
}

/**
* @When I Click the Banner with Name :Gsocbanner
*/
public function iClickTheBannerWithName($title)
{
$I = $this;
$I->fillField(BannerPage::$searchField, $title);
$I->Click(BannerPage::$searchButton);
$I->checkAllResults();
$I->clickToolbarButton('edit');
}

/**
* @When I have Change the Banner field title to :Gsocbanner
*/
public function iHaveChangeTheBannerFieldTitleTo($title)
{
$I = $this;
$I->fillField(BannerPage::$titleField, $title);
$I->fillField(BannerPage::$aliasField, $title);
}

/**
* @When I select the Banner with Name :Gsocbanner which needs to be published
*/
public function iSelectTheBannerWithNameWhichNeedsToBePublished($title)
{
$I = $this;
$I->fillField(BannerPage::$searchField, $title);
$I->Click(BannerPage::$searchButton);
$I->checkAllResults();
}

/**
* @When I have publish the Banner
*/
public function iHavePublishTheBanner()
{
$I = $this;
$I->clickToolbarButton('Publish');
}

/**
* @When I select the Banner with Name :Gsocbanner which needs to be unpublished
*/
public function iSelectTheBannerWithNameWhichNeedsToBeUnpublished($title)
{
$I = $this;
$I->fillField(BannerPage::$searchField, $title);
$I->Click(BannerPage::$searchButton);
$I->checkAllResults();
}

/**
* @When I have unpublish the Banner
*/
public function iHaveUnpublishTheBanner()
{
$I = $this;
$I->clickToolbarButton('Unpublish');
}

/**
* @When I select the Banner with Name :Gsocbanner which needs to be Trash
*/
public function iSelectTheBannerWithNameWhichNeedsToBeTrash($title)
{
$I = $this;
$I->fillField(BannerPage::$searchField, $title);
$I->Click(BannerPage::$searchButton);
$I->checkAllResults();
}

/**
* @When I have Trash the Banner
*/
public function iTrashTheBanner()
{
$I = $this;
$I->clickToolbarButton('Trash');
}

/**
* @When I select the Banner with Name "Gsocbanner" which needs to be Remove Trash
*/
public function iSelectTheBannerWithNameWhichNeedsToBeRemoveTrash()
{
$I = $this;
$I->Click(BannerPage::$searchToolButton);
$I->selectOptionInChosenById('filter_published', "Trashed");
$I->checkAllResults();
}

/**
* @When I Remove Trash the Banner
*/
public function iRemoveTrashTheBanner()
{
$I = $this;
$I->clickToolbarButton('Empty trash');
$I->acceptPopup();
}

/**
* @When I select the Banner with Name :Gsocbanner which needs to be archived
*/
public function iSelectTheBannerWithNameWhichNeedsToBeArchived($title)
{
$I = $this;
$I->fillField(BannerPage::$searchField, $title);
$I->Click(BannerPage::$searchButton);
$I->checkAllResults();
}

/**
* @When I archived the Banner
*/
public function iArchivedTheBanner()
{
$I = $this;
$I->clickToolbarButton('Archive');
}

/**
* @When I select the Banner with Name :Gsocbanner which needs to be Unarchive
*/
public function iSelectTheBannerWithNameWhichNeedsToBeUnarchive()
{
$I = $this;
$I->Click(BannerPage::$searchToolButton);
$I->selectOptionInChosenById('filter_published', "Archived");
$I->checkAllResults();
}

/**
* @When I Unarchive the Banner
*/
public function iUnarchiveTheBanner()
{
$I = $this;
$I->clickToolbarButton('unarchive');
}

/**
* @When I select the Banner with Name :arg1 which needs to be Check-In
*/
public function iSelectTheBannerWithNameWhichNeedsToBeCheckIn($title)
{
$I = $this;
$I->fillField(BannerPage::$searchField, $title);
$I->Click(BannerPage::$searchButton);
$I->checkAllResults();
}

/**
* @When I Check-In the Banner
*/
public function iCheckInTheBanner()
{
$I = $this;
$I->clickToolbarButton('Check-in');
}

}
3 changes: 2 additions & 1 deletion tests/acceptance.suite.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ gherkin:
- Step\Acceptance\Administrator\Login
- Step\Acceptance\Administrator\User
- Step\Acceptance\Site\UsersFrontend
- Step\Acceptance\Administrator\Content
- Step\Acceptance\Administrator\Content
- Step\Acceptance\Administrator\Banner
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add one empty line at the end of the file.

65 changes: 65 additions & 0 deletions tests/acceptance/banner.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Feature: Banner
In order to manage Banner article in the web
I need to create modify trash archived Check-In And publish and Unpublish Banner

Background:
When I Login into Joomla administrator with username "admin" and password "admin"
And I see the administrator dashboard

Scenario: Create a Banner
Given There is an add Banner link
When I create a new banner with field title as "Gsocbanner"
And I save a Banner
Then I should see the "Banner successfully saved." message

Scenario: Modify a Banner
Given There is a Banner listing page
When I Click the Banner with Name "Gsocbanner"
And I have Change the Banner field title to "Gsocbanner1"
And I save a Banner
Then I should see the "Banner successfully saved." message

Scenario: publish a Banner
Given There is a Banner listing page
When I select the Banner with Name "Gsocbanner" which needs to be published
And I have publish the Banner
Then I should see the "1 banner successfully published." message

Scenario: Unpublish an Banner
Given There is a Banner listing page
When I select the Banner with Name "Gsocbanner" which needs to be unpublished
And I have unpublish the Banner
Then I should see the "1 banner successfully unpublished." message

Scenario: Check-In a Banner
Given There is a Banner listing page
When I select the Banner with Name "Gsocbanner" which needs to be Check-In
And I Check-In the Banner
Then I should see the "1 banner successfully checked in." message

Scenario: archived a Banner
Given There is a Banner listing page
When I select the Banner with Name "Gsocbanner" which needs to be archived
And I archived the Banner
Then I should see the "1 banner successfully archived." message

Scenario: Unarchive a Banner
Given There is a Banner listing page
When I select the Banner with Name "Gsocbanner" which needs to be Unarchive
And I Unarchive the Banner
Then I should see the "1 banner successfully published." message

Scenario: Trash a Banner
Given There is a Banner listing page
When I select the Banner with Name "Gsocbanner" which needs to be Trash
And I have Trash the Banner
Then I should see the "1 banner successfully trashed." message

Scenario: Remove trash a Banner
Given There is a Banner listing page
When I select the Banner with Name "Gsocbanner" which needs to be Remove Trash
And I Remove Trash the Banner
Then I should see the "1 banner successfully deleted." message



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra space as there should be only one empty line at end of the file.