Skip to content

Commit 159a566

Browse files
committed
MAGETWO-67115: [FT] CustomerWebapisPermissionTest fail on data set #1 on Jenkins for 2.1.7 (CE)
1 parent c5ea1ba commit 159a566

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

dev/tests/functional/tests/app/Magento/Webapi/Test/Constraint/AssertWebapiNoAccessByCookie.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ public function processAssert(
4141
) {
4242
// Create and login a customer on frontend
4343
$customer->persist();
44-
$this->objectManager->create(
45-
'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep',
44+
/** @var \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep $customerLoginStep */
45+
$customerLoginStep = $this->objectManager->create(
46+
\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
4647
['customer' => $customer]
47-
)->run();
48+
);
49+
$customerLoginStep->run();
4850

4951
// Go to cms page with form as logged in customer and submit request
5052
$browser->open($_ENV['app_frontend_url'] . $cms->getIdentifier());
@@ -55,6 +57,8 @@ public function processAssert(
5557
$browser->getHtmlSource(),
5658
'Customer should not have customer webapi access through cookies.'
5759
);
60+
61+
$customerLoginStep->cleanup();
5862
}
5963

6064
/**

dev/tests/functional/tests/app/Magento/Webapi/Test/TestCase/CustomerWebapisPermissionTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,33 @@ public function __inject(
8282
\Magento\Config\Test\TestStep\SetupConfigurationStep::class,
8383
['configData' => 'wysiwyg_disabled']
8484
)->run();
85+
8586
return ['cmsOriginal' => $cmsOriginal];
8687
}
8788

8889
/**
8990
* Construct cms page with a form that contains webapi request and 'Submit Request' button.
9091
*
9192
* @param CmsPage $cmsOriginal
93+
* @param string $url
94+
* @param string $method
9295
* @return array
9396
*/
94-
public function test(CmsPage $cmsOriginal)
97+
public function test(CmsPage $cmsOriginal, $url, $method = 'POST')
9598
{
9699
$this->cmsPageIndex->open();
97100
$this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsOriginal->getTitle()]);
98101
$data = $cmsOriginal->getData();
99-
$content = '<p><form action="'
100-
. $_ENV['app_frontend_url']
101-
. 'rest/V1/carts/mine/balance/apply" method="POST">'
102-
. '<input type="submit" value="Submit Request" /></form></p>';
102+
$content = <<<HTML
103+
<form action="$url" method="$method" >
104+
<input type="submit" value="Submit Request" />
105+
</form>
106+
HTML;
103107
$data['content'] = ['content' => $content];
104108
$cms = $this->factory->createByCode('cmsPage', ['data' => $data]);
105109
$this->cmsPageNew->getPageForm()->fill($cms);
106110
$this->cmsPageNew->getPageMainActions()->save();
111+
107112
return ['cms' => $cms];
108113
}
109114
}

dev/tests/functional/tests/app/Magento/Webapi/Test/TestCase/CustomerWebapisPermissionTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\Webapi\Test\TestCase\CustomerWebapisPermissionTest" summary="Customer Webapi Permission Test" ticketId="MAGETWO-64389">
1010
<variation name="CustomerWebapisPermissionTestVariation1">
11+
<data name="url">rest/V1/carts/mine</data>
12+
<data name="method">POST</data>
1113
<constraint name="Magento\Webapi\Test\Constraint\AssertWebapiNoAccessByCookie" />
1214
</variation>
1315
</testCase>

0 commit comments

Comments
 (0)