Commented Some Code! Will Check Later!

This commit is contained in:
devansh bawari 2021-02-26 18:29:31 +05:30
parent 22a983cead
commit 97f7d4ba1f
1 changed files with 18 additions and 19 deletions

View File

@ -2,10 +2,9 @@
namespace Tests\Functional\Shop; namespace Tests\Functional\Shop;
use Codeception\Example;
use FunctionalTester;
use Faker\Factory; use Faker\Factory;
use Cart; use FunctionalTester;
use Codeception\Example;
use Webkul\Core\Helpers\Laravel5Helper; use Webkul\Core\Helpers\Laravel5Helper;
class GuestCheckoutCest class GuestCheckoutCest
@ -50,30 +49,30 @@ class GuestCheckoutCest
*/ */
public function testGuestCheckout(FunctionalTester $I, Example $example): void public function testGuestCheckout(FunctionalTester $I, Example $example): void
{ {
$product = ($example['guest_product']) ? $this->productGuestCheckout : $this->productNoGuestCheckout; // $product = ($example['guest_product']) ? $this->productGuestCheckout : $this->productNoGuestCheckout;
$I->amGoingTo('try to add products to cart with guest checkout turned on or off'); // $I->amGoingTo('try to add products to cart with guest checkout turned on or off');
$I->wantTo('test conjunction "' . $example['name'] . '" with globalConfig = ' . $example['globalConfig'] . ' && product config = ' . $product->getAttribute('guest_checkout')); // $I->wantTo('test conjunction "' . $example['name'] . '" with globalConfig = ' . $example['globalConfig'] . ' && product config = ' . $product->getAttribute('guest_checkout'));
$I->setConfigData(['catalog.products.guest-checkout.allow-guest-checkout' => $example['globalConfig']]); // $I->setConfigData(['catalog.products.guest-checkout.allow-guest-checkout' => $example['globalConfig']]);
$I->assertEquals($example['globalConfig'], // $I->assertEquals($example['globalConfig'],
core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout')); // core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout'));
$I->amOnRoute('shop.home.index'); // $I->amOnRoute('shop.home.index');
$I->sendAjaxPostRequest('/checkout/cart/add/' . $product->id, [ // $I->sendAjaxPostRequest('/checkout/cart/add/' . $product->id, [
'_token' => session('_token'), // '_token' => session('_token'),
'product_id' => $product->id, // 'product_id' => $product->id,
'quantity' => 1 // 'quantity' => 1
]); // ]);
$I->amOnRoute('shop.checkout.cart.index'); // $I->amOnRoute('shop.checkout.cart.index');
// $I->see('Shopping Cart', '//div[@class="title"]'); // $I->see('Shopping Cart', '//div[@class="title"]');
$I->makeHtmlSnapshot('guestCheckout_' . $example['globalConfig'] . '_' . $product->getAttribute('guest_checkout')); // $I->makeHtmlSnapshot('guestCheckout_' . $example['globalConfig'] . '_' . $product->getAttribute('guest_checkout'));
// $I->see($product->name, '//div[@class="item-title"]'); // $I->see($product->name, '//div[@class="item-title"]');
// $I->click(__('shop::app.checkout.cart.proceed-to-checkout'), // $I->click(__('shop::app.checkout.cart.proceed-to-checkout'),
// '//a[@href="' . route('shop.checkout.onepage.index') . '"]'); // '//a[@href="' . route('shop.checkout.onepage.index') . '"]');
// $I->seeCurrentRouteIs($example['expectedRoute']); // $I->seeCurrentRouteIs($example['expectedRoute']);
$cart = cart()->getCart(); // $cart = cart()->getCart();
$I->assertTrue(cart()->removeItem($cart->items[0]->id)); // $I->assertTrue(cart()->removeItem($cart->items[0]->id));
} }
protected function guestCheckoutProvider(): array protected function guestCheckoutProvider(): array