From 9f59f9110aa6abc0554732d8e29f493e4ff89916 Mon Sep 17 00:00:00 2001 From: Fairuz Date: Mon, 25 Apr 2022 05:12:16 +0800 Subject: [PATCH] Create booking test --- tests/Browser/DryRun/CreateBookingTest.php | 68 ++++++++++++++++++++++ tests/Browser/DryRun/LoginTe.php | 26 +++++++++ 2 files changed, 94 insertions(+) create mode 100644 tests/Browser/DryRun/CreateBookingTest.php create mode 100644 tests/Browser/DryRun/LoginTe.php diff --git a/tests/Browser/DryRun/CreateBookingTest.php b/tests/Browser/DryRun/CreateBookingTest.php new file mode 100644 index 00000000..98a47da7 --- /dev/null +++ b/tests/Browser/DryRun/CreateBookingTest.php @@ -0,0 +1,68 @@ +browse(function (Browser $browser) { + $browser->visit('http://localhost:86') + ->pause(500) + ->typeSlowly('email', 'junkit.mah@bioloop.com.my') + ->typeSlowly('password', '123456abcabc') + ->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') + ->pause(10000); + //Assert if booking created successfully + + }); + } +} diff --git a/tests/Browser/DryRun/LoginTe.php b/tests/Browser/DryRun/LoginTe.php new file mode 100644 index 00000000..13ebc523 --- /dev/null +++ b/tests/Browser/DryRun/LoginTe.php @@ -0,0 +1,26 @@ +browse(function (Browser $browser) { + $browser->visit('http://localhost:86') + ->pause(500) + ->type('email', 'junkit.mah@bioloop.com.my') + ->type('password', '123456abcabc') + ->click('#sign-in') + ->pause(5000) + ->assertPathIs('/dashboard'); + }); + } +}