F
Filament3mo ago
Aminne

I can't make a feature test on custom action

I have this custom action with two forms,
<x-filament-panels::page>
<x-filament-panels::form wire:submit="approveTransaction">
<div style="display: flex; gap: 20px; align-items: stretch">
<div class="flex-1">
{{ $this->approveTransactionForm }}
</div>
@if ($media = $this->getTransaction($this->record)->getFirstMedia('images'))
<div class="flex-1">
<img src="{{ $media->getUrl() }}" alt="Avatar" class="h-auto w-full object-cover" />
</div>
@endif
</div>

@if ($this->getTransaction($this->record)->getFirstMedia('images'))
<div class="mt-2">
{{ $this->confirmedTransactionForm }}
</div>
@endif

@if (

$this->transactionData['meta']['status'] === 'pending' &&
isset($this->transactionData['meta']['type']) &&
$this->transactionData['meta']['type'] === 'transaction' )
<x-filament-panels::form.actions :actions="$this->getApproveTransactionFormActions()" />
@endif
</x-filament-panels::form>
</x-filament-panels::page>
<x-filament-panels::page>
<x-filament-panels::form wire:submit="approveTransaction">
<div style="display: flex; gap: 20px; align-items: stretch">
<div class="flex-1">
{{ $this->approveTransactionForm }}
</div>
@if ($media = $this->getTransaction($this->record)->getFirstMedia('images'))
<div class="flex-1">
<img src="{{ $media->getUrl() }}" alt="Avatar" class="h-auto w-full object-cover" />
</div>
@endif
</div>

@if ($this->getTransaction($this->record)->getFirstMedia('images'))
<div class="mt-2">
{{ $this->confirmedTransactionForm }}
</div>
@endif

@if (

$this->transactionData['meta']['status'] === 'pending' &&
isset($this->transactionData['meta']['type']) &&
$this->transactionData['meta']['type'] === 'transaction' )
<x-filament-panels::form.actions :actions="$this->getApproveTransactionFormActions()" />
@endif
</x-filament-panels::form>
</x-filament-panels::page>
and
it('can accepte transaction from client', function () {
actingAs(loginNextJs(), 'api');
$response = postJson('/api/v1/user/deposit-bank-transfer', [
'amount' => 10,
'file' => $this->file,
'currency' => 'USD'
]);
$transaction = Transaction::latest()->first();
$transactionData = [
'meta' => [
'status' => 'confirmed'
],
];

$response = livewire(TransactionResource\Pages\EditTransaction::class, [
'record' => $transaction->getRouteKey()
])
->callAction('approveTransaction', [
'record' => $transaction->getRouteKey(),
'data' => [
'status' => 'confirmed'
]
])
->assertHasNoActionErrors();
});
it('can accepte transaction from client', function () {
actingAs(loginNextJs(), 'api');
$response = postJson('/api/v1/user/deposit-bank-transfer', [
'amount' => 10,
'file' => $this->file,
'currency' => 'USD'
]);
$transaction = Transaction::latest()->first();
$transactionData = [
'meta' => [
'status' => 'confirmed'
],
];

$response = livewire(TransactionResource\Pages\EditTransaction::class, [
'record' => $transaction->getRouteKey()
])
->callAction('approveTransaction', [
'record' => $transaction->getRouteKey(),
'data' => [
'status' => 'confirmed'
]
])
->assertHasNoActionErrors();
});
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server