prevent flickering, use blisss theme

This commit is contained in:
Annika Wolff 2020-06-11 14:23:34 +02:00
parent af15da5433
commit 3ba83ace26
5 changed files with 33 additions and 19 deletions

View File

@ -2,16 +2,14 @@
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use Carbon\Carbon;
use Faker\Generator as Faker;
use Webkul\BookingProduct\Models\BookingProduct;
use Webkul\BookingProduct\Models\BookingProductEventTicket;
use Webkul\Product\Models\Product;
$factory->define(BookingProductEventTicket::class, function (Faker $faker, array $attributes) {
$factory->define(BookingProductEventTicket::class, static function (Faker $faker, array $attributes) {
return [
'price' => $faker->randomFloat(4, 3, 900),
'qty' => $faker->randomNumber(2),
'qty' => $faker->numberBetween(100, 1000),
'booking_product_id' => static function () {
return factory(BookingProduct::class)->create(['type' => 'event'])->id;
}

View File

@ -126,4 +126,13 @@ class FunctionalTester extends \Codeception\Actor
}
}
}
public function useDefaultTheme(): void
{
$channel = core()->getCurrentChannel();
if ($channel->theme !== 'default') {
$channel->update(['theme' => 'default']);
}
}
}

View File

@ -4,7 +4,6 @@ namespace Tests\Functional\Checkout\Cart;
use FunctionalTester;
use Webkul\Core\Helpers\Laravel5Helper;
use Cart;
class CartCest
{
@ -12,7 +11,7 @@ class CartCest
public $productWithQuantityBox;
public $productWithoutQuantityBox;
public function _before(FunctionalTester $I)
public function _before(FunctionalTester $I): void
{
$productConfig = [
'productAttributes' => [],
@ -27,9 +26,11 @@ class CartCest
$this->productWithoutQuantityBox = $I->haveProduct(Laravel5Helper::DOWNLOADABLE_PRODUCT, $productConfig);
}
public function checkCartWithQuantityBox(FunctionalTester $I)
public function checkCartWithQuantityBox(FunctionalTester $I): void
{
Cart::addProduct($this->productWithQuantityBox->id, [
$I->useDefaultTheme();
cart()->addProduct($this->productWithQuantityBox->id, [
'_token' => session('_token'),
'product_id' => $this->productWithQuantityBox->id,
'quantity' => 1,
@ -39,9 +40,9 @@ class CartCest
$I->seeElement('#update_cart_button');
}
public function checkCartWithoutQuantityBox(FunctionalTester $I)
public function checkCartWithoutQuantityBox(FunctionalTester $I): void
{
Cart::addProduct($this->productWithoutQuantityBox->id, [
cart()->addProduct($this->productWithoutQuantityBox->id, [
'_token' => session('_token'),
'product_id' => $this->productWithoutQuantityBox->id,
'links' => $this->productWithoutQuantityBox->downloadable_links->pluck('id')->all(),

View File

@ -2,6 +2,7 @@
namespace Tests\Functional\Customer;
use Faker\Factory;
use Webkul\Customer\Models\Customer;
use Webkul\Customer\Models\CustomerAddress;
use FunctionalTester;
@ -10,6 +11,11 @@ class CustomerCest
{
public $fields = [];
public function _before(FunctionalTester $I): void
{
$I->useDefaultTheme();
}
public function updateCustomerProfile(FunctionalTester $I): void
{
$customer = $I->loginAsCustomer();
@ -32,8 +38,8 @@ class CustomerCest
public function updateCustomerAddress(FunctionalTester $I): void
{
$I->wantTo('Instantiate a european faker factory to have the vat provider available');
$faker = \Faker\Factory::create('at_AT');
// Instantiate a european faker factory to have the vat provider available
$faker = Factory::create('at_AT');
$formCssSelector = '#customer-address-form';

View File

@ -10,16 +10,16 @@ use Webkul\Core\Helpers\Laravel5Helper;
class GuestCheckoutCest
{
private $faker,
$productNoGuestCheckout, $productGuestCheckout;
private $productNoGuestCheckout, $productGuestCheckout;
function _before(FunctionalTester $I)
{
$I->useDefaultTheme();
$this->faker = Factory::create();
$faker = Factory::create();
$pConfigDefault = [
'productInventory' => ['qty' => $this->faker->numberBetween(1, 1000)],
'productInventory' => ['qty' => $faker->numberBetween(1, 1000)],
'attributeValues' => [
'status' => true,
'new' => 1,
@ -27,7 +27,7 @@ class GuestCheckoutCest
],
];
$pConfigGuestCheckout = [
'productInventory' => ['qty' => $this->faker->numberBetween(1, 1000)],
'productInventory' => ['qty' => $faker->numberBetween(1, 1000)],
'attributeValues' => [
'status' => true,
'new' => 1,
@ -72,8 +72,8 @@ class GuestCheckoutCest
$I->click(__('shop::app.checkout.cart.proceed-to-checkout'),
'//a[@href="' . route('shop.checkout.onepage.index') . '"]');
$I->seeCurrentRouteIs($example['expectedRoute']);
$cart = Cart::getCart();
$I->assertTrue(Cart::removeItem($cart->items[0]->id));
$cart = cart()->getCart();
$I->assertTrue(cart()->removeItem($cart->items[0]->id));
}
protected function guestCheckoutProvider(): array