Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions administrator/modules/mod_login/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<?php echo JText::_('JGLOBAL_USERNAME'); ?>
</label>
</span>
<input name="username" tabindex="1" id="mod-login-username" type="text" class="input-medium" placeholder="<?php echo JText::_('JGLOBAL_USERNAME'); ?>" size="15" autofocus="true" />
<input name="username" tabindex="1" id="mod-login-username" type="text" class="input-medium" placeholder="<?php echo JText::_('JGLOBAL_USERNAME'); ?>" size="15" autofocus="true" data-tests="login-username"/>
<a href="<?php echo JUri::root(); ?>index.php?option=com_users&view=remind" class="btn width-auto hasTooltip" title="<?php echo JText::_('MOD_LOGIN_REMIND'); ?>">
<span class="icon-help"></span>
</a>
Expand All @@ -41,7 +41,7 @@
<?php echo JText::_('JGLOBAL_PASSWORD'); ?>
</label>
</span>
<input name="passwd" tabindex="2" id="mod-login-password" type="password" class="input-medium" placeholder="<?php echo JText::_('JGLOBAL_PASSWORD'); ?>" size="15"/>
<input name="passwd" tabindex="2" id="mod-login-password" type="password" class="input-medium" placeholder="<?php echo JText::_('JGLOBAL_PASSWORD'); ?>" size="15" data-tests="password"/>
<a href="<?php echo JUri::root(); ?>index.php?option=com_users&view=reset" class="btn width-auto hasTooltip" title="<?php echo JText::_('MOD_LOGIN_RESET'); ?>">
<span class="icon-help"></span>
</a>
Expand Down Expand Up @@ -84,7 +84,7 @@
<div class="control-group">
<div class="controls">
<div class="btn-group">
<button tabindex="3" class="btn btn-primary btn-block btn-large">
<button tabindex="3" class="btn btn-primary btn-block btn-large" data-tests="log in">
<span class="icon-lock icon-white"></span> <?php echo JText::_('MOD_LOGIN_LOGIN'); ?>
</button>
</div>
Expand Down
18 changes: 18 additions & 0 deletions tests/_support/Page/Acceptance/Administrator/Login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
namespace Page\Acceptance\Administrator;

class Login extends \AcceptanceTester
{
/**
* @When I login into Joomla Administrator with username :arg1 and password :arg1
*/
public function login($username, $password)
{
$I = $this;
$I->amOnPage('administrator/');
$I->fillField(['css' => 'input[data-tests="username"'], $username);
$I->fillField(['css' => 'input[data-tests="password"'], $password);
$I->click(['css' => 'button[data-tests="log in"']);
$I->doAdministratorLogout();
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pritalpatel this is the page object that represents the Administrator -> Login Page

23 changes: 23 additions & 0 deletions tests/_support/Step/Acceptance/Administrator/User.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
namespace Step\Acceptance\Administrator;

class User extends \AcceptanceTester
{
/**
* @Given I am registered administrator named :arg1
*/
public function iAmRegisteredAdministratorNamed($arg1)
{
$I = $this;
$I->comment('@todo');
}

/**
* @Then I should see administrator dashboard
*/
public function iShouldSeeAdministratorDashboard()
{
$I = $this;
$I->comment('@todo');
}
}
8 changes: 7 additions & 1 deletion tests/acceptance.suite.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ modules:
language: 'English (United Kingdom)' # Language in which you want the Application to be Installed
AcceptanceHelper:
url: 'http://localhost/tests/joomla-cms3' # the url that points to the joomla installation at /tests/system/joomla-cms - we need it twice here
error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED"
error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED"
gherkin:
contexts:
default:
- AcceptanceTester
- Step\Acceptance\Administrator\User
- Page\Acceptance\Administrator\Login
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pritalpatel check here how we load the Page Object

3 changes: 0 additions & 3 deletions tests/acceptance/_bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
<?php
// Here you can initialize variables that will be available to your tests

\Codeception\Util\Autoload::registerSuffix('Steps', __DIR__. DIRECTORY_SEPARATOR . '_steps');
9 changes: 9 additions & 0 deletions tests/acceptance/administratorlogin.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Feature: administrator login
In order to manage my web application
As administrator
I need to be able to login

Scenario: Successful login
Given I am registered administrator named "admin"
When I login into Joomla Administrator with username "admin" and password "admin"
Then I should see administrator dashboard
62 changes: 31 additions & 31 deletions tests/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.