1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +01:00
invoiceninja/tests/Browser/ClientPortal/QuotesTest.php

85 lines
2.4 KiB
PHP
Raw Normal View History

2021-07-02 16:53:21 +02:00
<?php
/**
* 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:53:21 +02:00
namespace Tests\Browser\ClientPortal;
use App\Models\Quote;
2021-07-02 16:53:21 +02:00
use Laravel\Dusk\Browser;
use Tests\Browser\Pages\ClientPortal\Login;
use Tests\DuskTestCase;
class QuotesTest extends DuskTestCase
{
protected function setUp(): void
{
parent::setUp();
foreach (static::$browsers as $browser) {
$browser->driver->manage()->deleteAllCookies();
}
2021-07-05 10:29:52 +02:00
$this->browse(function (Browser $browser) {
$browser
->visit(new Login())
->auth();
});
2021-07-02 16:53:21 +02:00
}
public function testPageLoads()
{
$this->browse(function (Browser $browser) {
$browser
->visitRoute('client.quotes.index')
2021-07-05 14:25:24 +02:00
->assertSeeIn('span[data-ref="meta-title"]', 'Quotes')
2021-07-05 10:29:52 +02:00
->visitRoute('client.logout');
2021-07-02 16:53:21 +02:00
});
}
2021-07-05 13:57:28 +02:00
public function testClickingApproveWithoutQuotesDoesntWork()
{
$this->browse(function (Browser $browser) {
$browser
->visitRoute('client.quotes.index')
->press('Approve')
->assertPathIs('/client/quotes');
});
}
2021-07-05 13:57:28 +02:00
public function testApprovingQuotes()
{
$this->browse(function (Browser $browser) {
$browser
->visitRoute('client.quotes.index')
->check('.form-check.form-check-child')
->press('Approve')
->assertPathIs('/client/quotes/approve')
->press('Approve')
->assertPathIs('/client/quotes')
->assertSee('Quote(s) approved successfully.')
->visitRoute('client.logout');
});
}
public function testQuotesWithSentStatusCanOnlyBeApproved()
{
$this->browse(function (Browser $browser) {
$browser
->visitRoute('client.quotes.index')
->check('.form-check.form-check-child')
->press('Approve')
->assertPathIs('/client/quotes')
->assertDontSee('Quote(s) approved successfully.')
->visitRoute('client.logout');
});
}
2021-07-02 16:53:21 +02:00
}