Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 101 additions & 11 deletions tests/acceptance/administrator/UserCest.php
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
*/
Copy link
Member

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...

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';
}

Expand All @@ -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);
Expand All @@ -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']);
}
}