Skip to content

Commit dd767d5

Browse files
committed
Add install extension from URL
1 parent 4404f38 commit dd767d5

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

src/JoomlaBrowser.php

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,40 @@ public function installExtensionFromDirectory($path, $type = 'Extension')
256256
if ($type == 'Plugin')
257257
{
258258
$this->debug('Installing plugin was successful.' . $path);
259-
}
259+
}
260+
}
261+
262+
/**
263+
* Installs a Extension in Joomla that is located in a url
264+
*
265+
* @param String $url Url address to the .zip file
266+
* @param string $type Type of Extension
267+
*
268+
* @note: doAdminLogin() before
269+
*/
270+
public function installExtensionFromUrl($url, $type = 'Extension')
271+
{
272+
$I = $this;
273+
$I->amOnPage('/administrator/index.php?option=com_installer');
274+
$I->waitForText('Extension Manager: Install','30', ['css' => 'H1']);
275+
$I->click(['link' => 'Install from URL']);
276+
$this->debug('I enter the url');
277+
$I->fillField(['id' => 'install_url'], $url);
278+
// @todo: we need to find a better locator for the following Install button
279+
$I->click(['xpath' => "//input[contains(@onclick,'Joomla.submitbutton4()')]"]); // Install button
280+
$I->waitForText('was successful','30', ['id' => 'system-message-container']);
281+
if ($type == 'Extension')
282+
{
283+
$this->debug('Extension successfully installed from ' . $url);
284+
}
285+
if ($type == 'Plugin')
286+
{
287+
$this->debug('Installing plugin was successful.' . $url);
288+
}
289+
if ($type == 'Package')
290+
{
291+
$this->debug('Installation of the package was successful.' . $url);
292+
}
260293
}
261294

262295
/**

0 commit comments

Comments
 (0)