redirecting on login after being logout from administration dashboard

This commit is contained in:
Loïc Frémont 2018-10-26 10:28:40 +02:00 committed by Grzegorz Sadowski
parent 4c09714660
commit ccae299769
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
5 changed files with 40 additions and 2 deletions

View file

@ -0,0 +1,14 @@
@administrator_login
Feature: Redirecting on login page
In order to access on my admin dashboard
As a logged out Administrator
I need to be redirected on login page
Background:
Given the store operates on a single channel in "United States"
And I have been logged out from administration
@ui
Scenario: Redirecting on login page after being logout
When I try to open administration dashboard
Then I should be on login page

View file

@ -71,4 +71,14 @@ final class AdminSecurityContext implements Context
$this->sharedStorage->set('administrator', $user);
}
/**
* @Given I have been logged out from administration
*/
public function iHaveBeenLoggedOutFromAdministration()
{
$this->securityService->logOut();
$this->sharedStorage->set('administrator', null);
}
}

View file

@ -15,6 +15,7 @@ namespace Sylius\Behat\Context\Ui\Admin;
use Behat\Behat\Context\Context;
use Sylius\Behat\Page\Admin\DashboardPageInterface;
use Sylius\Behat\Page\UnexpectedPageException;
use Sylius\Component\Core\Formatter\StringInflector;
use Webmozart\Assert\Assert;
@ -29,11 +30,14 @@ final class DashboardContext implements Context
}
/**
* @When I open administration dashboard
* @When I (try to )open administration dashboard
*/
public function iOpenAdministrationDashboard()
{
$this->dashboardPage->open();
try {
$this->dashboardPage->open();
} catch (UnexpectedPageException $e) {
}
}
/**

View file

@ -82,6 +82,14 @@ final class LoginContext implements Context
Assert::false($this->dashboardPage->isOpen());
}
/**
* @Given I should be on login page
*/
public function iShouldBeOnLoginPage()
{
Assert::true($this->loginPage->isOpen());
}
/**
* @Then I should be notified about bad credentials
*/

View file

@ -10,9 +10,11 @@ default:
- sylius.behat.context.transform.user
- sylius.behat.context.setup.channel
- sylius.behat.context.setup.admin_security
- sylius.behat.context.setup.admin_user
- sylius.behat.context.setup.user
- sylius.behat.context.ui.admin.dashboard
- sylius.behat.context.ui.admin.login
filters:
tags: "@administrator_login && @ui"