This repository was archived by the owner on Mar 17, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 28
Edit, block, unblock and delete user #14
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
|
||
<?php | ||
/** | ||
* @package Joomla | ||
* @subpackage tests | ||
* @package Joomla | ||
* @subpackage tests | ||
* | ||
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
class UserCest | ||
{ | ||
public function __construct() | ||
{ | ||
$this->faker = Faker\Factory::create(); | ||
$this->name = 'User' . $this->faker->randomNumber(); | ||
$this->username = 'uname' . $this->faker->randomNumber(); | ||
$this->email = '[email protected]'; | ||
$this->name = 'User' . $this->faker->randomNumber(); | ||
$this->username = 'uname' . $this->faker->randomNumber(); | ||
$this->email = 'test' . $this->faker->randomNumber() . '@joomla.org'; | ||
$this->password = 'test'; | ||
} | ||
|
||
|
@@ -33,7 +32,7 @@ public function administratorCreateUser(\AcceptanceTester $I) | |
$I->amGoingTo('try to save a user with a filled name, email, username and password'); | ||
$I->clickToolbarButton('New'); | ||
|
||
$I->waitForText('Users: New', '30', ['css' => 'h1']); | ||
$I->waitForText('Users: New', TIMEOUT, ['class' => 'page-title']); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
|
||
$I->fillField(['id' => 'jform_name'], $this->name); | ||
|
@@ -44,8 +43,99 @@ public function administratorCreateUser(\AcceptanceTester $I) | |
|
||
$I->clickToolbarButton('Save & Close'); | ||
|
||
$I->waitForText('Users', '30', ['css' => 'h1']); | ||
$I->waitForText('Users', TIMEOUT, ['class' => 'page-title']); | ||
$I->expectTo('see a success message and the user added after saving the user'); | ||
$I->see('User successfully saved', ['id' => 'system-message-container']); | ||
} | ||
} | ||
|
||
public function administratorEditUser(\AcceptanceTester $I) | ||
{ | ||
$I->am('Administrator'); | ||
$I->wantToTest('Editing a user'); | ||
|
||
$I->doAdministratorLogin(); | ||
$I->amGoingTo('Navigate to Users page in /administrator/'); | ||
$I->amOnPage('administrator/index.php?option=com_users&view=users'); | ||
|
||
$I->expectTo('see Users page'); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
$I->click($this->name); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
$I->waitForText('Users: Edit', TIMEOUT, ['class' => 'page-title']); | ||
$I->fillField(['id' => 'jform_name'], $this->name . '-edited'); | ||
$I->fillField(['id' => 'jform_username'], $this->username. '-edited'); | ||
$I->fillField(['id' => 'jform_email'], 'edited-' . $this->email); | ||
$I->click('Save & Close'); | ||
$I->waitForText('Users', TIMEOUT, ['class' => 'page-title']); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
$I->expectTo('see a success message and the user has been updated'); | ||
$I->see('User successfully saved', ['id' => 'system-message-container']); | ||
$I->searchForItem($this->name . '-edited'); | ||
$I->waitForText('Users', TIMEOUT, ['class' => 'page-title']); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
$I->expectTo('see the edited username is listed'); | ||
$I->waitForText($this->name); | ||
} | ||
|
||
public function administratorLockUser(\AcceptanceTester $I) | ||
{ | ||
$I->am('Administrator'); | ||
$I->wantToTest('Locking a user'); | ||
$I->doAdministratorLogin(); | ||
$I->amGoingTo('Navigate to Users page in /administrator/'); | ||
$I->amOnPage('administrator/index.php?option=com_users&view=users'); | ||
$I->expectTo('see Users page'); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
$I->searchForItem($this->name); | ||
$I->waitForText($this->name); | ||
$I->click(['id' => 'cb0']); | ||
$I->click('Block'); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
$I->waitForText($this->name); | ||
$I->expectTo('see a success message and the user has been blocked'); | ||
$I->see('User blocked', ['id' => 'system-message-container']); | ||
} | ||
|
||
public function administratorUnLockUser(\AcceptanceTester $I) | ||
{ | ||
$I->am('Administrator'); | ||
$I->wantToTest('Unlocking a user'); | ||
$I->doAdministratorLogin(); | ||
$I->amGoingTo('Navigate to Users page in /administrator/'); | ||
$I->amOnPage('administrator/index.php?option=com_users&view=users'); | ||
$I->expectTo('see Users page'); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
$I->searchForItem($this->name); | ||
$I->waitForText($this->name); | ||
$I->click(['id' => 'cb0']); | ||
$I->wait(1); | ||
$I->click('Unblock'); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
$I->waitForText($this->name); | ||
$I->expectTo('see a success message and the user has been unlocked'); | ||
$I->see('User enabled', ['id' => 'system-message-container']); | ||
} | ||
|
||
public function administratorDeleteUser(\AcceptanceTester $I) | ||
{ | ||
$I->am('Administrator'); | ||
$I->wantToTest('Deleting a user'); | ||
|
||
$I->doAdministratorLogin(); | ||
$I->amGoingTo('Navigate to Users page in /administrator/'); | ||
$I->amOnPage('administrator/index.php?option=com_users&view=users'); | ||
|
||
$I->expectTo('see Users page'); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
|
||
$I->searchForItem($this->name); | ||
$I->waitForText('Users', TIMEOUT, ['class' => 'page-title']); | ||
$I->click(['id' => 'cb0']); | ||
$I->click('Delete'); | ||
$I->acceptPopup(); | ||
$I->waitForText('Users', TIMEOUT, ['class' => 'page-title']); | ||
$I->checkForPhpNoticesOrWarnings(); | ||
$I->expectTo('see a success message and the user is deleted'); | ||
$I->see('User successfully deleted', ['id' => 'system-message-container']); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing seems to be broken...