Skip to content
This repository has been archived by the owner on Feb 4, 2019. It is now read-only.

Commit

Permalink
core-1652 fixed project tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stereomon committed Aug 3, 2017
1 parent 1c6372a commit 8e38eb8
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 67 deletions.
30 changes: 14 additions & 16 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
namespace: PyzTest

include:
# - tests/PyzTest/Yves/Application
# - tests/PyzTest/Yves/Assets
# - tests/PyzTest/Yves/Availability
#
# - tests/PyzTest/Yves/Cart
- tests/PyzTest/Yves/Application
- tests/PyzTest/Yves/Assets
- tests/PyzTest/Yves/Availability
- tests/PyzTest/Yves/Checkout
# - tests/PyzTest/Yves/Customer
# - tests/PyzTest/Yves/Newsletter
# - tests/PyzTest/Zed/Calculation
# - tests/PyzTest/Zed/CmsGui
# - tests/PyzTest/Zed/Console
# - tests/PyzTest/Zed/NavigationGui
# - tests/PyzTest/Zed/Product
# - tests/PyzTest/Zed/ProductOption
# - tests/PyzTest/Zed/ProductRelation
# - tests/PyzTest/Zed/Tax
# - tests/PyzTest/Zed/Touch
- tests/PyzTest/Yves/Customer
- tests/PyzTest/Yves/Newsletter
- tests/PyzTest/Zed/Calculation
- tests/PyzTest/Zed/CmsGui
- tests/PyzTest/Zed/Console
- tests/PyzTest/Zed/NavigationGui
- tests/PyzTest/Zed/Product
- tests/PyzTest/Zed/ProductOption
- tests/PyzTest/Zed/ProductRelation
- tests/PyzTest/Zed/Tax
- tests/PyzTest/Zed/Touch
# - vendor/spryker/spryker/Bundles/*/*

paths:
Expand Down
15 changes: 3 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,9 @@
"psr-0": {
"PyzTest": "tests"
},
"psr-4": {
"PyzTest\\Shared\\Testify\\Helper\\": "tests/PyzTest/Shared/Testify/_support/Helper",
"PyzTest\\Yves\\Application\\PageObject\\": "tests/PyzTest/Yves/Application/_support/PageObject",
"PyzTest\\Yves\\Cart\\PageObject\\": "tests/PyzTest/Yves/Cart/_support/PageObject",
"PyzTest\\Yves\\Checkout\\Helper\\": "tests/PyzTest/Yves/Checkout/_support/Helper",
"PyzTest\\Yves\\Customer\\PageObject\\": "tests/PyzTest/Yves/Customer/_support/PageObject",
"PyzTest\\Yves\\Customer\\Helper\\": "tests/PyzTest/Yves/Customer/_support/Helper",
"PyzTest\\Yves\\Product\\PageObject\\": "tests/PyzTest/Yves/Product/_support/PageObject",
"PyzTest\\Zed\\Availability\\PageObject\\": "tests/PyzTest/Zed/Availability/_support/PageObject",
"PyzTest\\Zed\\CmsGui\\PageObject\\": "tests/PyzTest/Zed/CmsGui/_support/PageObject",
"PyzTest\\Zed\\Console\\Helper\\": "tests/PyzTest/Zed/Console/_support/Helper"
}
"files": [
"test-autoload.php"
]
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
36 changes: 36 additions & 0 deletions test-autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

$autoloader = function ($className) {

$className = ltrim($className, '\\');
$classNameParts = explode('\\', $className);

if ($classNameParts[0] === 'PyzTest') {
array_shift($classNameParts);
$application = array_shift($classNameParts);
$bundle = array_shift($classNameParts);
$className = implode(DIRECTORY_SEPARATOR, $classNameParts);
$filePathPartsSupport = [
__DIR__,
'tests',
'PyzTest',
$application,
$bundle,
'_support',
$className . '.php',
];
}

if (isset($filePathPartsSupport)) {
$filePath = implode(DIRECTORY_SEPARATOR, $filePathPartsSupport);
if (file_exists($filePath)) {
require $filePath;

return true;
}
}

return false;
};

spl_autoload_register($autoloader);
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use PyzTest\Yves\Availability\AvailabilityPresentationTester;
use PyzTest\Yves\Cart\PageObject\CartListPage;
use PyzTest\Yves\Product\PageObject\ProductDetailPage;
use PyzTest\Zed\Availability\AvailabilityPresentationTester as ZedAvailabilityPresentationTester;
use PyzTest\Zed\Availability\PageObject\AvailabilityViewPage;
use PyzTest\Zed\Sales\PageObject\OrderDetailPage;
use PyzTest\Zed\Sales\PageObject\OrderListPage;
Expand Down Expand Up @@ -45,45 +44,39 @@ public function testCheckoutItemWithAvailability(AvailabilityPresentationTester

$i->processCheckout();

$zedTester = $i->haveFriend('zedTester', ZedAvailabilityPresentationTester::class);
$i->amZed();
$i->amLoggedInUser();

$zedTester->does(function (ZedAvailabilityPresentationTester $i) {
$i->amZed();
$i->amLoggedInUser();
$idProductFujitsu = 118;

$idProductFujitsu = 118;
$i->amOnPage(sprintf(AvailabilityViewPage::VIEW_PRODUCT_AVAILABILITY_URL, $idProductFujitsu));

$i->amOnPage(sprintf(AvailabilityViewPage::VIEW_PRODUCT_AVAILABILITY_URL, $idProductFujitsu));
$i->waitForElementVisible('//*[@id="page-wrapper"]/div[3]/div[2]/div/div/div[2]/div/div[5]/p[2]');

$i->waitForElementVisible('//*[@id="page-wrapper"]/div[3]/div[2]/div/div/div[2]/div/div[5]/p[2]');
$reservedProductsBefore = $i->grabTextFrom('//*[@id="page-wrapper"]/div[3]/div[2]/div/div/div[2]/div/div[5]/p[2]');

$reservedProductsBefore = $i->grabTextFrom('//*[@id="page-wrapper"]/div[3]/div[2]/div/div/div[2]/div/div[5]/p[2]');
codecept_debug('Reserved Products before: ' . $reservedProductsBefore);

codecept_debug('Reserved Products before: ' . $reservedProductsBefore);
$i->amOnPage(OrderListPage::ORDER_LIST_URL);
$i->wait(2);

$i->amOnPage(OrderListPage::ORDER_LIST_URL);
$i->wait(2);
$idSalesOrder = $i->grabTextFrom('//*[@class="dataTables_scrollBody"]/table/tbody/tr[1]/td[1]');

$idSalesOrder = $i->grabTextFrom('//*[@class="dataTables_scrollBody"]/table/tbody/tr[1]/td[1]');
codecept_debug('ID Sales order: ' . $idSalesOrder);

codecept_debug('ID Sales order: ' . $idSalesOrder);
$i->amOnPage(sprintf(OrderDetailPage::ORDER_DETAIL_PAGE_URL, $idSalesOrder));

$i->amOnPage(sprintf(OrderDetailPage::ORDER_DETAIL_PAGE_URL, $idSalesOrder));
$i->click(sprintf(OrderDetailPage::OMS_EVENT_TRIGGER_XPATH, 'pay'));
$i->click(sprintf(OrderDetailPage::OMS_EVENT_TRIGGER_XPATH, 'ship'));
$i->click(sprintf(OrderDetailPage::OMS_EVENT_TRIGGER_XPATH, 'stock-update'));
$i->click(sprintf(OrderDetailPage::OMS_EVENT_TRIGGER_XPATH, 'return'));
$i->click(sprintf(OrderDetailPage::OMS_EVENT_TRIGGER_XPATH, 'refund'));

$i->click(sprintf(OrderDetailPage::OMS_EVENT_TRIGGER_XPATH, 'pay'));
$i->click(sprintf(OrderDetailPage::OMS_EVENT_TRIGGER_XPATH, 'ship'));
$i->click(sprintf(OrderDetailPage::OMS_EVENT_TRIGGER_XPATH, 'stock-update'));
$i->click(sprintf(OrderDetailPage::OMS_EVENT_TRIGGER_XPATH, 'return'));
$i->click(sprintf(OrderDetailPage::OMS_EVENT_TRIGGER_XPATH, 'refund'));
$i->amOnPage(sprintf(AvailabilityViewPage::VIEW_PRODUCT_AVAILABILITY_URL, $idProductFujitsu));

$i->amOnPage(sprintf(AvailabilityViewPage::VIEW_PRODUCT_AVAILABILITY_URL, $idProductFujitsu));
$reservedProductsAfter = $i->grabTextFrom('//*[@id="page-wrapper"]/div[3]/div[2]/div/div/div[2]/div/div[5]/p[2]');

$reservedProductsAfter = $i->grabTextFrom('//*[@id="page-wrapper"]/div[3]/div[2]/div/div/div[2]/div/div[5]/p[2]');

$i->assertEquals($reservedProductsAfter, $reservedProductsBefore - 1); //Reserved item returned back
});

$zedTester->leave();
$i->assertEquals($reservedProductsAfter, $reservedProductsBefore - 1); //Reserved item returned back
}

}
1 change: 1 addition & 0 deletions tests/PyzTest/Yves/Availability/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ suites:
class_name: AvailabilityPresentationTester
modules:
enabled:
- Asserts
- \PyzTest\Shared\Testify\Helper\Environment
- \SprykerTest\Shared\Config\Helper\ConfigInit
- \PyzTest\Yves\Checkout\Helper\CheckoutHelper
Expand Down
12 changes: 0 additions & 12 deletions tests/PyzTest/Yves/Cart/codeception.yml

This file was deleted.

0 comments on commit 8e38eb8

Please sign in to comment.