1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

(v2): Client tests & more after-installing fixes (#2984)

* client/* testings and ignoring stuff

* Client testings and ignoring

* Revmoe debugbar gitignore
This commit is contained in:
Benjamin Beganović 2019-10-12 13:08:44 +02:00 committed by David Bomba
parent 0503dd525c
commit 8de17e4b5b
4 changed files with 205 additions and 51 deletions

View File

@ -1,29 +0,0 @@
APP_ENV=local
APP_DEBUG=true
APP_LOCALE=en
APP_URL=http://127.0.0.1:8000
APP_KEY=s7epnjtomsdond5zgfqgaqmwhhcjct02
APP_CIPHER=AES-256-CBC
REQUIRE_HTTPS=false
NINJA_ENVIRONMENT=hosted
DB_TYPE=mysql
DB_STRICT=false
DB_HOST=localhost
DB_USERNAME=ninja
DB_PASSWORD=ninja
DB_CONNECTION=db-ninja-01
DB_DATABASE1=db-ninja-01
DB_DATABASE2=db-ninja-02
MAIL_DRIVER=log
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_HOST=
MAIL_USERNAME=
MAIL_FROM_NAME=
MAIL_FROM_ADDRESS=
MAIL_PASSWORD=
MAILGUN_DOMAIN=
MAILGUN_SECRET=
AUTH_PROVIDER=users

4
.gitignore vendored
View File

@ -18,4 +18,6 @@ yarn-error.log
/public/vendor
/public/logo
.env.dusk.local
.env.dusk.local
/public/vendors/*
public/mix-manifest.json

View File

@ -1,21 +0,0 @@
{
"/vendors/css/coreui.min.css": "/vendors/css/coreui.min.css?id=cc8e626c1902d53ee805",
"/vendors/css/coreui-icons.min.css": "/vendors/css/coreui-icons.min.css?id=23447e24a210c12e4559",
"/vendors/css/bootstrap.min.css": "/vendors/css/bootstrap.min.css?id=6f27def50398084c3b22",
"/vendors/css/font-awesome.min.css": "/vendors/css/font-awesome.min.css?id=269550530cc127b6aa5a",
"/vendors/js/coreui.min.js": "/vendors/js/coreui.min.js?id=0fa9ac379e62c48d26e6",
"/vendors/js/bootstrap.bundle.min.js": "/vendors/js/bootstrap.bundle.min.js?id=a454220fc07088bf1fdd",
"/vendors/js/jquery.min.js": "/vendors/js/jquery.min.js?id=220afd743d9e9643852e",
"/vendors/js/perfect-scrollbar.min.js": "/vendors/js/perfect-scrollbar.min.js?id=4a10bcfa0a9c9fa9d503",
"/vendors/js/jSignature.min.js": "/vendors/js/jSignature.min.js?id=4dc38fc88461b30ab711",
"/vendors/js/flashcanvas.min.js": "/vendors/js/flashcanvas.min.js?id=50f6e0a09e8a939c1da9",
"/vendors/js/flashcanvas.swf": "/vendors/js/flashcanvas.swf?id=d1a52ac12da100808048",
"/vendors/css/select2.min.css": "/vendors/css/select2.min.css?id=9f54e6414f87e0d14b9e",
"/vendors/js/select2.min.js": "/vendors/js/select2.min.js?id=708724c21c5073e9e228",
"/vendors/css/select2-bootstrap4.css": "/vendors/css/select2-bootstrap4.css?id=85167d868d2bf2dc5603",
"/vendors/css/dropzone.min.css": "/vendors/css/dropzone.min.css?id=2f735dbf472afcd77604",
"/vendors/css/dropzone-basic.min.css": "/vendors/css/dropzone-basic.min.css?id=960bcd6d5cb8351ac0d0",
"/vendors/js/dropzone.min.js": "/vendors/js/dropzone.min.js?id=33148c7d5e055ea74714",
"/vendors/css/sweetalert.css": "/vendors/css/sweetalert.css?id=0862d17907b9cc4e4374",
"/vendors/js/sweetalert.min.js": "/vendors/js/sweetalert.min.js?id=0e2613ca4d17a624d7e9"
}

View File

@ -117,4 +117,206 @@ class ClientPortalTest extends DuskTestCase
}
/**
* Testing sidebar pages availability.
*
* @return void
*/
public function testDashboardElements(): void
{
$this->browse(function ($browser) {
$browser->visit('/client/login')
->type('email', 'user@example.com')
->type('password', config('ninja.testvars.password'))
->press('Login')
->assertPathIs('/client/dashboard');
$browser->visit('/client/dashboard')
->assertSee(strtoupper(ctrans('texts.total_invoiced')))
->assertSee(strtoupper(ctrans('texts.paid_to_date')))
->assertSee(strtoupper(ctrans('texts.open_balance')))
->assertSee(ctrans('texts.client_information'))
->assertSee(\App\Models\Client::first()->name)
->visit('client/logout')
->assertPathIs('/client/login');
});
}
/**
* Test list of invoices.
*
* @return void
*/
public function testInvoicesElements(): void
{
$this->browse(function ($browser) {
$browser->visit('/client/login')
->type('email', 'user@example.com')
->type('password', config('ninja.testvars.password'))
->press('Login')
->assertPathIs('/client/dashboard');
$browser->visit('/client/invoices')
->assertSee(ctrans('texts.pay_now'))
->waitFor('.dataTable')
->assertVisible('.page-link')
->assertVisible('tr.odd')
->assertVisible('#datatable_info')
->assertMissing('.dataTables_empty')
->visit('client/logout')
->assertPathIs('/client/login');
});
}
/**
* Testing recurring invoices list.
*
* @return void
*/
public function testRecurringInvoicesElements(): void
{
$this->browse(function ($browser) {
$browser->visit('/client/login')
->type('email', 'user@example.com')
->type('password', config('ninja.testvars.password'))
->press('Login')
->assertPathIs('/client/dashboard');
$browser->visit('/client/recurring_invoices')
->waitFor('.dataTable')
->assertVisible('.page-link')
->assertVisible('#datatable_info')
->visit('client/logout')
->assertPathIs('/client/login');
});
}
/**
* List of payments.
*
* @return void
*/
public function testPaymentsElements(): void
{
$this->browse(function ($browser) {
$browser->visit('/client/login')
->type('email', 'user@example.com')
->type('password', config('ninja.testvars.password'))
->press('Login')
->assertPathIs('/client/dashboard');
$browser->visit('/client/payments')
->waitFor('.dataTable')
->assertVisible('#datatable_info')
->visit('client/logout')
->assertPathIs('/client/login');
});
}
/**
* List of payment methods.
*
* @return void
*/
public function testPaymentMethodsElements(): void
{
$this->browse(function ($browser) {
$browser->visit('/client/login')
->type('email', 'user@example.com')
->type('password', config('ninja.testvars.password'))
->press('Login')
->assertPathIs('/client/dashboard');
$browser->visit('/client/payment_methods')
->waitFor('.dataTable')
->assertVisible('#datatable_info')
->assertVisible('.dataTables_empty')
->visit('client/logout')
->assertPathIs('/client/login');
});
}
public function testProfilePageContactUpdate(): void
{
$faker = \Faker\Factory::create();
$this->browse(function ($browser) use ($faker) {
$browser->visit('/client/login')
->type('email', 'user@example.com')
->type('password', config('ninja.testvars.password'))
->press('Login')
->assertPathIs('/client/dashboard');
$client_contact = ClientContact::where('email', 'user@example.com')->first();
$browser->maximize();
$browser->visit(sprintf('/client/profile/%s/edit', $client_contact->client->user->hashed_id))
->assertSee(ctrans('texts.details'));
$first_name = $browser->value('#first_name');
$browser->value('#first_name', $faker->firstName);
$browser->assertSee(ctrans('texts.save'))
->press(ctrans('texts.save'));
$this->assertNotEquals($first_name, $browser->value('#first_name'));
$browser->visit('client/logout')
->assertPathIs('/client/login');
});
}
/**
* Test 'profile page' updating functions.
*
* @return void
*/
public function testProfilePageClientUpdate(): void
{
$faker = \Faker\Factory::create();
$this->browse(function ($browser) use ($faker) {
$browser->visit('/client/login')
->type('email', 'user@example.com')
->type('password', config('ninja.testvars.password'))
->press('Login')
->assertPathIs('/client/dashboard');
$client_contact = ClientContact::where('email', 'user@example.com')->first();
$browser->visit(sprintf('/client/profile/%s/edit', $client_contact->client->user->hashed_id))
->assertSee(ctrans('texts.client_information'));
$browser->driver->executeScript('window.scrollTo(0, document.body.scrollHeight)');
$browser->value('#name', '')
->assertVisible('#update_settings > .card > .card-body > button')
->click('#update_settings > .card > .card-body > button')
->assertVisible('.invalid-feedback');
$name = $browser->value('#name');
$browser->maximize();
$browser->driver->executeScript('window.scrollTo(0, document.body.scrollHeight)');
$browser->value('#name', $faker->name)
->assertVisible('#update_settings > .card > .card-body > button')
->click('#update_settings > .card > .card-body > button');
$this->assertNotEquals($name, $browser->value('#name'));
$browser->driver->executeScript('window.scrollTo(0, document.body.scrollHeight)');
});
}
}