2014-06-17 08:53:47 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
class AuthTest extends UiTestCase
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
public function testSignInAndOut()
|
|
|
|
|
|
{
|
|
|
|
|
|
$this->open('backend');
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
try {
|
|
|
|
|
|
$this->assertTitle('Administration Area');
|
|
|
|
|
|
$this->assertTrue($this->isElementPresent("name=login"));
|
|
|
|
|
|
$this->assertTrue($this->isElementPresent("name=password"));
|
|
|
|
|
|
$this->assertTrue($this->isElementPresent("//button[@type='submit']"));
|
|
|
|
|
|
$this->verifyText("//button[@type='submit']", "Login");
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (PHPUnit_Framework_AssertionFailedError $e) {
|
|
|
|
|
|
array_push($this->verificationErrors, $e->toString());
|
|
|
|
|
|
}
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
/*
|
|
|
|
|
|
* Sign in
|
|
|
|
|
|
*/
|
|
|
|
|
|
$this->type("name=login", TEST_SELENIUM_USER);
|
|
|
|
|
|
$this->type("name=password", TEST_SELENIUM_PASS);
|
|
|
|
|
|
$this->click("//button[@type='submit']");
|
|
|
|
|
|
$this->waitForPageToLoad("30000");
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
try {
|
|
|
|
|
|
$this->assertTitle('Dashboard | October CMS');
|
2015-03-02 09:18:24 +00:00
|
|
|
|
$this->assertTrue($this->isElementPresent('css=a[data-original-title="Sign out"]'));
|
2014-06-17 10:21:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
catch (PHPUnit_Framework_AssertionFailedError $e) {
|
|
|
|
|
|
array_push($this->verificationErrors, $e->toString());
|
|
|
|
|
|
}
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
/*
|
|
|
|
|
|
* Log out
|
|
|
|
|
|
*/
|
2015-03-02 09:18:24 +00:00
|
|
|
|
$this->click('css=a[data-original-title="Sign out"]');
|
2014-06-17 10:21:07 +00:00
|
|
|
|
$this->waitForPageToLoad("30000");
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
try {
|
|
|
|
|
|
$this->assertTitle('Administration Area');
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (PHPUnit_Framework_AssertionFailedError $e) {
|
|
|
|
|
|
array_push($this->verificationErrors, $e->toString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
public function testPasswordReset()
|
|
|
|
|
|
{
|
|
|
|
|
|
$this->open('backend');
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
try {
|
|
|
|
|
|
$this->assertTrue($this->isElementPresent("link=exact:Forgot your password?"));
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (PHPUnit_Framework_AssertionFailedError $e) {
|
|
|
|
|
|
array_push($this->verificationErrors, $e->toString());
|
|
|
|
|
|
}
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
$this->click('link=exact:Forgot your password?');
|
|
|
|
|
|
$this->waitForPageToLoad("30000");
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
try {
|
|
|
|
|
|
$this->assertTrue($this->isElementPresent("//button[@type='submit']"));
|
|
|
|
|
|
$this->verifyText("//button[@type='submit']", "Restore");
|
|
|
|
|
|
$this->assertTrue($this->isElementPresent("link=Cancel"));
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (PHPUnit_Framework_AssertionFailedError $e) {
|
|
|
|
|
|
array_push($this->verificationErrors, $e->toString());
|
|
|
|
|
|
}
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
$this->type("name=login", TEST_SELENIUM_USER);
|
|
|
|
|
|
sleep(1);
|
|
|
|
|
|
$this->click("//button[@type='submit']");
|
|
|
|
|
|
$this->waitForPageToLoad("30000");
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
try {
|
|
|
|
|
|
$this->assertTitle('Administration Area');
|
|
|
|
|
|
$this->assertTrue($this->isElementPresent("css=p.flash-message.success"));
|
|
|
|
|
|
$this->verifyText("css=p.flash-message.success", "An email has been sent to your email address with password restore instructions.×");
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (PHPUnit_Framework_AssertionFailedError $e) {
|
|
|
|
|
|
array_push($this->verificationErrors, $e->toString());
|
|
|
|
|
|
}
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
2014-06-17 10:21:07 +00:00
|
|
|
|
}
|
2014-06-17 08:53:47 +00:00
|
|
|
|
|
|
|
|
|
|
}
|