diff --git a/RoboFile.php b/RoboFile.php index dfa61f0e39..480250bdcf 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -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') diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 639d9452a8..c8cccc87db 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -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; diff --git a/tests/_support/Page/Acceptance/Administrator/BannerPage.php b/tests/_support/Page/Acceptance/Administrator/BannerPage.php new file mode 100644 index 0000000000..cc5d589587 --- /dev/null +++ b/tests/_support/Page/Acceptance/Administrator/BannerPage.php @@ -0,0 +1,19 @@ + '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."]']; +} diff --git a/tests/_support/Step/Acceptance/Administrator/Banner.php b/tests/_support/Step/Acceptance/Administrator/Banner.php new file mode 100644 index 0000000000..13568e9783 --- /dev/null +++ b/tests/_support/Step/Acceptance/Administrator/Banner.php @@ -0,0 +1,219 @@ +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'); + } + +} diff --git a/tests/acceptance.suite.dist.yml b/tests/acceptance.suite.dist.yml index 1dd32e9e81..13a93888a0 100644 --- a/tests/acceptance.suite.dist.yml +++ b/tests/acceptance.suite.dist.yml @@ -38,4 +38,5 @@ gherkin: - Step\Acceptance\Administrator\Login - Step\Acceptance\Administrator\User - Step\Acceptance\Site\UsersFrontend - - Step\Acceptance\Administrator\Content \ No newline at end of file + - Step\Acceptance\Administrator\Content + - Step\Acceptance\Administrator\Banner \ No newline at end of file diff --git a/tests/acceptance/banner.feature b/tests/acceptance/banner.feature new file mode 100644 index 0000000000..bfe1b21773 --- /dev/null +++ b/tests/acceptance/banner.feature @@ -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 + + + \ No newline at end of file