Files
exchange-2.0/tests/Browser/DryRun/CreateBookingTest.php
T
2022-05-10 23:27:41 +08:00

77 lines
2.7 KiB
PHP

<?php
namespace Tests\Browser\DryRun;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
class CreateBookingTest extends DuskTestCase
{
public function testLogin()
{
$this->browse(function (Browser $browser) {
$browser->visit('http://exchange-2.0.test')
->pause(5000)
->type('email', 'giftolavie@hotmail.com')
->type('password', 'pass123')
->click('#sign-in')
->pause(5000)
->assertPathIs('/dashboard');
});
}
/**
* @test
* @depends testLogin
*/
public function testCreateBooking()
{
$this->browse(function (Browser $browser) {
$browser->waitForLocation('/dashboard')
->waitForText('X1 Service')
->typeSlowly('cc_sending', '10000')
->pause(5000)
->waitForText('Transfer Now',5000)
->click('#transfer-now')
->whenAvailable('#select-account-modal', function ($modal) {
$modal->pause(1000)
->press('#select-list')
->press('#select-option')
->pause(5000)
->click('#confirm-new-booking');
#->click('#cancel-new-booking');
})
->pause(7000)
->typeSlowly('stock_code', '123')
->typeSlowly('desc', 'Product A')
->typeSlowly('unit_price', '100')
->pause(7000)
->click('#add-quantity')
->click('#add-quantity')
->pause(7000)
->click('#minus-quantity')
->click('#minus-quantity')
->pause(7000)
->typeSlowly('quantity', '5')
->pause(7000)
->click('#add-product')
->pause(7000)
->click('#save-purchase-order')
->click('#payment-btn')
->click('#online-banking')
->click('#create-booking')
->pause(3000)
->click('#lock-booking')
->whenAvailable('#confirm-booking-modal', function ($modal) {
$modal->click('#confirm-booking');
})
->pause(10000);
//Assert if booking created successfully
});
}
}