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 Zed tests + Yves Newsletter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stereomon committed Aug 3, 2017
1 parent 1e6b033 commit b437d1b
Show file tree
Hide file tree
Showing 51 changed files with 1,242 additions and 1,218 deletions.
9 changes: 3 additions & 6 deletions codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,21 @@ include:
# - tests/PyzTest/Yves/Application
# - tests/PyzTest/Yves/Assets
# - tests/PyzTest/Yves/Availability

#
# - tests/PyzTest/Yves/Cart
# - tests/PyzTest/Yves/Checkout
# - tests/PyzTest/Yves/Customer
- tests/PyzTest/Yves/Customer
# - tests/PyzTest/Yves/Newsletter
# - tests/PyzTest/Yves/Product
# - tests/PyzTest/Zed/Availability
# - 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/Sales
# - tests/PyzTest/Zed/Tax
# - tests/PyzTest/Zed/Touch
- vendor/spryker/spryker/Bundles/*/*
# - vendor/spryker/spryker/Bundles/*/*

paths:
log: tests/_output
Expand Down
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,16 @@
},
"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": [
"tests/PyzTest/Zed/Availability/_support/_generated/AvailabilityPresentationTesterActions.php",
"tests/PyzTest/Zed/Availability/_support/AvailabilityPresentationTester.php"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
5 changes: 0 additions & 5 deletions tests/PyzTest/Shared/Testify/_support/Helper/Environment.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace PyzTest\Shared\Testify\Helper;

use Codeception\Module;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* Copyright © 2017-present Spryker Systems GmbH. All rights reserved.
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace PyzTest\Yves\Checkout\Helper;

use Codeception\Module;
Expand Down
39 changes: 21 additions & 18 deletions tests/PyzTest/Yves/Customer/_support/Helper/CustomerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Codeception\Module;
use Codeception\TestInterface;
use Codeception\Util\Stub;
use Generated\Shared\DataBuilder\CustomerBuilder;
use Generated\Shared\Transfer\NewsletterSubscriberTransfer;
use Generated\Shared\Transfer\NewsletterSubscriptionRequestTransfer;
use Generated\Shared\Transfer\NewsletterTypeTransfer;
Expand Down Expand Up @@ -121,24 +122,25 @@ public function loadCustomerByEmail($email)
}

/**
* @param string $email
* @param array $seed
*
* @return void
* @return \Generated\Shared\Transfer\CustomerTransfer
*/
public function haveRegisteredCustomer($email)
public function haveRegisteredCustomer(array $seed)
{
$customerEntity = $this->loadCustomerByEmail($email);
if ($customerEntity) {
return;
}

$this->setupSession();

$customerTransfer = Customer::getCustomerData($email);
$customerBuilder = new CustomerBuilder($seed);
$customerTransfer = $customerBuilder->build();
$password = $customerTransfer->getPassword();

$mailMock = new CustomerToMailBridge($this->getMailMock());
$this->setDependency(CustomerDependencyProvider::FACADE_MAIL, $mailMock);
$this->getFacade()->registerCustomer($customerTransfer);

$customerTransfer->setPassword($password);

return $customerTransfer;
}

/**
Expand Down Expand Up @@ -213,23 +215,24 @@ public function addNewsletterSubscription($email, $type = NewsletterConstants::E
}

/**
* @param string $email
* @param array $seed
*
* @return void
* @return \Generated\Shared\Transfer\CustomerTransfer
*/
public function amLoggedInCustomer($email = Customer::NEW_CUSTOMER_EMAIL)
public function amLoggedInCustomer(array $seed)
{
$this->haveRegisteredCustomer($email);
$customerTransfer = Customer::getCustomerData($email);
$customerTransfer = $this->haveRegisteredCustomer($seed);

$i = $this->getWebDriver();
$i->amOnPage(CustomerLoginPage::URL);
$i->submitForm(['name' => 'loginForm'], [
$tester = $this->getWebDriver();
$tester->amOnPage(CustomerLoginPage::URL);
$tester->submitForm(['name' => 'loginForm'], [
CustomerLoginPage::FORM_FIELD_SELECTOR_EMAIL => $customerTransfer->getEmail(),
CustomerLoginPage::FORM_FIELD_SELECTOR_PASSWORD => $customerTransfer->getPassword(),
]);

$i->wait(2);
$tester->wait(2);

return $customerTransfer;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace PyzTest\Yves\Newsletter\Yves;

use Generated\Shared\DataBuilder\CustomerBuilder;
use PyzTest\Yves\Application\PageObject\Homepage;
use PyzTest\Yves\Customer\PageObject\Customer;
use PyzTest\Yves\Customer\PageObject\CustomerNewsletterPage;
use PyzTest\Yves\Customer\PageObject\CustomerOverviewPage;
use PyzTest\Yves\Newsletter\NewsletterPresentationTester;
Expand Down Expand Up @@ -38,7 +38,9 @@ public function iCanSubscribeWithAnUnsubscribedEmail(NewsletterPresentationTeste

$i->amOnPage(Homepage::URL);

$i->fillField(NewsletterSubscriptionHomePage::FORM_SELECTOR, NewsletterSubscriptionHomePage::NEW_EMAIL);
$customerTransfer = $this->buildCustomerTransfer();

$i->fillField(NewsletterSubscriptionHomePage::FORM_SELECTOR, $customerTransfer->getEmail());
$i->click(NewsletterSubscriptionHomePage::FORM_SUBMIT);

$i->see(NewsletterSubscriptionHomePage::SUCCESS_MESSAGE);
Expand All @@ -56,9 +58,11 @@ public function iCanNotSubscribeWithAnAlreadySubscribedEmail(NewsletterPresentat

$i->amOnPage(Homepage::URL);

$i->haveAnAlreadySubscribedEmail(NewsletterSubscriptionHomePage::EXISTING_EMAIL);
$customerTransfer = $this->buildCustomerTransfer();

$i->haveAnAlreadySubscribedEmail($customerTransfer->getEmail());

$i->fillField(NewsletterSubscriptionHomePage::FORM_SELECTOR, NewsletterSubscriptionHomePage::EXISTING_EMAIL);
$i->fillField(NewsletterSubscriptionHomePage::FORM_SELECTOR, $customerTransfer->getEmail());
$i->click(NewsletterSubscriptionHomePage::FORM_SUBMIT);

$i->see(NewsletterSubscriptionHomePage::ERROR_MESSAGE);
Expand All @@ -76,10 +80,12 @@ public function subscribedEmailIsLinkedWithCustomerAfterRegistration(NewsletterP

$i->amOnPage(Homepage::URL);

$i->fillField(NewsletterSubscriptionHomePage::FORM_SELECTOR, Customer::NEW_CUSTOMER_EMAIL);
$customerTransfer = $this->buildCustomerTransfer();

$i->fillField(NewsletterSubscriptionHomePage::FORM_SELECTOR, $customerTransfer->getEmail());
$i->click(NewsletterSubscriptionHomePage::FORM_SUBMIT);

$i->amLoggedInCustomer(Customer::NEW_CUSTOMER_EMAIL);
$i->amLoggedInCustomer($customerTransfer->toArray());

$i->amOnPage(CustomerOverviewPage::URL);
$i->see(CustomerOverviewPage::NEWSLETTER_SUBSCRIBED);
Expand All @@ -97,10 +103,12 @@ public function subscribedEmailCanBeUnsubscribedByCustomerAfterRegistration(News

$i->amOnPage(Homepage::URL);

$i->fillField(NewsletterSubscriptionHomePage::FORM_SELECTOR, Customer::NEW_CUSTOMER_EMAIL);
$customerTransfer = $this->buildCustomerTransfer();

$i->fillField(NewsletterSubscriptionHomePage::FORM_SELECTOR, $customerTransfer->getEmail());
$i->click(NewsletterSubscriptionHomePage::FORM_SUBMIT);

$i->amLoggedInCustomer(Customer::NEW_CUSTOMER_EMAIL);
$i->amLoggedInCustomer($customerTransfer->toArray());

$i->amOnPage(CustomerOverviewPage::URL);
$i->see(CustomerOverviewPage::NEWSLETTER_SUBSCRIBED);
Expand All @@ -114,4 +122,14 @@ public function subscribedEmailCanBeUnsubscribedByCustomerAfterRegistration(News
$i->dontSeeCheckboxIsChecked(['name' => CustomerNewsletterPage::FORM_FIELD_SELECTOR_NEWSLETTER_SUBSCRIPTION]);
}

/**
* @return \Generated\Shared\Transfer\CustomerTransfer|\Spryker\Shared\Kernel\Transfer\AbstractTransfer
*/
protected function buildCustomerTransfer()
{
$customerTransfer = (new CustomerBuilder())->build();

return $customerTransfer;
}

}
5 changes: 3 additions & 2 deletions tests/PyzTest/Yves/Newsletter/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ suites:
enabled:
- \PyzTest\Shared\Testify\Helper\Environment
- \SprykerTest\Shared\Config\Helper\ConfigInit
- \SprykerTest\Shared\Testify\Helper\LocatorHelper
- \SprykerTest\Shared\Propel\Helper\ConnectionHelper
- \SprykerTest\Shared\Application\Helper\YvesHelper
- \PyzTest\Yves\Customer\Helper\CustomerHelper
- \SprykerTest\Shared\Propel\Helper\PropelInstallHelper
- WebDriver:
url: ''
browser: chrome
window_size: 1920x1080
host: 0.0.0.0
restart: false
- \SprykerTest\Shared\Testify\Helper\DependencyHelper
- \SprykerTest\Shared\Testify\Helper\DataCleanupHelper
- \SprykerTest\Shared\Application\Helper\YvesHelper
12 changes: 0 additions & 12 deletions tests/PyzTest/Yves/Product/codeception.yml

This file was deleted.

Empty file.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
/**
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace PyzTest\Zed\Availability\PageObject;

Expand Down
35 changes: 0 additions & 35 deletions tests/PyzTest/Zed/Availability/codeception.yml

This file was deleted.

Loading

0 comments on commit b437d1b

Please sign in to comment.