Skip to content

Commit af5a4cd

Browse files
committed
Add activation flow preference test
Add a test tom for the preferred activation flow query params
1 parent 3dc9620 commit af5a4cd

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

stepup/tests/behat/features/bootstrap/SelfServiceContext.php

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ public function iAmLoggedInIntoTheSelfServicePortalAs($userName)
8282
$this->minkContext->assertPageContainsText('Registration Portal');
8383
}
8484

85+
86+
/**
87+
* @Given /^I log into the selfservice portal as "([^"]*)" with activation preference "([^"]*)"$/
88+
*/
89+
public function ilogIntoTheSelfServicePortalAsWithPreference($userName, $preference)
90+
{
91+
// We visit the Self Service location url
92+
$this->minkContext->visit($this->selfServiceUrl.'?activate='.$preference);
93+
$this->authContext->authenticateWithIdentityProviderFor($userName);
94+
$this->authContext->passTroughGatewaySsoAssertionConsumerService();
95+
$this->iSwitchLocaleTo('English');
96+
$this->minkContext->assertPageContainsText('Registration Portal');
97+
}
98+
8599
/**
86100
* @When I register a new :tokenType token
87101
*/
@@ -214,10 +228,41 @@ public function iTryToSelfVetANewYubikeyTokenWithMySMSToken()
214228

215229
}
216230

231+
/**
232+
* @When I verify my e-mail address
233+
*/
234+
public function verifyEmailAddress()
235+
{
236+
## And we should now be on the mail verification page
237+
$this->minkContext->assertPageContainsText('Verify your e-mail');
238+
$this->minkContext->assertPageContainsText('Check your inbox');
239+
240+
$this->minkContext->visit(
241+
$this->getEmailVerificationUrl()
242+
);
243+
}
244+
245+
/**
246+
* @When I activate my token
247+
*/
248+
public function activateToken()
249+
{
250+
$matches = [];
251+
preg_match('#/second-factor/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/vetting-types#', $this->minkContext->getSession()->getPage()->getContent(), $matches);
252+
if (empty($matches)) {
253+
throw new Exception('Could not find a valid second factor verification id in the url');
254+
}
255+
$href = reset($matches);
256+
257+
$this->minkContext->getSession()
258+
->getPage()
259+
->find('css', '[href="'.$href.'"]')->click();
260+
}
261+
217262
/**
218263
* @When I verify my e-mail address and choose the :vettingType vetting type
219264
*/
220-
public function verifyEmailAddress(string $vettingType)
265+
public function verifyEmailAddressAndChooseVettingType(string $vettingType)
221266
{
222267
## And we should now be on the mail verification page
223268
$this->minkContext->assertPageContainsText('Verify your e-mail');
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Feature: A user manages his tokens in the SelfService portal
2+
In order to use a second factor token
3+
As a user
4+
I must be able to manage my second factor tokens
5+
6+
Scenario: A user registers a Yubikey token in selfservice using RA vetting preference
7+
Given I log into the selfservice portal as "joe-a4" with activation preference "ra"
8+
When I register a new "Yubikey" token
9+
And I verify my e-mail address
10+
And I visit the "overview" page in the selfservice portal
11+
And I activate my token
12+
Then I should see "Activation code"
13+
14+
Scenario: A user registers a Yubikey token in selfservice using self vetting preference
15+
Given I log into the selfservice portal as "joe-a5" with activation preference "self"
16+
When I register a new "Yubikey" token
17+
And I verify my e-mail address
18+
And I visit the "overview" page in the selfservice portal
19+
And I activate my token
20+
Then I should see "Add recovery method"

0 commit comments

Comments
 (0)