Selenium Test Case Methods
From Joomla! Documentation
(Difference between revisions)
Betweenbrain (Talk | contribs) (→Available Selenium Test Case Methods) |
Betweenbrain (Talk | contribs) |
||
| Line 19: | Line 19: | ||
* setTinyText($text) | * setTinyText($text) | ||
| − | == doAdminLogin == | + | === doAdminLogin === |
* Logs into the administrative side of Joomla! | * Logs into the administrative side of Joomla! | ||
| Line 35: | Line 35: | ||
}</pre> | }</pre> | ||
| − | == doAdminLogout == | + | === doAdminLogout === |
* Logs out of the administrative side of Joomla! | * Logs out of the administrative side of Joomla! | ||
<pre> function doAdminLogout() | <pre> function doAdminLogout() | ||
| Line 44: | Line 44: | ||
}</pre> | }</pre> | ||
| − | == gotoAdmin == | + | === gotoAdmin === |
* Navigates to the administrative side of Joomla! | * Navigates to the administrative side of Joomla! | ||
<pre> function gotoAdmin() | <pre> function gotoAdmin() | ||
| Line 53: | Line 53: | ||
}</pre> | }</pre> | ||
| − | == gotoSite == | + | === gotoSite === |
* Navigates to the front end of Joomla! | * Navigates to the front end of Joomla! | ||
<pre> function gotoSite() | <pre> function gotoSite() | ||
| Line 62: | Line 62: | ||
}</pre> | }</pre> | ||
| − | == doFrontEndLogin == | + | === doFrontEndLogin === |
* Logs into the front end of Joomla! | * Logs into the front end of Joomla! | ||
<pre> function doFrontEndLogin() | <pre> function doFrontEndLogin() | ||
| Line 74: | Line 74: | ||
}</pre> | }</pre> | ||
| − | == doFrontEndLogout == | + | === doFrontEndLogout === |
* Logs out of the front end of Joomla! | * Logs out of the front end of Joomla! | ||
<pre> function doFrontEndLogout() | <pre> function doFrontEndLogout() | ||
| Line 84: | Line 84: | ||
}</pre> | }</pre> | ||
| − | == setTinyText == | + | === setTinyText === |
* Allows the test to input data | * Allows the test to input data | ||
<pre> function setTinyText($text) | <pre> function setTinyText($text) | ||
Revision as of 15:18, 10 February 2010
| This article is a stub and needs to be expanded. If you can provide information or finish this article you're welcome to do so. Please remove this message afterwards or replace with {{inuse}} while making major edits. - Thank you. |
Contents |
News and Updates
2010 02 10 : Initial draft of this article
Introduction
With the introduction of System tests in February 2010, there are also a number of Joomla! specific methods that can be used. These methods are part of the SeleniumJoomlaTestCase class, as defined by the file tests/system/SeleniumJoomlaTestCase.php
These methods exist so that none of the path or login information is coded into the tests. Instead, it comes from the config file located at tests/system/servers/configdef.php See Running_Automated_Tests_for_Version_1.6#Create_a_Selenium_Configuration_File
Available Selenium Test Case Methods
As of this writing, there are seven methods that belong to the SeleniumJoomlaTestCase class.
- doAdminLogin()
- doAdminLogout()
- gotoAdmin()
- gotoSite()
- doFrontEndLogin()
- doFrontEndLogout()
- setTinyText($text)
doAdminLogin
- Logs into the administrative side of Joomla!
function doAdminLogin()
{
//$this->setUp();
echo "Logging in to admin.\n";
$cfg = new SeleniumConfig();
$this->open($cfg->path . "administrator/index.php?option=com_login");
$this->waitForPageToLoad("30000");
$this->type("mod-login-username", $cfg->username);
$this->type("mod-login-password", $cfg->password);
$this->click("link=Log in");
$this->waitForPageToLoad("30000");
}
doAdminLogout
- Logs out of the administrative side of Joomla!
function doAdminLogout()
{
$this->gotoAdmin();
echo "Logging out of back end.\n";
$this->click("link=Logout");
}
gotoAdmin
- Navigates to the administrative side of Joomla!
function gotoAdmin()
{
echo "Browsing to admin.\n";
$cfg = new SeleniumConfig();
$this->open($cfg->path . "administrator");
}
gotoSite
- Navigates to the front end of Joomla!
function gotoSite()
{
echo "Browsing to site.\n";
$cfg = new SeleniumConfig();
$this->open($cfg->path);
}
doFrontEndLogin
- Logs into the front end of Joomla!
function doFrontEndLogin()
{
$this->gotoSite();
echo "Logging into front end of site.\n";
$this->type("modlgn_username", "admin");
$this->type("modlgn_passwd", "password");
$this->click("Submit");
$this->waitForPageToLoad("30000");
}
doFrontEndLogout
- Logs out of the front end of Joomla!
function doFrontEndLogout()
{
$this->gotoSite();
echo "Logging out of front end of site.\n";
$this->click("Submit");
$this->waitForPageToLoad("30000");
}
setTinyText
- Allows the test to input data
function setTinyText($text)
{
$this->selectFrame("text_ifr");
$this->type("tinymce", $text);
$this->selectFrame("relative=top");
}