Skip to content

Commit cec600d

Browse files
committed
DEVOPS-2632: Sample Data Builds Migrated from Bamboo
1 parent c0e8b1a commit cec600d

File tree

3 files changed

+77
-8
lines changed

3 files changed

+77
-8
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\CustomerSampleData\Test\Constraint;
8+
9+
use Magento\Customer\Test\Page\CustomerAccountIndex;
10+
use Magento\Mtf\Constraint\AbstractConstraint;
11+
12+
/**
13+
* Assert that customer navigation menu links can be opened.
14+
*/
15+
class AssertCustomerNavigation extends AbstractConstraint
16+
{
17+
/**
18+
* Assert that customer navigation menu links can be opened.
19+
*
20+
* @param CustomerAccountIndex $customerAccountIndex
21+
* @param array $customerNavigationLinks
22+
* @return void
23+
*/
24+
public function processAssert(CustomerAccountIndex $customerAccountIndex, array $customerNavigationLinks)
25+
{
26+
$actualPageTitles = [];
27+
$expectedPageTitles = [];
28+
/** @var \Magento\Customer\Test\Block\Account\Links $accountMenu */
29+
$accountMenu = $customerAccountIndex->getAccountMenuBlock();
30+
/** @var \Magento\Theme\Test\Block\Html\Title $titleBlock */
31+
$titleBlock = $customerAccountIndex->getTitleBlock();
32+
33+
foreach ($customerNavigationLinks as $link) {
34+
$expectedPageTitles[] = $link['pageTitle'];
35+
$accountMenu->openMenuItem($link['navigationName']);
36+
$actualPageTitles[] = $titleBlock->getTitle();
37+
}
38+
39+
\PHPUnit\Framework\Assert::assertEquals(
40+
$expectedPageTitles,
41+
$actualPageTitles,
42+
"Page titles are different."
43+
);
44+
}
45+
46+
/**
47+
* Returns a string representation of the object.
48+
*
49+
* @return string
50+
*/
51+
public function toString()
52+
{
53+
return "Customer is successfully navigating in account menu.";
54+
}
55+
}

dev/tests/functional/tests/app/Magento/CustomerSampleData/Test/TestCase/LoginCustomerTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
use Magento\Customer\Test\Fixture\Customer;
1010
use Magento\Mtf\TestCase\Injectable;
11-
use Magento\Customer\Test\Page\CustomerAccountIndex;
1211

1312
/**
1413
* @group Sample_Data
@@ -22,21 +21,17 @@ class LoginCustomerTest extends Injectable
2221
/* end tags */
2322

2423
/**
25-
* Create Customer account on Storefront.
24+
* Login to customer account on Storefront.
2625
*
2726
* @param Customer $customer
28-
* @param CustomerAccountIndex $customerAccountIndex
27+
* @return void
2928
*/
30-
public function test(Customer $customer, CustomerAccountIndex $customerAccountIndex)
29+
public function test(Customer $customer)
3130
{
3231
// Steps
3332
$this->objectManager->create(
3433
'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep',
3534
['customer' => $customer]
3635
)->run();
37-
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('Account Information');
38-
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('Address Book');
39-
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Orders');
40-
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Wish List');
4136
}
4237
}

dev/tests/functional/tests/app/Magento/CustomerSampleData/Test/TestCase/LoginCustomerTest.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@
1313
<data name="customer/data/lastname" xsi:type="string">Costello</data>
1414
<data name="customer/data/email" xsi:type="string">[email protected]</data>
1515
<data name="customer/data/password" xsi:type="string">[email protected]</data>
16+
<data name="customerNavigationLinks" xsi:type="array">
17+
<item name="0" xsi:type="array">
18+
<item name="navigationName" xsi:type="string">Account Information</item>
19+
<item name="pageTitle" xsi:type="string">Edit Account Information</item>
20+
</item>
21+
<item name="1" xsi:type="array">
22+
<item name="navigationName" xsi:type="string">Address Book</item>
23+
<item name="pageTitle" xsi:type="string">Address Book</item>
24+
</item>
25+
<item name="2" xsi:type="array">
26+
<item name="navigationName" xsi:type="string">My Orders</item>
27+
<item name="pageTitle" xsi:type="string">My Orders</item>
28+
</item>
29+
<item name="3" xsi:type="array">
30+
<item name="navigationName" xsi:type="string">My Wish List</item>
31+
<item name="pageTitle" xsi:type="string">My Wish List</item>
32+
</item>
33+
</data>
34+
<constraint name="Magento\CustomerSampleData\Test\Constraint\AssertCustomerNavigation" />
1635
</variation>
1736
</testCase>
1837
</config>

0 commit comments

Comments
 (0)