Skip to content
Merged
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
17 changes: 11 additions & 6 deletions src/JoomlaBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,38 +103,43 @@ protected function instantiateLocator()
/**
* Function to Do Admin Login In Joomla!
*
* @param string|null $user Optional Username. If not passed the one in acceptance.suite.yml will be used
* @param string|null $password Optional password. If not passed the one in acceptance.suite.yml will be used
* @param string|null $user Optional Username. If not passed the one in acceptance.suite.yml will be used
* @param string|null $password Optional password. If not passed the one in acceptance.suite.yml will be used
* @param bool $useSnapshot Whether or not you want to reuse the session from previous login. Enabled by default.
*
* @return void
*
* @since 3.0.0
*/
public function doAdministratorLogin($user = null, $password = null)
public function doAdministratorLogin($user = null, $password = null, $useSnapshot = true)
{
if (is_null($user))
{
$user = $this->config['username'];
}

if (is_null($password))
{
$password = $this->config['password'];
}

if ($useSnapshot && $this->loadSessionSnapshot($user))
{
return;
}
$this->debug('I open Joomla Administrator Login Page');
$this->amOnPage($this->locator->adminLoginPageUrl);
$this->waitForElement($this->locator->adminLoginUserName, TIMEOUT);
$this->debug('Fill Username Text Field');
$this->fillField($this->locator->adminLoginUserName, $user);
$this->debug('Fill Password Text Field');
$this->fillField($this->locator->adminLoginPassword, $password);

// @todo: update login button in joomla login screen to make this xPath more friendly
$this->debug('I click Login button');
$this->click($this->locator->adminLoginButton);
$this->debug('I wait to see Administrator Control Panel');
$this->waitForText($this->locator->adminControlPanelText, 4, $this->locator->controlPanelLocator);
if ($useSnapshot) {
$this->saveSessionSnapshot($user);
}
}

/**
Expand Down