From 664e3270e3ab187ab43f14fa107798caf78d4e61 Mon Sep 17 00:00:00 2001 From: puneet0191 Date: Wed, 29 Apr 2015 23:56:44 +0530 Subject: [PATCH] Front End Login Function --- src/JoomlaBrowser.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/JoomlaBrowser.php b/src/JoomlaBrowser.php index 60bd317..56b2324 100644 --- a/src/JoomlaBrowser.php +++ b/src/JoomlaBrowser.php @@ -47,6 +47,25 @@ public function doAdministratorLogin() $I->waitForText('Control Panel', 4, ['css' => 'h1.page-title']); } + /** + * Function to Do frontend Login in Joomla! + */ + public function doFrontEndLogin() + { + $I = $this; + $this->debug('I open Joomla Frontend Login Page'); + $I->amOnPage('/index.php?option=com_users&view=login'); + $this->debug('Fill Username Text Field'); + $I->fillField(['id' => 'username'], $this->config['username']); + $this->debug('Fill Password Text Field'); + $I->fillField(['id' => 'password'], $this->config['password']); + // @todo: update login button in joomla login screen to make this xPath more friendly + $this->debug('I click Login button'); + $I->click(['xpath' => "//div[@class='login']/form/fieldset/div[4]/div/button"]); + $this->debug('I wait to see Frontend Member Profile Form'); + $I->waitForElement(['xpath' => "//form[@id='member-profile']"], 10); + } + /** * Installs Joomla */ @@ -170,7 +189,8 @@ public function installExtensionFromDirectory($path) $I = $this; $I->amOnPage('/administrator/index.php?option=com_installer'); $I->click(['link' => 'Install from Directory']); - $I->fillField(['id' => 'Install from Directory'], $path); + $this->debug('I enter the Path for extension'); + $I->fillField(['id' => 'install_directory'], $path); // @todo: we need to find a better locator for the following Install button $I->click(['xpath' => "//input[contains(@onclick,'Joomla.submitbutton3()')]"]); // Install button $I->waitForText('was successful', 10, ['id' => 'system-message-container']);