@@ -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 ' );
0 commit comments