1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00

Invoices: Test clicking on "Pay Now" with selected invoice

This commit is contained in:
Benjamin Beganović 2021-07-05 10:17:01 +02:00
parent dde0af3fd2
commit 1d1d04ccd1

View File

@ -15,16 +15,21 @@ class InvoicesTest extends DuskTestCase
foreach (static::$browsers as $browser) { foreach (static::$browsers as $browser) {
$browser->driver->manage()->deleteAllCookies(); $browser->driver->manage()->deleteAllCookies();
} }
$this->browse(function (Browser $browser) {
$browser
->visit(new Login())
->auth();
});
} }
public function testPageLoads() public function testPageLoads()
{ {
$this->browse(function (Browser $browser) { $this->browse(function (Browser $browser) {
$browser $browser
->visit(new Login())
->auth()
->visitRoute('client.invoices.index') ->visitRoute('client.invoices.index')
->assertSee('Invoices'); ->assertSee('Invoices')
->visitRoute('client.logout');
}); });
} }
@ -32,11 +37,10 @@ class InvoicesTest extends DuskTestCase
{ {
$this->browse(function (Browser $browser) { $this->browse(function (Browser $browser) {
$browser $browser
->visit(new Login())
->auth()
->visitRoute('client.invoices.index') ->visitRoute('client.invoices.index')
->press('Pay Now') ->press('Pay Now')
->assertSee('No payable invoices selected. Make sure you are not trying to pay draft invoice or invoice with zero balance due.'); ->assertSee('No payable invoices selected. Make sure you are not trying to pay draft invoice or invoice with zero balance due.')
->visitRoute('client.logout');
}); });
} }
@ -44,11 +48,22 @@ class InvoicesTest extends DuskTestCase
{ {
$this->browse(function (Browser $browser) { $this->browse(function (Browser $browser) {
$browser $browser
->visit(new Login())
->auth()
->visitRoute('client.invoices.index') ->visitRoute('client.invoices.index')
->press('Download') ->press('Download')
->assertSee('No items selected.'); ->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');
}); });
} }
} }