2021-07-02 16:36:53 +02:00
|
|
|
<?php
|
|
|
|
|
2021-07-05 11:17:50 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
|
|
*/
|
|
|
|
|
2021-07-02 16:36:53 +02:00
|
|
|
namespace Tests\Browser\ClientPortal;
|
|
|
|
|
|
|
|
use Laravel\Dusk\Browser;
|
|
|
|
use Tests\Browser\Pages\ClientPortal\Login;
|
|
|
|
use Tests\DuskTestCase;
|
|
|
|
|
|
|
|
class InvoicesTest extends DuskTestCase
|
|
|
|
{
|
|
|
|
protected function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
foreach (static::$browsers as $browser) {
|
|
|
|
$browser->driver->manage()->deleteAllCookies();
|
|
|
|
}
|
2021-07-05 10:17:01 +02:00
|
|
|
|
|
|
|
$this->browse(function (Browser $browser) {
|
|
|
|
$browser
|
|
|
|
->visit(new Login())
|
|
|
|
->auth();
|
|
|
|
});
|
2021-07-02 16:36:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testPageLoads()
|
|
|
|
{
|
|
|
|
$this->browse(function (Browser $browser) {
|
2021-07-05 10:04:11 +02:00
|
|
|
$browser
|
|
|
|
->visitRoute('client.invoices.index')
|
2021-07-05 10:17:01 +02:00
|
|
|
->assertSee('Invoices')
|
|
|
|
->visitRoute('client.logout');
|
2021-07-05 10:04:11 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testClickingPayNowWithoutInvoices()
|
|
|
|
{
|
|
|
|
$this->browse(function (Browser $browser) {
|
|
|
|
$browser
|
|
|
|
->visitRoute('client.invoices.index')
|
|
|
|
->press('Pay Now')
|
2021-07-05 10:17:01 +02:00
|
|
|
->assertSee('No payable invoices selected. Make sure you are not trying to pay draft invoice or invoice with zero balance due.')
|
|
|
|
->visitRoute('client.logout');
|
2021-07-02 16:36:53 +02:00
|
|
|
});
|
|
|
|
}
|
2021-07-05 10:05:03 +02:00
|
|
|
|
|
|
|
public function testClickingDownloadWithoutInvoices()
|
|
|
|
{
|
|
|
|
$this->browse(function (Browser $browser) {
|
|
|
|
$browser
|
|
|
|
->visitRoute('client.invoices.index')
|
|
|
|
->press('Download')
|
2021-07-05 10:17:01 +02:00
|
|
|
->assertSee('No items selected.')
|
|
|
|
->visitRoute('client.logout');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testCheckingInvoiceAndClickingPayNow()
|
|
|
|
{
|
|
|
|
$this->browse(function (Browser $browser) {
|
|
|
|
$browser
|
|
|
|
->visitRoute('client.invoices.index')
|
|
|
|
->check('.form-check.form-check-child')
|
|
|
|
->press('Pay Now')
|
|
|
|
->assertPathIs('/client/invoices/payment')
|
|
|
|
->visitRoute('client.logout');
|
2021-07-05 10:05:03 +02:00
|
|
|
});
|
|
|
|
}
|
2021-07-02 16:36:53 +02:00
|
|
|
}
|