public function theUsernameShouldBe(string $username)
    {
        $toolbar = $this->getElement('Toolbar');
        $actual  = $toolbar->getAuthenticatedUserText();

        if ($username !== $actual) {
            $message = sprintf('[W807] Toolbar shows authenticated user is "%1$s", not "%2$s"', $actual, $username);
            throw new ElementTextException($message, $this->getSession()->getDriver(), $toolbar);
        }
    }
public function theUsernameShouldBe(string $username)
    {
        $toolbar = $this->getElement('Toolbar');
        $actual  = $toolbar->getAuthenticatedUserText();

        if ($username !== $actual) {
            $message = sprintf('[W807] Toolbar shows authenticated user is "%1$s", not "%2$s"', $actual, $username);
            throw new ElementTextException($message, $this->getSession()->getDriver(), $toolbar);
        }
    }
public function theUsernameShouldBe ( string $ username ) { $ toolbar = $ this -> getElement ( 'Toolbar' ) ; $ actual = $ toolbar -> getAuthenticatedUserText ( ) ; if ( $ username !== $ actual ) { $ message = sprintf ( '[W807] Toolbar shows authenticated user is "%1$s", not "%2$s"' , $ actual , $ username ) ; throw new ElementTextException ( $ message , $ this -> getSession ( ) -> getDriver ( ) , $ toolbar ) ; } }
Checks the authenticated user show in the toolbar.

Example: Then the toolbar should show I am authenticated as admin

@Then the toolbar should show I am authenticated as :username

@param string $username
Checks the authenticated user show in the toolbar .