Skip to content

Commit 08d4a7c

Browse files
committed
Add "I submit the SAML Post" step
1 parent 5bea912 commit 08d4a7c

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,25 @@ public function __construct($spTestUrl)
5757
$this->spTestUrl = $spTestUrl;
5858
}
5959

60+
/**
61+
* @Then I Submit the SAML Post
62+
* Because the emulator does not run javascript, forms with a SAML POST must be submitted manually.
63+
* @throws Exception
64+
*/
65+
public function pressSubmit()
66+
{
67+
// Check that there is a HTML form on the page with a submit button and an input field "SAMLResponse"
68+
$page = $this->minkContext->getSession()->getPage();
69+
$form = $page->find('css', 'form');
70+
$samlResponse = $page->find('css', 'input[name="SAMLResponse"]');
71+
72+
if (!$form || !$samlResponse) {
73+
throw new Exception('Expected SAML form post elements not found on page');
74+
}
75+
76+
$this->minkContext->pressButton('Submit');
77+
}
78+
6079
/**
6180
* @BeforeScenario
6281
*/

0 commit comments

Comments
 (0)