Skip to content

Commit e744da6

Browse files
committed
Merge pull request #1 from joomla-projects/FrontEndLogin
Front End Login Function
2 parents 2de14ae + 664e327 commit e744da6

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/JoomlaBrowser.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,25 @@ public function doAdministratorLogin()
4747
$I->waitForText('Control Panel', 4, ['css' => 'h1.page-title']);
4848
}
4949

50+
/**
51+
* Function to Do frontend Login in Joomla!
52+
*/
53+
public function doFrontEndLogin()
54+
{
55+
$I = $this;
56+
$this->debug('I open Joomla Frontend Login Page');
57+
$I->amOnPage('/index.php?option=com_users&view=login');
58+
$this->debug('Fill Username Text Field');
59+
$I->fillField(['id' => 'username'], $this->config['username']);
60+
$this->debug('Fill Password Text Field');
61+
$I->fillField(['id' => 'password'], $this->config['password']);
62+
// @todo: update login button in joomla login screen to make this xPath more friendly
63+
$this->debug('I click Login button');
64+
$I->click(['xpath' => "//div[@class='login']/form/fieldset/div[4]/div/button"]);
65+
$this->debug('I wait to see Frontend Member Profile Form');
66+
$I->waitForElement(['xpath' => "//form[@id='member-profile']"], 10);
67+
}
68+
5069
/**
5170
* Installs Joomla
5271
*/
@@ -170,7 +189,8 @@ public function installExtensionFromDirectory($path)
170189
$I = $this;
171190
$I->amOnPage('/administrator/index.php?option=com_installer');
172191
$I->click(['link' => 'Install from Directory']);
173-
$I->fillField(['id' => 'Install from Directory'], $path);
192+
$this->debug('I enter the Path for extension');
193+
$I->fillField(['id' => 'install_directory'], $path);
174194
// @todo: we need to find a better locator for the following Install button
175195
$I->click(['xpath' => "//input[contains(@onclick,'Joomla.submitbutton3()')]"]); // Install button
176196
$I->waitForText('was successful', 10, ['id' => 'system-message-container']);

0 commit comments

Comments
 (0)