@@ -185,4 +185,4 @@
},
mixins: [formHandler]
}
-
\ No newline at end of file
+
diff --git a/resources/assets/vue/components/bookings/forms/confirmBookingComponent.vue b/resources/assets/vue/components/bookings/forms/confirmBookingComponent.vue
index 5897646c..2cb67ca0 100644
--- a/resources/assets/vue/components/bookings/forms/confirmBookingComponent.vue
+++ b/resources/assets/vue/components/bookings/forms/confirmBookingComponent.vue
@@ -1,10 +1,10 @@
-
+
-
+
@@ -37,4 +37,4 @@
},
mixins: [ModalFormHandler]
}
-
\ No newline at end of file
+
diff --git a/tests/Browser/DryRun/CreateBookingTest.php b/tests/Browser/DryRun/CreateBookingTest.php
new file mode 100644
index 00000000..989dd565
--- /dev/null
+++ b/tests/Browser/DryRun/CreateBookingTest.php
@@ -0,0 +1,76 @@
+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
+
+ });
+ }
+}
diff --git a/tests/Browser/DryRun/LoginTe.php b/tests/Browser/DryRun/LoginTe.php
new file mode 100644
index 00000000..3694dfde
--- /dev/null
+++ b/tests/Browser/DryRun/LoginTe.php
@@ -0,0 +1,26 @@
+browse(function (Browser $browser) {
+ $browser->visit('http://exchange-2.0.test')
+ ->pause(500)
+ ->type('email', 'junkit.mah@bioloop.com.my')
+ ->type('password', '123456abcabc')
+ ->click('#sign-in')
+ ->pause(5000)
+ ->assertPathIs('/dashboard');
+ });
+ }
+}
diff --git a/tests/Browser/DryRun/UserRegisterLoginTest.php b/tests/Browser/DryRun/UserRegisterLoginTest.php
new file mode 100644
index 00000000..d288fddd
--- /dev/null
+++ b/tests/Browser/DryRun/UserRegisterLoginTest.php
@@ -0,0 +1,28 @@
+browse(function (Browser $browser) {
+ $browser->visit('http://exchange-2.0.test/signup')
+ ->pause(5000)
+ ->click('#company-select')
+ ->type('company_name', 'lazada')
+ ->type('name', 'Someone')
+ ->type('phone', '0128888888')
+ ->click('#next')
+ ->type('email', 'someone@gmail.com')
+ ->type('password', 'pass123')
+ ->type('password_confirmation', 'pass123')
+ ->click('#complete')
+ ->pause(5000)
+ ->assertPathIs('/dashboard');
+ });
+ }
+}
diff --git a/tests/Browser/Pages/HomePage.php b/tests/Browser/Pages/HomePage.php
new file mode 100644
index 00000000..26bf174f
--- /dev/null
+++ b/tests/Browser/Pages/HomePage.php
@@ -0,0 +1,41 @@
+ '#selector',
+ ];
+ }
+}
diff --git a/tests/Browser/Pages/Page.php b/tests/Browser/Pages/Page.php
new file mode 100644
index 00000000..f8d76222
--- /dev/null
+++ b/tests/Browser/Pages/Page.php
@@ -0,0 +1,20 @@
+ '#selector',
+ ];
+ }
+}
diff --git a/tests/Browser/console/.gitignore b/tests/Browser/console/.gitignore
new file mode 100644
index 00000000..d6b7ef32
--- /dev/null
+++ b/tests/Browser/console/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/tests/Browser/screenshots/.gitignore b/tests/Browser/screenshots/.gitignore
new file mode 100644
index 00000000..d6b7ef32
--- /dev/null
+++ b/tests/Browser/screenshots/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/tests/Browser/source/.gitignore b/tests/Browser/source/.gitignore
new file mode 100644
index 00000000..d6b7ef32
--- /dev/null
+++ b/tests/Browser/source/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php
new file mode 100644
index 00000000..2aabaad9
--- /dev/null
+++ b/tests/DuskTestCase.php
@@ -0,0 +1,59 @@
+addArguments([
+ '--no-sandbox'
+ ]);
+
+
+ return RemoteWebDriver::create(
+ //'http://localhost:86',
+ 'http://localhost:9515',
+ DesiredCapabilities::chrome()->setCapability(
+ ChromeOptions::CAPABILITY, $options
+ )
+ );
+ }
+
+ /**
+ * Determine whether the Dusk command has disabled headless mode.
+ *
+ * @return bool
+ */
+ protected function hasHeadlessDisabled()
+ {
+ return true;
+ //isset($_SERVER['DUSK_HEADLESS_DISABLED']) ||
+ //isset($_ENV['DUSK_HEADLESS_DISABLED']);
+ }
+}
diff --git a/tests/Unit/QualityControlTest.php b/tests/Unit/QualityControlTest.php
deleted file mode 100644
index 3ed9d19a..00000000
--- a/tests/Unit/QualityControlTest.php
+++ /dev/null
@@ -1,119 +0,0 @@
-isDir()){
- //Check Modules directory for allowed folders
- //TODO: Check folder in correct orders, e.g. if Validators inside Standards folder
-
- $dirs[] = $path->__toString();
-
- if(in_array($path->getFileName(),$modules)){
- $current_directory = $path->getFileName();
- $modules_dir_count[$path->getFileName()]=['count'=>0,'standards_count'=>0];
- }else if(in_array($path->getFileName(),$allowed_folders)){
- $modules_dir_count[$current_directory]['count'] += 1;
- }else if(in_array($path->getFileName(),$allowed_standards_folders)){
- $modules_dir_count[$current_directory]['standards_count'] += 1;
- } else if(!in_array($path->getFileName(),$ignore_folders)){
- $this->non_standard_folders[]= $path->__toString();
- }
- }else{
- $files[] = realpath($path->__toString());
-
- //TODO: Read files (.php) & check for class name format & if possible variable name format
-
- $file = $path->openFile('r');
- if(!isset($this->file_check[$path->getFileName()]['files'])){
- $this->file_check[$path->getFileName()]=['lines'=>0,'methods_count'=>0];
- }
- $file->seek(PHP_INT_MAX);
- $linesTotal = $file->key();
- $this->file_check[$path->getFileName()]['lines'] = $linesTotal;
-
-
- //Note: Use reflection to get class info : https://www.php.net/manual/en/class.reflectionclass.php
- $namespace = str_replace($fullPath."/","",$file->getPath());
- $namespace = str_replace("/","\\",$namespace);
- $class_name = "App\Classes\Modules\\".$namespace."\\".$file->getBasename('.php');
-
- $class = new \ReflectionClass($class_name);
- $class_methods = $class->getMethods();
-
- $this->file_check[$path->getFileName()]['methods_count'] = count($class_methods);
-
- }
-
- }
-
- //var_dump($files, $dirs);
- //var_dump($this->file_check);
- //var_dump($modules_dir_count,$non_standard_folders);
- //die('debug');
- }
-
- public function checkCodeStandards()
- {
- foreach ($this->file_check as $filename => $file) {
- $this->results['code line'] = $this->assertLessThanOrEqual($this::CODE_LINE_COUNT, $file['lines'],'Please check '.$filename.', the code line is '.$file['lines']);
- $this->results['code method'] = $this->assertLessThanOrEqual($this::METHOD_COUNT,$file['methods_count']);
- }
- }
-
- public function checkFolderStandards()
- {
- $this->results['folder check'] = $this->assertCount(0,$this->non_standard_folders ,"Found non standard folders");
- }
-
- public function testQualityCheck(){
- $this->checkCodeStandards();
- $this->checkFolderStandards();
-
- print_r($this->results);
- }
-
-}