Skip to content

Commit 984c8d1

Browse files
committed
Merge branch 'release/v1.1'
2 parents d1c95bb + 2098b80 commit 984c8d1

File tree

2 files changed

+65
-7
lines changed

2 files changed

+65
-7
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,24 @@ You are asked to remove WebDriver module and change it by the JoomlaBrowser modu
5151
```yaml
5252
config:
5353
JoomlaBrowser:
54-
url: 'http://joomla.box/repos/redmember2/tests/joomla-cms3/' # the url that points to the joomla installation at /tests/system/joomla-cms
54+
url: 'http://localhost/joomla-cms/' # the url that points to the joomla installation at /tests/system/joomla-cms
5555
browser: 'firefox'
5656
window_size: 1024x768
5757
capabilities:
5858
unexpectedAlertBehaviour: 'accept'
5959
username: 'admin'
6060
password: 'admin'
61+
database host: 'localhost' # place where the Application is Hosted #server Address
62+
database user: 'root' # MySQL Server user ID, usually root
63+
database password: '1234' # MySQL Server password, usually empty or root
64+
database name: 'dbname' # DB Name, at the Server
65+
database type: 'mysqli' # type in lowercase one of the options: MySQL\MySQLi\PDO
66+
database prefix: 'jos_' # DB Prefix for tables
67+
install sample data: 'Yes' # Do you want to Download the Sample Data Along with Joomla Installation, then keep it Yes
68+
sample data: 'Default English (GB) Sample Data' # Default Sample Data
69+
admin email: '[email protected]' # email Id of the Admin
70+
language: 'English (United Kingdom)' # Language in which you want the Application to be Installed
71+
joomla folder: '/home/.../path to Joomla Folder' # Path to Joomla installation where we execute the tests
6172
AcceptanceHelper:
6273
...
6374
```

src/JoomlaBrowser.php

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ public function doAdministratorLogin()
3535
{
3636
$I = $this;
3737
$I->amOnPage('/administrator/index.php');
38-
$I->fillField('username', $this->config['username']);
39-
$I->fillField('Password', $this->config['password']);
40-
$I->click('Log in');
38+
$I->fillField('#mod-login-username', $this->config['username']);
39+
$I->fillField('#mod-login-password', $this->config['password']);
40+
// @todo: update login button in joomla login screen to make this xPath more friendly
41+
$I->click("//form[@id='form-login']/fieldset/div[3]/div/div/button");
4142
$I->waitForText('Control Panel', 10, 'H1');
4243
}
4344

@@ -54,38 +55,61 @@ public function installJoomla()
5455
//$I->expect('no configuration.php is in the Joomla CMS folder');
5556
//$I->dontSeeFileFound('configuration.php', $this->config['Joomla folder')];
5657
$I->amOnPage('/installation/index.php');
58+
$this->debug('I open Joomla Installation Configuration Page and fill the fields');
5759

5860
// I Wait for the text Main Configuration, meaning that the page is loaded
61+
$this->debug('I wait for Main Configuration');
5962
$I->waitForText('Main Configuration', 10, 'h3');
6063

64+
$this->debug('I click Language Selector');
6165
$I->click("//div[@id='jform_language_chzn']/a"); // Language Selector
66+
$this-debug('I select en-GB');
6267
$I->click("//li[text()='English (United Kingdom)']"); // English (United Kingdom)
6368
sleep(1);
69+
$this-debug('I fill Site Name');
6470
$I->fillField('Site Name', 'Joomla CMS test');
71+
$this-debug('I fill Site Description');
6572
$I->fillField('Description', 'Site for testing Joomla CMS');
6673

6774
// I get the configuration from acceptance.suite.yml (see: tests/_support/acceptancehelper.php)
75+
$this-debug('I fill Admin Email');
6876
$I->fillField('Admin Email', $this->config['admin email']);
77+
$this-debug('I fill Admin Username');
6978
$I->fillField('Admin Username', $this->config['username']);
79+
$this-debug('I fill Admin Password');
7080
$I->fillField('Admin Password', $this->config['password']);
81+
$this-debug('I fill Admin Password Confirmation');
7182
$I->fillField('Confirm Admin Password', $this->config['password']);
83+
$this-debug('I click Site Offline: no');
7284
$I->click("//fieldset[@id='jform_site_offline']/label[2]"); // ['No Site Offline']
85+
$this-debug('I click Next');
7386
$I->click('Next');
74-
// I Fill the form for creating the Joomla site Database'
87+
88+
$this->debug('I Fill the form for creating the Joomla site Database');
7589
$I->waitForText('Database Configuration', 10, 'h3');
7690

91+
$this-debug('I select MySQLi');
7792
$I->selectOption('#jform_db_type', $this->config['database type']);
93+
$this-debug('I fill Database Host');
7894
$I->fillField('Host Name', $this->config['database host']);
95+
$this-debug('I fill Database User');
7996
$I->fillField('Username', $this->config['database user']);
97+
$this-debug('I fill Database Password');
8098
$I->fillField('Password', $this->config['database password']);
99+
$this-debug('I fill Database Name');
81100
$I->fillField('Database Name', $this->config['database name']);
101+
$this-debug('I fill Database Prefix');
82102
$I->fillField('Table Prefix', $this->config['database prefix']);
103+
$this-debug('I click Remove Old Database ');
83104
$I->click("//label[@for='jform_db_old1']"); // Remove Old Database button
84105
$I->click('Next');
106+
$this-debug('I click Next');
107+
$I->click('Next');
85108

86-
// I Fill the form for creating the Joomla site database
109+
$this->debug('I install joomla with or without sample data');
87110
$I->waitForText('Finalisation', 10, 'h3');
88111

112+
$this-debug('I install Sample Data');
89113
if ($this->config['install sample data']) :
90114
$I->selectOption('#jform_sample_file', $this->config['sample data']);
91115
else :
@@ -95,6 +119,7 @@ public function installJoomla()
95119

96120
// Wait while Joomla gets installed
97121
$I->waitForText('Congratulations! Joomla! is now installed.', 30, 'h3');
122+
$this->debug('Joomla is now installed');
98123
}
99124

100125
/**
@@ -117,7 +142,9 @@ public function setErrorReportingtoDevelopment()
117142
}
118143

119144
/**
120-
* Sets in Adminitrator->Global Configuration the Error reporting to Development
145+
* Installs a Extension in Joomla that is located in a folder inside the server
146+
*
147+
* @param $path
121148
*
122149
* @note: doAdminLogin() before
123150
*/
@@ -131,4 +158,24 @@ public function installExtensionFromDirectory($path)
131158
$I->click("//input[contains(@onclick,'Joomla.submitbutton3()')]"); // Install button
132159
$I->waitForText('was successful', 10, '#system-message-container');
133160
}
161+
162+
/**
163+
* Function to check for PHP Notices or Warnings
164+
*
165+
* @param string $page Optional, if not given checks will be done in the current page
166+
*
167+
* @note: doAdminLogin() before
168+
*/
169+
public function checkForPhpNoticesOrWarnings($page = null)
170+
{
171+
$I = $this;
172+
173+
if($page)
174+
{
175+
$I->amOnPage($page);
176+
}
177+
178+
$I->dontSeeInPageSource('Notice:');
179+
$I->dontSeeInPageSource('Warning:');
180+
}
134181
}

0 commit comments

Comments
 (0)