HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.shooperm.com/tests/Browser/Modules/Wallet/WalletManageTest.php
<?php

namespace Tests\Browser\Modules\Wallet;

use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\WithFaker;
use Laravel\Dusk\Browser;
use Modules\Wallet\Entities\WalletBalance;
use Tests\DuskTestCase;

class WalletManageTest extends DuskTestCase
{
    use WithFaker;


    public function setUp(): void
    {
        parent::setUp();

    }

    public function tearDown(): void
    {
        $balances = WalletBalance::all();
        foreach($balances as $balance){
            $balance->delete();
        }

        parent::tearDown(); // TODO: Change the autogenerated stub
    }

    /**
     * A Dusk test example.
     *
     * @return void
     */
    public function test_for_visit_wallet_recharge_approval()
    {
        $this->browse(function (Browser $browser) {
            $browser->loginAs(1)
                    ->visit('/wallet/recharge-requests')
                    ->assertSee('Wallet Recharge Transactions');
        });
    }

    public function test_for_offline_recharge(){
        $this->test_for_visit_wallet_recharge_approval();
        $this->browse(function (Browser $browser) {
            $browser->click('#main-content > section > div > div > div > div.box_header.common_table_header > div > ul > li > a')
                ->whenAvailable('#Recharge_Modal_Offline > div > div > div.modal-body > form', function($modal){
                    $modal->click('div > div:nth-child(1) > div > div')
                        ->click('div > div:nth-child(1) > div > div > ul > li:nth-child(2)')
                        ->type('div > div:nth-child(2) > div > input', '200')
                        ->type('div > div:nth-child(3) > div > textarea', $this->faker->paragraph)
                        ->click('div > div.col-lg-12.text-center > div > button')
                        ->assertPathIs('/wallet/recharge-requests');
                })
                ->waitFor('.toast-message',25)
                ->assertSeeIn('.toast-message', 'Recharged Successfully');
        });
    }

    public function test_for_test_for_approve_recharge(){
        WalletBalance::create([
            'user_id' => 5,
            'type' => "Deposite",
            'amount' => 200,
            'payment_method' => 4,
            'txn_id' => 'ch_1J9Pk9GRvmmDdlLV1ogZNRr2',
            'status' => 0
        ]);
        $this->test_for_visit_wallet_recharge_approval();
        $this->browse(function (Browser $browser) {
            $browser->waitFor('#walletTable > tbody > tr.odd > td:nth-child(8) > label > div')
                ->click('#walletTable > tbody > tr.odd > td:nth-child(8) > label > div')
                ->waitFor('.toast-message',25)
                ->assertSeeIn('.toast-message', 'Approved Successfully.');

        });
    }

    public function test_for_withdraw_request_visit(){
        $this->browse(function (Browser $browser) {
            $browser->loginAs(1)
                ->visit('/wallet/withdraw-requests')
                ->assertSee('Withdraw Requests');
        });
    }

    public function test_for_view_withdraw_request(){
        WalletBalance::create([
            'user_id' => 5,
            'type' => 'Withdraw',
            'amount' => 100,
            'payment_method' => 7,
            'txn_id' => "None",
            'status' => 0,
        ]);
        $this->test_for_withdraw_request_visit();
        $this->browse(function (Browser $browser) {
            $browser->waitFor('#withdrawTable > tbody > tr > td:nth-child(9) > a', 25)
                ->click('#withdrawTable > tbody > tr > td:nth-child(9) > a')
                ->pause(10000)
                ->whenAvailable('#Withdraw_Modal > div > div', function($modal){
                    $modal->assertSeeIn('div.modal-header > h4', 'Details Info');
                });

        });
    }

    public function test_for__visit_offline_recharge(){
        $this->browse(function (Browser $browser) {
            $browser->loginAs(1)
                ->visit('wallet/recharge-offline-index')
                ->assertSee('Offline Recharge')
                ->click('#main-content > section > div > div > div > div.box_header.common_table_header > div > ul > li > a')
                ->whenAvailable('#Recharge_Modal_Offline > div > div > div.modal-body > form', function($modal){
                    $modal->click('div > div:nth-child(1) > div > div')
                        ->click('div > div:nth-child(1) > div > div > ul > li:nth-child(1)')
                        ->type('div > div:nth-child(2) > div > input','200')
                        ->type('div > div:nth-child(3) > div > textarea', $this->faker->paragraph)
                        ->click('div > div.col-lg-12.text-center > div > button')
                        ->assertPathIs('/wallet/recharge-offline-index');

                })
                ->waitFor('.toast-message',25)
                ->assertSeeIn('.toast-message', 'Recharged Successfully');
        });
    }

    


}