Skip to content

Commit 5966f15

Browse files
committed
Merge branch 'release/v1.1.7'
2 parents 26499b5 + 8f313cf commit 5966f15

File tree

1 file changed

+45
-24
lines changed

1 file changed

+45
-24
lines changed

src/JoomlaBrowser.php

Lines changed: 45 additions & 24 deletions
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' => "//input[@value='Log out']"], 10);
67+
}
68+
5069
/**
5170
* Installs Joomla
5271
*/
@@ -59,56 +78,57 @@ public function installJoomla()
5978
// @todo: activate the filesystem module
6079
//$I->expect('no configuration.php is in the Joomla CMS folder');
6180
//$I->dontSeeFileFound('configuration.php', $this->config['Joomla folder')];
81+
$this->debug('I open Joomla Installation Configuration Page');
6282
$I->amOnPage('/installation/index.php');
63-
$this->debug('I open Joomla Installation Configuration Page and fill the fields');
64-
83+
$this->debug('I check that FTP tab is not present in installation. Otherwise it means that I have not enough permissions to install joomla and execution will be stoped');
84+
$I->dontSeeElement(['id' => 'ftp']);
6585
// I Wait for the text Main Configuration, meaning that the page is loaded
6686
$this->debug('I wait for Main Configuration');
6787
$I->waitForText('Main Configuration', 10,['xpath' => '//h3']);
6888

6989
$this->debug('I click Language Selector');
70-
$I->click("//div[@id='jform_language_chzn']/a"); // Language Selector
90+
$I->click(['xpath' => "//div[@id='jform_language_chzn']/a"]); // Language Selector
7191
$this->debug('I select en-GB');
72-
$I->click("//li[text()='English (United Kingdom)']"); // English (United Kingdom)
73-
sleep(1);
92+
$I->click(['xpath' => "//li[text()='English (United Kingdom)']"]); // English (United Kingdom)
93+
$I->wait(1);
7494
$this->debug('I fill Site Name');
75-
$I->fillField('Site Name', 'Joomla CMS test');
95+
$I->fillField(['id' => 'jform_site_name'], 'Joomla CMS test');
7696
$this->debug('I fill Site Description');
77-
$I->fillField('Description', 'Site for testing Joomla CMS');
97+
$I->fillField(['id' => 'jform_site_metadesc'], 'Site for testing Joomla CMS');
7898

7999
// I get the configuration from acceptance.suite.yml (see: tests/_support/acceptancehelper.php)
80100
$this->debug('I fill Admin Email');
81-
$I->fillField('Admin Email', $this->config['admin email']);
101+
$I->fillField(['id' => 'jform_admin_email'], $this->config['admin email']);
82102
$this->debug('I fill Admin Username');
83-
$I->fillField('Admin Username', $this->config['username']);
103+
$I->fillField(['id' => 'jform_admin_user'], $this->config['username']);
84104
$this->debug('I fill Admin Password');
85-
$I->fillField('Admin Password', $this->config['password']);
105+
$I->fillField(['id' => 'jform_admin_password'], $this->config['password']);
86106
$this->debug('I fill Admin Password Confirmation');
87-
$I->fillField('Confirm Admin Password', $this->config['password']);
107+
$I->fillField(['id' => 'jform_admin_password2'], $this->config['password']);
88108
$this->debug('I click Site Offline: no');
89-
$I->click("//fieldset[@id='jform_site_offline']/label[2]"); // ['No Site Offline']
109+
$I->click(['xpath' => "//fieldset[@id='jform_site_offline']/label[2]"]); // ['No Site Offline']
90110
$this->debug('I click Next');
91-
$I->click('Next');
111+
$I->click(['link' => 'Next']);
92112

93113
$this->debug('I Fill the form for creating the Joomla site Database');
94114
$I->waitForText('Database Configuration', 10,['css' => 'h3']);
95115

96116
$this->debug('I select MySQLi');
97-
$I->selectOption('#jform_db_type', $this->config['database type']);
117+
$I->selectOption(['id' => 'jform_db_type'], $this->config['database type']);
98118
$this->debug('I fill Database Host');
99-
$I->fillField('Host Name', $this->config['database host']);
119+
$I->fillField(['id' => 'jform_db_host'], $this->config['database host']);
100120
$this->debug('I fill Database User');
101-
$I->fillField('Username', $this->config['database user']);
121+
$I->fillField(['id' => 'jform_db_user'], $this->config['database user']);
102122
$this->debug('I fill Database Password');
103-
$I->fillField('Password', $this->config['database password']);
123+
$I->fillField(['id' => 'jform_db_pass'], $this->config['database password']);
104124
$this->debug('I fill Database Name');
105-
$I->fillField('Database Name', $this->config['database name']);
125+
$I->fillField(['id' => 'jform_db_name'], $this->config['database name']);
106126
$this->debug('I fill Database Prefix');
107-
$I->fillField('Table Prefix', $this->config['database prefix']);
127+
$I->fillField(['id' => 'jform_db_prefix'], $this->config['database prefix']);
108128
$this->debug('I click Remove Old Database ');
109-
$I->click("//label[@for='jform_db_old1']"); // Remove Old Database button
129+
$I->click(['xpath' => "//label[@for='jform_db_old1']"]); // Remove Old Database button
110130
$this->debug('I click Next');
111-
$I->click('Next');
131+
$I->click(['link' => 'Next']);
112132

113133
$this->debug('I install joomla with or without sample data');
114134
$I->waitForText('Finalisation', 10, ['xpath' => '//h3']);
@@ -120,8 +140,8 @@ public function installJoomla()
120140
// $this->debug('I install Joomla without Sample Data');
121141
// $I->selectOption('#jform_sample_file', '#jform_sample_file0'); // No sample data
122142
//endif;
123-
$I->selectOption('#jform_sample_file', '#jform_sample_file0'); // No sample data
124-
$I->click('Install');
143+
$I->selectOption(['id' => 'jform_sample_file'], ['id' => 'jform_sample_file0']); // No sample data
144+
$I->click(['link' => 'Install']);
125145

126146
// Wait while Joomla gets installed
127147
$this->debug('I wait for Joomla being installed');
@@ -170,7 +190,8 @@ public function installExtensionFromDirectory($path)
170190
$I = $this;
171191
$I->amOnPage('/administrator/index.php?option=com_installer');
172192
$I->click(['link' => 'Install from Directory']);
173-
$I->fillField(['id' => 'Install from Directory'], $path);
193+
$this->debug('I enter the Path for extension');
194+
$I->fillField(['id' => 'install_directory'], $path);
174195
// @todo: we need to find a better locator for the following Install button
175196
$I->click(['xpath' => "//input[contains(@onclick,'Joomla.submitbutton3()')]"]); // Install button
176197
$I->waitForText('was successful', 10, ['id' => 'system-message-container']);

0 commit comments

Comments
 (0)