Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.

Commit 29e4296

Browse files
authored
Merge pull request #94 from puneet0191/sprint4
Adding Banner Manager Tests
2 parents fbe66c5 + 54404d6 commit 29e4296

File tree

7 files changed

+309
-8
lines changed

7 files changed

+309
-8
lines changed

RoboFile.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
355355
->arg('--debug')
356356
->arg('--fail-fast')
357357
->arg('--env ' . $opts['env'])
358-
->arg($this->testsPath . 'acceptance/extensions.feature')
358+
->arg($this->testsPath . 'acceptance/users_frontend.feature')
359359
->run()
360360
->stopOnFail();
361361

@@ -364,7 +364,16 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
364364
->arg('--debug')
365365
->arg('--fail-fast')
366366
->arg('--env ' . $opts['env'])
367-
->arg($this->testsPath . 'acceptance/users_frontend.feature')
367+
->arg($this->testsPath . 'acceptance/banner.feature')
368+
->run()
369+
->stopOnFail();
370+
371+
$this->taskCodecept($pathToCodeception)
372+
->arg('--steps')
373+
->arg('--debug')
374+
->arg('--fail-fast')
375+
->arg('--env ' . $opts['env'])
376+
->arg($this->testsPath . 'acceptance/extensions.feature')
368377
->run()
369378
->stopOnFail();
370379

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* @package Joomla.Test
4+
* @subpackage AcceptanceTester.Page
5+
*
6+
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
7+
* @license GNU General Public License version 2 or later; see LICENSE.txt
8+
*/
9+
namespace Page\Acceptance\Administrator;
10+
11+
/**
12+
* Acceptance Page object class to define Control Panel page objects.
13+
*
14+
* @package Page\Acceptance\Administrator
15+
*
16+
* @since __DEPLOY_VERSION__
17+
*/
18+
class BannerManagerPage extends AdminPage
19+
{
20+
public static $url = "/administrator/index.php?option=com_banners";
21+
22+
public static $titleField = ['id' => 'jform_name'];
23+
24+
public static $aliasField = ['id' => 'jform_alias'];
25+
26+
public static $searchField = ['id' => 'filter_search'];
27+
28+
public static $searchButton = ['class' => 'icon-search'];
29+
30+
public static $searchToolButton = ['css' => 'button[data-original-title="Filter the list items."]'];
31+
}

tests/codeception/_support/Page/Acceptance/Administrator/ExtensionManagerPage.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function uninstallExtension($extensionName)
103103
$I->click(['xpath' => "//input[@id='cb0']"]);
104104
$I->click(['xpath' => "//div[@id='toolbar-delete']/button"]);
105105
$I->acceptPopup();
106+
$I->wait(3);
106107
$I->seeSystemMessage(self::$managePageTitle, 'was successful');
107108
$I->searchForItem($extensionName);
108109
$I->waitForText(
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
<?php
2+
/**
3+
* @package Joomla.Test
4+
* @subpackage AcceptanceTester.Step
5+
*
6+
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
7+
* @license GNU General Public License version 2 or later; see LICENSE.txt
8+
*/
9+
10+
namespace Step\Acceptance\Administrator;
11+
12+
use Page\Acceptance\Administrator\BannerManagerPage;
13+
14+
/**
15+
* Acceptance Step object class contains suits for Content Manager.
16+
*
17+
* @package Step\Acceptance\Administrator
18+
*
19+
* @since __DEPLOY_VERSION__
20+
*/
21+
class Banner extends \AcceptanceTester
22+
{
23+
/**
24+
* @Given There is an add Banner link
25+
*/
26+
public function thereIsAnAddBannerLink()
27+
{
28+
$I = $this;
29+
$I->amOnPage(BannerManagerPage::$url);
30+
$I->clickToolbarButton('New');
31+
}
32+
/**
33+
* @When I create a new banner with field title as :title
34+
*/
35+
public function iCreateANewBannerWithFieldTitleAs($title)
36+
{
37+
$I = $this;
38+
$I->fillField(BannerManagerPage::$titleField, $title);
39+
}
40+
/**
41+
* @When I save a Banner
42+
*/
43+
public function iSaveABanner()
44+
{
45+
$I = $this;
46+
$I->clickToolbarButton('Save & Close');
47+
}
48+
/**
49+
* @Then I should see the :Banner successfully saved. message
50+
*/
51+
public function iShouldSeeTheMessage($message)
52+
{
53+
$I = $this;
54+
$I->waitForText($message, TIMEOUT, BannerManagerPage::$systemMessageContainer);
55+
$I->see($message, BannerManagerPage::$systemMessageContainer);
56+
}
57+
/**
58+
* @Given There is a Banner listing page
59+
*/
60+
public function thereIsABannerListingPage()
61+
{
62+
$I = $this;
63+
$I->amOnPage(BannerManagerPage::$url);
64+
}
65+
/**
66+
* @When I Click the Banner with Name :Gsocbanner
67+
*/
68+
public function iClickTheBannerWithName($title)
69+
{
70+
$I = $this;
71+
$I->fillField(BannerManagerPage::$searchField, $title);
72+
$I->Click(BannerManagerPage::$searchButton);
73+
$I->checkAllResults();
74+
$I->clickToolbarButton('edit');
75+
}
76+
/**
77+
* @When I have Change the Banner field title to :Gsocbanner
78+
*/
79+
public function iHaveChangeTheBannerFieldTitleTo($title)
80+
{
81+
$I = $this;
82+
$I->fillField(BannerManagerPage::$titleField, $title);
83+
$I->fillField(BannerManagerPage::$aliasField, $title);
84+
}
85+
/**
86+
* @When I select the Banner with Name :Gsocbanner which needs to be published
87+
*/
88+
public function iSelectTheBannerWithNameWhichNeedsToBePublished($title)
89+
{
90+
$I = $this;
91+
$I->fillField(BannerManagerPage::$searchField, $title);
92+
$I->Click(BannerManagerPage::$searchButton);
93+
$I->checkAllResults();
94+
}
95+
/**
96+
* @When I have publish the Banner
97+
*/
98+
public function iHavePublishTheBanner()
99+
{
100+
$I = $this;
101+
$I->clickToolbarButton('Publish');
102+
}
103+
/**
104+
* @When I select the Banner with Name :Gsocbanner which needs to be unpublished
105+
*/
106+
public function iSelectTheBannerWithNameWhichNeedsToBeUnpublished($title)
107+
{
108+
$I = $this;
109+
$I->fillField(BannerManagerPage::$searchField, $title);
110+
$I->Click(BannerManagerPage::$searchButton);
111+
$I->checkAllResults();
112+
}
113+
/**
114+
* @When I have unpublish the Banner
115+
*/
116+
public function iHaveUnpublishTheBanner()
117+
{
118+
$I = $this;
119+
$I->clickToolbarButton('Unpublish');
120+
}
121+
/**
122+
* @When I select the Banner with Name :Gsocbanner which needs to be Trash
123+
*/
124+
public function iSelectTheBannerWithNameWhichNeedsToBeTrash($title)
125+
{
126+
$I = $this;
127+
$I->fillField(BannerManagerPage::$searchField, $title);
128+
$I->Click(BannerManagerPage::$searchButton);
129+
$I->checkAllResults();
130+
}
131+
/**
132+
* @When I have Trash the Banner
133+
*/
134+
public function iTrashTheBanner()
135+
{
136+
$I = $this;
137+
$I->clickToolbarButton('Trash');
138+
}
139+
140+
/**
141+
* @When I select the Banner with Name "randombanner" which needs to be Remove Trash
142+
*/
143+
public function iSelectTheBannerWithNameWhichNeedsToBeRemoveTrash()
144+
{
145+
$I = $this;
146+
$I->Click(BannerManagerPage::$searchToolButton);
147+
$I->selectOptionInChosenByIdUsingJs('filter_published', "Trashed");
148+
$I->checkAllResults();
149+
}
150+
/**
151+
* @When I Remove Trash the Banner
152+
*/
153+
public function iRemoveTrashTheBanner()
154+
{
155+
$I = $this;
156+
$I->clickToolbarButton('Empty trash');
157+
$I->acceptPopup();
158+
}
159+
/**
160+
* @When I select the Banner with Name :Gsocbanner which needs to be archived
161+
*/
162+
public function iSelectTheBannerWithNameWhichNeedsToBeArchived($title)
163+
{
164+
$I = $this;
165+
$I->fillField(BannerManagerPage::$searchField, $title);
166+
$I->Click(BannerManagerPage::$searchButton);
167+
$I->checkAllResults();
168+
}
169+
/**
170+
* @When I archived the Banner
171+
*/
172+
public function iArchivedTheBanner()
173+
{
174+
$I = $this;
175+
$I->clickToolbarButton('Archive');
176+
}
177+
/**
178+
* @When I select the Banner with Name :Gsocbanner which needs to be Unarchive
179+
*/
180+
public function iSelectTheBannerWithNameWhichNeedsToBeUnarchive()
181+
{
182+
$I = $this;
183+
$I->Click(BannerManagerPage::$searchToolButton);
184+
$I->selectOptionInChosenById('filter_published', "Archived");
185+
$I->checkAllResults();
186+
}
187+
/**
188+
* @When I Unarchive the Banner
189+
*/
190+
public function iUnarchiveTheBanner()
191+
{
192+
$I = $this;
193+
$I->clickToolbarButton('unarchive');
194+
}
195+
/**
196+
* @When I select the Banner with Name :arg1 which needs to be Check-In
197+
*/
198+
public function iSelectTheBannerWithNameWhichNeedsToBeCheckIn($title)
199+
{
200+
$I = $this;
201+
$I->fillField(BannerManagerPage::$searchField, $title);
202+
$I->Click(BannerManagerPage::$searchButton);
203+
$I->checkAllResults();
204+
}
205+
/**
206+
* @When I Check-In the Banner
207+
*/
208+
public function iCheckInTheBanner()
209+
{
210+
$I = $this;
211+
$I->clickToolbarButton('Check-in');
212+
}
213+
}

tests/codeception/acceptance.suite.dist.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ gherkin:
4141
- Step\Acceptance\Administrator\Content
4242
- Step\Acceptance\Administrator\Category
4343
- Step\Acceptance\Administrator\Admin
44+
- Step\Acceptance\Administrator\Extension
45+
- Step\Acceptance\Administrator\Banner
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Feature: Banner
2+
In order to manage Banner article in the web
3+
I need to create modify trash archived Check-In And publish and Unpublish Banner
4+
5+
Background:
6+
When I Login into Joomla administrator
7+
And I see the administrator dashboard
8+
9+
Scenario: Create a Banner
10+
Given There is an add Banner link
11+
When I create a new banner with field title as "banner"
12+
And I save a Banner
13+
Then I should see the "Banner successfully saved." message
14+
15+
Scenario: Modify a Banner
16+
Given There is a Banner listing page
17+
When I Click the Banner with Name "banner"
18+
And I have Change the Banner field title to "randombanner1"
19+
And I save a Banner
20+
Then I should see the "Banner successfully saved." message
21+
22+
Scenario: publish a Banner
23+
Given There is a Banner listing page
24+
When I select the Banner with Name "randombanner" which needs to be published
25+
And I have publish the Banner
26+
Then I should see the "1 banner successfully published." message
27+
28+
Scenario: Unpublish an Banner
29+
Given There is a Banner listing page
30+
When I select the Banner with Name "randombanner" which needs to be unpublished
31+
And I have unpublish the Banner
32+
Then I should see the "1 banner successfully unpublished." message
33+
34+
Scenario: Check-In a Banner
35+
Given There is a Banner listing page
36+
When I select the Banner with Name "randombanner" which needs to be Check-In
37+
And I Check-In the Banner
38+
Then I should see the "1 banner successfully checked in." message
39+
40+
Scenario: Trash a Banner
41+
Given There is a Banner listing page
42+
When I select the Banner with Name "randombanner" which needs to be Trash
43+
And I have Trash the Banner
44+
Then I should see the "1 banner successfully trashed." message
45+
46+
Scenario: Remove trash a Banner
47+
Given There is a Banner listing page
48+
When I select the Banner with Name "randombanner" which needs to be Remove Trash
49+
And I Remove Trash the Banner
50+
Then I should see the "1 banner successfully deleted." message

tests/codeception/acceptance/extensions.feature

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,4 @@ Feature: extensions
1515
Scenario: Test extension update
1616
Given There is an extension "weblinks" installed with update available
1717
When I install extension update
18-
Then I should see the extension "weblinks" is updated
19-
20-
Scenario: Test extension uninstall
21-
Given There is an extension "weblinks" installed
22-
When I uninstall the extension
23-
Then I should see the extension "weblinks" is uninstalled
18+
Then I should see the extension "weblinks" is updated

0 commit comments

Comments
 (0)