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

Commit 92e6cc8

Browse files
committed
Convert system message container in user feature
1 parent 7d3db14 commit 92e6cc8

File tree

6 files changed

+159
-11
lines changed

6 files changed

+159
-11
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public function haveItemUsingSearch($keyword)
116116
$I->amOnPage(static::$url);
117117
$I->search($keyword);
118118
$I->checkAllResults();
119+
$I->wait(1);
119120
}
120121

121122
/**

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: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*

tests/codeception/_support/Step/Acceptance/Administrator/User.php

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,24 @@ public function iSaveTheUser()
7878
$I->adminPage->clickToolbarButton('Save & Close');
7979
}
8080

81+
/**
82+
* Method to see user is saved
83+
*
84+
* @param string $name The user's Name
85+
*
86+
* @Then I should see the user :name is created
87+
*
88+
* @since __DEPLOY_VERSION__
89+
*
90+
* @return void
91+
*/
92+
public function seeTheUserIsCreated($name)
93+
{
94+
$I = $this;
95+
96+
$I->userManagerPage->seeItemIsCreated($name);
97+
}
98+
8199
/**
82100
* Method to search and select user with username
83101
*
@@ -184,6 +202,40 @@ public function iUnblockTheUser()
184202
$I->adminPage->clickToolbarButton('unblock');
185203
}
186204

205+
/**
206+
* Confirm the user is blocked
207+
*
208+
* @Then I should see the user is now blocked
209+
*
210+
* @since __DEPLOY_VERSION__
211+
*
212+
* @return void
213+
*/
214+
public function iShouldSeeTheUserIsNowBlocked()
215+
{
216+
$I = $this;
217+
218+
$I->adminPage->waitForPageTitle('Users');
219+
$I->seeNumberOfElements(UserManagerPage::$seeBlocked, 1);
220+
}
221+
222+
/**
223+
* Confirm the user is unblocked
224+
*
225+
* @Then I should see the user is now unblocked
226+
*
227+
* @since __DEPLOY_VERSION__
228+
*
229+
* @return void
230+
*/
231+
public function iShouldSeeTheUserIsNowUnblocked()
232+
{
233+
$I = $this;
234+
235+
$I->adminPage->waitForPageTitle('Users');
236+
$I->seeNumberOfElements(UserManagerPage::$seeUnblocked, 1);
237+
}
238+
187239
/**
188240
* Method to delete user
189241
*
@@ -205,6 +257,25 @@ public function iDeleteTheUser($username)
205257
$I->acceptPopup();
206258
}
207259

260+
/**
261+
* Confirm the user is now deleted
262+
*
263+
* @param string $message The message for no item in list
264+
*
265+
* @Then I should see :message for deleted user
266+
*
267+
* @since __DEPLOY_VERSION__
268+
*
269+
* @return void
270+
*/
271+
public function iShouldSeeTheUserIsNowDeleted($message)
272+
{
273+
$I = $this;
274+
275+
$I->adminPage->waitForPageTitle('Users');
276+
$I->see($message, UserManagerPage::$noItems);
277+
}
278+
208279
/**
209280
* Method to goto user manager page.
210281
*
@@ -275,6 +346,24 @@ public function iSetAssignedUserGroupAsAnAdministrator()
275346
$I->checkOption('#1group_7');
276347
}
277348

349+
/**
350+
* Method to check group is created
351+
*
352+
* @param string $name The group Name
353+
*
354+
* @Then I should see the group :name is created
355+
*
356+
* @since __DEPLOY_VERSION__
357+
*
358+
* @return void
359+
*/
360+
public function seeTheUserGroupIsCreated($name)
361+
{
362+
$I = $this;
363+
364+
$I->userGroupPage->seeItemIsCreated($name);
365+
}
366+
278367
/**
279368
* Method to login into backend
280369
*
@@ -499,6 +588,24 @@ public function iSaveTheAccessLevel()
499588
$I->adminPage->clickToolbarButton('Save & Close');
500589
}
501590

591+
/**
592+
* Method to check access level is created
593+
*
594+
* @param string $name The access level Name
595+
*
596+
* @Then I should see the access level :name is created
597+
*
598+
* @since __DEPLOY_VERSION__
599+
*
600+
* @return void
601+
*/
602+
public function seeTheUserAclIsCreated($name)
603+
{
604+
$I = $this;
605+
606+
$I->userAclPage->seeItemIsCreated($name);
607+
}
608+
502609
/**
503610
* Method to search using the access level name
504611
*

tests/codeception/acceptance/users.feature

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,28 @@ Feature: users
1616
Given There is a add user link
1717
When I create new user with fields Name "register", Login Name "register", Password "register" and Email "[email protected]"
1818
And I Save the user
19-
Then I should see the "User successfully saved." message
19+
Then I should see the user "register" is created
2020

2121
Scenario: Edit user
2222
Given I search and select the user with user name "register"
2323
When I set name as an "Editor" and User Group as "Editor"
2424
And I Save the user
25-
Then I should see the "User successfully saved." message
25+
Then I should see the user "Editor" is created
2626

2727
Scenario: Block a User
2828
Given I have a user with user name "register"
2929
When I block the user
30-
Then I should see the "User blocked." message
30+
Then I should see the user is now blocked
3131

3232
Scenario: Unblock user
3333
Given I have a blocked user with user name "register"
3434
When I unblock the user
35-
Then I should see the "User enabled." message
35+
Then I should see the user is now unblocked
3636

3737
Scenario: Delete user
3838
Given I have a user with user name "Editor"
3939
When I Delete the user "Editor"
40-
Then I should see the "1 user successfully deleted." message
40+
Then I should see "No Matching Results" for deleted user
4141

4242
Scenario: Create super admin and login into the backend
4343
Given There is a add user link
@@ -57,35 +57,35 @@ Feature: users
5757
Given There is a add new group link
5858
When I fill Group Title as a "Group One"
5959
And I save the Group
60-
Then I should see the "Group successfully saved." message
60+
Then I should see the group "Group One" is created
6161

6262
Scenario: Edit group
6363
Given I search and select the Group with name "Group One"
6464
And I set group Title as a "Group Two"
6565
When I save the Group
66-
Then I should see the "Group successfully saved." message
66+
Then I should see the group "Group Two" is created
6767

6868
Scenario: Delete Group
6969
Given I search and select the Group with name "Group Two"
7070
When I Delete the Group "Group Two"
71-
Then I should see the "1 User Group successfully deleted." message
71+
Then I should see "No Matching Results" for deleted user
7272

7373
Scenario: Create ACL level
7474
Given There is a add viewing access level link
7575
When I fill Level Title as a "Acl One" and set Access as a public
7676
And I save the Access Level
77-
Then I should see the "Access level successfully saved." message
77+
Then I should see the access level "Acl One" is created
7878

7979
Scenario: Edit ACL
8080
Given I search and select the Access Level with name "Acl One"
8181
And I set Access Level title as a "Acl Two"
8282
When I save the Access Level
83-
Then I should see the "Access level successfully saved." message
83+
Then I should see the access level "Acl Two" is created
8484

8585
Scenario: Delete ACL
8686
Given I search and select the Access Level with name "Acl Two"
8787
When I Delete the Access level "Acl Two"
88-
Then I should see the "1 View Access Level successfully removed." message
88+
Then I should see "No Matching Results" for deleted user
8989

9090
Scenario: User settings (Allow user registration)
9191
Given There is an user link

0 commit comments

Comments
 (0)