-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@javascript @changePassword | ||
Feature: Verify that an User allowed to change password can change his password | ||
|
||
Scenario: I can change my password | ||
Given I open Login page | ||
And I log in as "UserPassword" with password "Passw0rd-42" | ||
When I go to change my password | ||
And I change password from "Passw0rd-42" to "Passw0rd-43" | ||
And I click on the edit action bar button "Update" | ||
Then success notification that "Your password has been successfully changed." appears | ||
And I should be on Dashboard page | ||
|
||
Scenario: I can log in with new password | ||
Given I open Login page | ||
When I log in as "UserPassword" with password "Passw0rd-43" | ||
Then I should be on Dashboard page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace EzSystems\EzPlatformAdminUi\Behat\BusinessContext; | ||
|
||
use EzSystems\EzPlatformAdminUi\Behat\PageObject\ChangePasswordPage; | ||
use EzSystems\EzPlatformAdminUi\Behat\PageObject\PageObjectFactory; | ||
|
||
class UserPreferencesContext extends BusinessContext | ||
{ | ||
/** | ||
* @When I change password from :oldPassword to :newPassword | ||
*/ | ||
public function iChangePassword($oldPassword, $newPassword): void | ||
{ | ||
$passwordPage = PageObjectFactory::createPage($this->utilityContext, ChangePasswordPage::PAGE_NAME); | ||
$passwordPage->verifyIsLoaded(); | ||
$passwordPage->setOldPassword($oldPassword); | ||
$passwordPage->setNewPassword($newPassword); | ||
$passwordPage->setConfirmPassword($newPassword); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace EzSystems\EzPlatformAdminUi\Behat\PageObject; | ||
|
||
use EzSystems\EzPlatformAdminUi\Behat\Helper\UtilityContext; | ||
use EzSystems\EzPlatformAdminUi\Behat\PageElement\ElementFactory; | ||
use EzSystems\EzPlatformAdminUi\Behat\PageElement\RightMenu; | ||
use PHPUnit\Framework\Assert; | ||
|
||
class ChangePasswordPage extends Page | ||
{ | ||
/** @var string Name by which Page is recognised */ | ||
public const PAGE_NAME = 'Change my password'; | ||
|
||
/** | ||
* @var RightMenu | ||
*/ | ||
private $rightMenu; | ||
|
||
public function __construct(UtilityContext $context) | ||
{ | ||
parent::__construct($context); | ||
$this->rightMenu = ElementFactory::createElement($this->context, RightMenu::ELEMENT_NAME); | ||
$this->siteAccess = 'admin'; | ||
$this->route = '/user/change-password'; | ||
$this->pageTitleLocator = '.ez-header h1'; | ||
$this->fields = [ | ||
'oldPassword' => '#user_password_change_oldPassword', | ||
'newPassword' => '#user_password_change_newPassword_first', | ||
'confirmPassword' => '#user_password_change_newPassword_second', | ||
]; | ||
} | ||
|
||
public function verifyElements(): void | ||
{ | ||
$this->rightMenu->verifyVisibility(); | ||
} | ||
|
||
public function verifyRoute(): void | ||
{ | ||
$expectedRoute = '/' . $this->siteAccess . $this->route; | ||
Assert::assertContains($expectedRoute, $this->getCurrentRoute()); | ||
} | ||
|
||
public function verifyTitle(): void | ||
{ | ||
Assert::assertContains($this::PAGE_NAME, $this->getPageTitle()); | ||
} | ||
|
||
public function verifyIsLoaded(): void | ||
{ | ||
$this->verifyElements(); | ||
$this->verifyRoute(); | ||
$this->verifyTitle(); | ||
} | ||
|
||
public function setOldPassword(string $value): void | ||
{ | ||
$this->context->findElement($this->fields['oldPassword'])->setValue($value); | ||
} | ||
|
||
public function setNewPassword(string $value): void | ||
{ | ||
$this->context->findElement($this->fields['newPassword'])->setValue($value); | ||
} | ||
|
||
public function setConfirmPassword(string $value): void | ||
{ | ||
$this->context->findElement($this->fields['confirmPassword'])->setValue($value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters