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

Commit cd5bf4f

Browse files
pritalpatelyvesh
authored andcommitted
Using alternative of system message container for assurance (#72)
* Using alternative of system message container for assurance in article feature * Improve code and convert into page object * Convert system message checks in category feature * Convert system message container in user feature * Repair user scenarios
1 parent b5dc3a6 commit cd5bf4f

File tree

13 files changed

+485
-54
lines changed

13 files changed

+485
-54
lines changed

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

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,31 @@ class AdminPage extends \AcceptanceTester
3535
public static $pageTitle = ['class' => 'page-title'];
3636

3737
/**
38-
* Locator for user's page title
38+
* Locator for page title
3939
*
4040
* @var array
4141
* @since __DEPLOY_VERSION__
4242
*/
4343
public static $title = ['id' => 'jform_title'];
4444

4545
/**
46-
* Locator for user's search input field
46+
* Locator for search input field
4747
*
4848
* @var array
4949
* @since __DEPLOY_VERSION__
5050
*/
5151
public static $filterSearch = ['id' => 'filter_search'];
5252

5353
/**
54-
* Locator for user's search button icon
54+
* Locator for status filter under search tool
55+
*
56+
* @var array
57+
* @since __DEPLOY_VERSION__
58+
*/
59+
public static $filterPublished = 'filter_published';
60+
61+
/**
62+
* Locator for search button icon
5563
*
5664
* @var array
5765
* @since __DEPLOY_VERSION__
@@ -75,7 +83,7 @@ class AdminPage extends \AcceptanceTester
7583
public static $checkAll = ['xpath' => "//thead//input[@name='checkall-toggle' or @name='toggle']"];
7684

7785
/**
78-
* Method to search using user's name
86+
* Method to search using given keyword
7987
*
8088
* @param string $keyword The keyword to search
8189
*
@@ -87,6 +95,7 @@ public function search($keyword)
8795
{
8896
$I = $this;
8997

98+
$I->amGoingTo('search for "' . $keyword . '"');
9099
$I->fillField(static::$filterSearch, $keyword);
91100
$I->click(static::$iconSearch);
92101
}
@@ -107,6 +116,7 @@ public function haveItemUsingSearch($keyword)
107116
$I->amOnPage(static::$url);
108117
$I->search($keyword);
109118
$I->checkAllResults();
119+
$I->wait(1);
110120
}
111121

112122
/**
@@ -128,7 +138,7 @@ public function seeSystemMessage($title, $message)
128138
}
129139

130140
/**
131-
* Method is to Wait for page title untill default timeout.
141+
* Method is to Wait for page title until default timeout.
132142
*
133143
* @param string $title Page Title text
134144
*
@@ -304,7 +314,7 @@ public function doAdministratorLogout()
304314
*
305315
* @return void
306316
*/
307-
public function verifyAvailableTabs($expectedTabs, $tabsLocator = NULL)
317+
public function verifyAvailableTabs($expectedTabs, $tabsLocator = null)
308318
{
309319
$I = $this;
310320

@@ -321,4 +331,43 @@ public function verifyAvailableTabs($expectedTabs, $tabsLocator = NULL)
321331

322332
$I->comment('Verify the Tabs');
323333
}
334+
335+
/**
336+
* Method to see that item is saved
337+
*
338+
* @param string $item The item Name
339+
*
340+
* @since __DEPLOY_VERSION__
341+
*
342+
* @return void
343+
*/
344+
public function seeItemIsCreated($item)
345+
{
346+
$I = $this;
347+
348+
$I->amOnPage(static::$url);
349+
$I->search($item);
350+
$I->see($item, static::$seeName);
351+
}
352+
353+
/**
354+
* Assure the item is trashed.
355+
*
356+
* @param string $item The item name
357+
* @param string $pageTitle The page title
358+
*
359+
* @since __DEPLOY_VERSION__
360+
*
361+
* @return void
362+
*/
363+
public function seeItemInTrash($item, $pageTitle)
364+
{
365+
$I = $this;
366+
367+
$I->click('Search Tools');
368+
$I->wait(2);
369+
$I->selectOptionInChosenById(static::$filterPublished, 'Trashed');
370+
$I->waitForPageTitle($pageTitle);
371+
$I->see($item, static::$seeName);
372+
}
324373
}

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,38 @@ class ArticleManagerPage extends AdminPage
4242
*/
4343
public static $url = "/administrator/index.php?option=com_content&view=articles";
4444

45+
/**
46+
* Locator for article's name field
47+
*
48+
* @var array
49+
* @since __DEPLOY_VERSION__
50+
*/
51+
public static $seeName = ['xpath' => "//table[@id='articleList']//tr[1]//td[4]"];
52+
53+
/**
54+
* Locator for article's featured icon
55+
*
56+
* @var array
57+
* @since __DEPLOY_VERSION__
58+
*/
59+
public static $seeFeatured = ['xpath' => "//table[@id='articleList']//*//span[@class='icon-featured']"];
60+
61+
/**
62+
* Locator for article's name field
63+
*
64+
* @var array
65+
* @since __DEPLOY_VERSION__
66+
*/
67+
public static $seeAccessLevel = ['xpath' => "//table[@id='articleList']//tr[1]//td[5]"];
68+
69+
/**
70+
* Locator for article's unpublish icon
71+
*
72+
* @var array
73+
* @since __DEPLOY_VERSION__
74+
*/
75+
public static $seeUnpublished = ['xpath' => "//table[@id='articleList']//*//span[@class='icon-unpublish']"];
76+
4577
/**
4678
* Method to create new article
4779
*

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,38 @@ class CategoryManagerPage extends AdminPage
2626
*/
2727
public static $url = '/administrator/index.php?option=com_categories&view=categories&extension=com_content';
2828

29+
/**
30+
* Locator for category name field
31+
*
32+
* @var array
33+
* @since __DEPLOY_VERSION__
34+
*/
35+
public static $seeName = ['xpath' => "//table[@id='categoryList']//tr[1]//td[4]"];
36+
37+
/**
38+
* Locator for category unpublished icon
39+
*
40+
* @var array
41+
* @since __DEPLOY_VERSION__
42+
*/
43+
public static $seeUnpublished = ['xpath' => "//table[@id='categoryList']//*//span[@class='icon-unpublish']"];
44+
45+
/**
46+
* Locator for category access level field
47+
*
48+
* @var array
49+
* @since __DEPLOY_VERSION__
50+
*/
51+
public static $seeAccessLevel = ['xpath' => "//table[@id='categoryList']//tr[1]//td[9]"];
52+
53+
/**
54+
* Locator for category language field
55+
*
56+
* @var array
57+
* @since __DEPLOY_VERSION__
58+
*/
59+
public static $seeLanguage = ['xpath' => "//table[@id='categoryList']//tr[1]//td[10]"];
60+
2961
/**
3062
* Locator for invalid category alert
3163
*

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ class MenuManagerPage extends AdminPage
2424
* @var string
2525
* @since __DEPLOY_VERSION__
2626
*/
27-
public static $url = 'administrator/index.php?option=com_menus&view=item&layout=edit&menutype=mainmenu';
27+
public static $url = 'administrator/index.php?option=com_menus&view=items&menutype=mainmenu';
28+
29+
/**
30+
* Locator for menu item name field
31+
*
32+
* @var array
33+
* @since __DEPLOY_VERSION__
34+
*/
35+
public static $seeName = ['xpath' => "//table[@id='itemList']//tr[1]//td[4]"];
2836

2937
/**
3038
* Locator for select article for menu item

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,12 @@ class UserAclPage extends AdminPage
2525
* @since __DEPLOY_VERSION__
2626
*/
2727
public static $url = 'administrator/index.php?option=com_users&view=levels';
28+
29+
/**
30+
* Locator for user's acl name field
31+
*
32+
* @var array
33+
* @since __DEPLOY_VERSION__
34+
*/
35+
public static $seeName = ['xpath' => "//table[@id='levelList']//tr[1]/td[3]"];
2836
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,12 @@ class UserGroupPage extends AdminPage
2525
* @since __DEPLOY_VERSION__
2626
*/
2727
public static $url = 'administrator/index.php?option=com_users&view=groups';
28+
29+
/**
30+
* Locator for user's group name field
31+
*
32+
* @var array
33+
* @since __DEPLOY_VERSION__
34+
*/
35+
public static $seeName = ['xpath' => "//table[@id='groupList']//tr[1]/td[2]"];
2836
}

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ class UserManagerPage extends AdminPage
9999
public static $email2Field = ['id' => 'jform_email2'];
100100

101101
/**
102-
* Locator for user's username field in frontend
102+
* Locator for user's username field
103103
*
104104
* @var array
105105
* @since __DEPLOY_VERSION__
106106
*/
107107
public static $seeUserName = ['xpath' => "//table[@id='userList']//tr[1]/td[3]"];
108108

109109
/**
110-
* Locator for user's name field in frontend
110+
* Locator for user's name field
111111
*
112112
* @var array
113113
* @since __DEPLOY_VERSION__
@@ -122,6 +122,30 @@ class UserManagerPage extends AdminPage
122122
*/
123123
public static $lastLoginDate = ['xpath' => "//table[@id='userList']//tr[1]/td[8]"];
124124

125+
/**
126+
* Locator for user is blocked
127+
*
128+
* @var array
129+
* @since __DEPLOY_VERSION__
130+
*/
131+
public static $seeBlocked = ['xpath' => "//table[@id='userList']//*//td[4]//span[@class='icon-unpublish']"];
132+
133+
/**
134+
* Locator for user is unblocked
135+
*
136+
* @var array
137+
* @since __DEPLOY_VERSION__
138+
*/
139+
public static $seeUnblocked = ['xpath' => "//table[@id='userList']//*//td[4]//span[@class='icon-publish']"];
140+
141+
/**
142+
* Locator for user is deleted and not found
143+
*
144+
* @var array
145+
* @since __DEPLOY_VERSION__
146+
*/
147+
public static $noItems = ['class' => 'alert-no-items'];
148+
125149
/**
126150
* Method is a page object to fill user form with given information and prepare to save user.
127151
*

0 commit comments

Comments
 (0)