Skip to content

Commit e9e9eee

Browse files
committed
MAGETWO-99867: Braintree - 3D Secure 2.0 Support for 2.3
1 parent faf6d59 commit e9e9eee

File tree

1 file changed

+26
-5
lines changed
  • dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form

1 file changed

+26
-5
lines changed

dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Secure3d.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,23 @@ class Secure3d extends Form
1919
/**
2020
* 3D Secure iFrame locator.
2121
*
22-
* @var array
22+
* @var string
23+
*/
24+
protected $braintree3dSecure = "//iframe[contains(@id, 'braintreethreedsecurelanding')]";
25+
26+
/**
27+
* AuthWindow locator.
28+
*
29+
* @var string
2330
*/
24-
protected $braintree3dSecure = "//iframe[contains(@src, 'braintreegateway.com/3ds')]";
31+
private $authWindow3dSecure = "//iframe[contains(@id, 'authWindow')]";
32+
33+
/**
34+
* Password field locator.
35+
*
36+
* @var string
37+
*/
38+
private $passwordField = "//*[@name='external.field.password']";
2539

2640
/**
2741
* Submit button button css selector.
@@ -33,12 +47,12 @@ class Secure3d extends Form
3347
/**
3448
* Switch to 3D Secure iFrame.
3549
*
36-
* @param array $locator
50+
* @param string $locator
3751
*/
3852
public function switchToFrame($locator)
3953
{
40-
$this->browser->switchToFrame(new Locator($locator, Locator::SELECTOR_XPATH));
41-
$this->browser->switchToFrame(new Locator($locator, Locator::SELECTOR_XPATH));
54+
$this->browser->switchToFrame(new Locator($locator, Locator::SELECTOR_XPATH));
55+
$this->browser->switchToFrame(new Locator($this->authWindow3dSecure, Locator::SELECTOR_XPATH));
4256
}
4357

4458
/**
@@ -56,13 +70,20 @@ public function submit()
5670
*
5771
* @param FixtureInterface $fixture
5872
* @param SimpleElement|null $element
73+
*
5974
* @return $this|void
6075
*/
6176
public function fill(FixtureInterface $fixture, SimpleElement $element = null)
6277
{
6378
$mapping = $this->dataMapping($fixture->getData());
6479
$this->switchToFrame($this->braintree3dSecure);
6580
$element = $this->browser->find('body');
81+
$this->browser->waitUntil(
82+
function () use ($element) {
83+
$fieldElement = $element->find($this->passwordField, Locator::SELECTOR_XPATH);
84+
return $fieldElement->isVisible() ? true : null;
85+
}
86+
);
6687
$this->_fill([$mapping['secure3d_password']], $element);
6788
$this->submit();
6889
$this->browser->switchToFrame();

0 commit comments

Comments
 (0)