|
|
|
@ -68,15 +68,15 @@ class TransactionEntryTest extends BrowserKitTestCase |
|
|
|
$this->see($product->name); |
|
|
|
$this->see($product->credit_price); |
|
|
|
$this->seeElement('form', ['action' => route('cart.add-draft-item', [$draft->draftKey, $product->id])]); |
|
|
|
$this->seeElement('input', ['id' => 'qty-' . $product->id, 'name' => 'qty']); |
|
|
|
$this->seeElement('input', ['id' => 'add-product-' . $product->id]); |
|
|
|
$this->seeElement('input', ['id' => 'qty-'.$product->id, 'name' => 'qty']); |
|
|
|
$this->seeElement('input', ['id' => 'add-product-'.$product->id]); |
|
|
|
$this->dontSee($product->cash_price); |
|
|
|
} |
|
|
|
|
|
|
|
/** @test */ |
|
|
|
public function user_can_add_item_to_draft() |
|
|
|
{ |
|
|
|
$product = factory(Product::class)->create(['name' => 'Testing Produk 1','cash_price' => 400,'credit_price' => 500]); |
|
|
|
$product = factory(Product::class)->create(['name' => 'Testing Produk 1', 'cash_price' => 400, 'credit_price' => 500]); |
|
|
|
$this->loginAsUser(); |
|
|
|
|
|
|
|
$cart = new CartCollection(); |
|
|
|
@ -87,14 +87,14 @@ class TransactionEntryTest extends BrowserKitTestCase |
|
|
|
$this->visit(route('cart.show', [$draft->draftKey, 'query' => 'testing'])); |
|
|
|
|
|
|
|
$this->type(2, 'qty'); |
|
|
|
$this->press('add-product-' . $product->id); |
|
|
|
$this->press('add-product-'.$product->id); |
|
|
|
$this->seePageIs(route('cart.show', [$draft->draftKey, 'query' => 'testing'])); |
|
|
|
$this->assertTrue($cart->draftHasItem($draft, $product)); |
|
|
|
$this->assertEquals(800, $draft->getTotal()); |
|
|
|
|
|
|
|
$this->see(formatRp(800)); |
|
|
|
$this->seeElement('input', ['id' => 'qty-' . 0]); |
|
|
|
$this->seeElement('input', ['id' => 'item_discount-' . 0]); |
|
|
|
$this->seeElement('button', ['id' => 'remove-item-' . 0]); |
|
|
|
$this->seeElement('input', ['id' => 'qty-'. 0]); |
|
|
|
$this->seeElement('input', ['id' => 'item_discount-'. 0]); |
|
|
|
$this->seeElement('button', ['id' => 'remove-item-'. 0]); |
|
|
|
} |
|
|
|
} |