Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Reseller/WalletTest.php
Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | public function testHistory(): void | ||||
$this->browse(function (Browser $browser) use ($pages) { | $this->browse(function (Browser $browser) use ($pages) { | ||||
$browser->on(new WalletPage()) | $browser->on(new WalletPage()) | ||||
->assertSeeIn('@nav #tab-history', 'History') | ->assertSeeIn('@nav #tab-history', 'History') | ||||
->click('@nav #tab-history') | ->click('@nav #tab-history') | ||||
->with('@history-tab', function (Browser $browser) use ($pages) { | ->with('@history-tab', function (Browser $browser) use ($pages) { | ||||
$browser->waitUntilMissing('.app-loader') | $browser->waitUntilMissing('.app-loader') | ||||
->assertElementsCount('table tbody tr', 10) | ->assertElementsCount('table tbody tr', 10) | ||||
->assertMissing('table td.email') | ->assertMissing('table td.email') | ||||
->assertSeeIn('#transactions-loader button', 'Load more'); | ->assertSeeIn('.more-loader button', 'Load more'); | ||||
foreach ($pages[0] as $idx => $transaction) { | foreach ($pages[0] as $idx => $transaction) { | ||||
$selector = 'table tbody tr:nth-child(' . ($idx + 1) . ')'; | $selector = 'table tbody tr:nth-child(' . ($idx + 1) . ')'; | ||||
$priceStyle = $transaction->type == Transaction::WALLET_AWARD ? 'text-success' : 'text-danger'; | $priceStyle = $transaction->type == Transaction::WALLET_AWARD ? 'text-success' : 'text-danger'; | ||||
$browser->assertSeeIn("$selector td.description", $transaction->shortDescription()) | $browser->assertSeeIn("$selector td.description", $transaction->shortDescription()) | ||||
->assertMissing("$selector td.selection button") | ->assertMissing("$selector td.selection button") | ||||
->assertVisible("$selector td.price.{$priceStyle}"); | ->assertVisible("$selector td.price.{$priceStyle}"); | ||||
// TODO: Test more transaction details | // TODO: Test more transaction details | ||||
} | } | ||||
// Load the next page | // Load the next page | ||||
$browser->click('#transactions-loader button') | $browser->click('.more-loader button') | ||||
->waitUntilMissing('.app-loader') | ->waitUntilMissing('.app-loader') | ||||
->assertElementsCount('table tbody tr', 12) | ->assertElementsCount('table tbody tr', 12) | ||||
->assertMissing('#transactions-loader button'); | ->assertMissing('.more-loader button'); | ||||
$debitEntry = null; | $debitEntry = null; | ||||
foreach ($pages[1] as $idx => $transaction) { | foreach ($pages[1] as $idx => $transaction) { | ||||
$selector = 'table tbody tr:nth-child(' . ($idx + 1 + 10) . ')'; | $selector = 'table tbody tr:nth-child(' . ($idx + 1 + 10) . ')'; | ||||
$priceStyle = $transaction->type == Transaction::WALLET_CREDIT ? 'text-success' : 'text-danger'; | $priceStyle = $transaction->type == Transaction::WALLET_CREDIT ? 'text-success' : 'text-danger'; | ||||
$browser->assertSeeIn("$selector td.description", $transaction->shortDescription()); | $browser->assertSeeIn("$selector td.description", $transaction->shortDescription()); | ||||
if ($transaction->type == Transaction::WALLET_DEBIT) { | if ($transaction->type == Transaction::WALLET_DEBIT) { | ||||
Show All 9 Lines |