Skip to content

Commit

Permalink
Increase Behat test coverage for locale features
Browse files Browse the repository at this point in the history
Switching to different locales is covered. And the correct working of
the stepup-locale cookie is proven
  • Loading branch information
MKodde committed Dec 19, 2019
1 parent baee5d2 commit 10b1457
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/Functional/Features/Context/WebContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@ public function iShouldSeeANameIDWithEmailAddress($emailAddress){
}
}

/**
* @Given I have :language set as my stepup-locale cookie value
*/
public function iHaveSetAsMyPreference($language)
{
$this->minkContext->getSession()->setCookie('stepup_locale', $language);
}

private function receiveResponse()
{
$samlResponse = $this->minkContext->getSession()->getPage()->find('css', 'input[name="SAMLResponse"]');
Expand Down
24 changes: 24 additions & 0 deletions tests/Functional/Features/registration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,30 @@ Feature: When an user needs to register for a new token
And the SAML Response should contain element "StatusCode" with attribute "Value" with attribute value "urn:oasis:names:tc:SAML:2.0:status:Success"
And the SAML Response should contain element "NameID" with value containing "[email protected]"

Scenario: The user is presented the page in his preferred language based on stepup-locale cookie NL
Given I have "nl" set as my stepup-locale cookie value
And I send a registration request request to "https://azure-mfa.stepup.example.com/saml/sso"
Then I should see "Registratie"

Scenario: The user is presented the page in his preferred language based on stepup-locale cookie EN
Given I have "en" set as my stepup-locale cookie value
And I send a registration request request to "https://azure-mfa.stepup.example.com/saml/sso"
Then I should see "Registration"

Scenario: When a user is registering a new token and switches back and forth from English to Dutch language during registration
Given I send a registration request request to "https://azure-mfa.stepup.example.com/saml/sso"
Then I should see "Registration"
And I follow "NL"
Then I should see "Registratie"
And I follow "EN"
Then I should see "Registration"
And I fill in "Email address" with "[email protected]"
When I press "Submit"
And I press "Submit-success"
Then I should be on "https://azure-mfa.stepup.example.com/saml/sso_return"
And the SAML Response should contain element "StatusCode" with attribute "Value" with attribute value "urn:oasis:names:tc:SAML:2.0:status:Success"
And the SAML Response should contain element "NameID" with value containing "[email protected]"

Scenario: When a user is registering a new token, authentication at Azure MFA fails
Given I send a registration request request to "https://azure-mfa.stepup.example.com/saml/sso"
Then I should see "Registration"
Expand Down

0 comments on commit 10b1457

Please sign in to comment.