refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
83
tests/Browser/Feature/UploadVCardTest.php
Normal file
83
tests/Browser/Feature/UploadVCardTest.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Feature;
|
||||
|
||||
use Tests\DuskTestCase;
|
||||
use Tests\Browser\Pages\ImportVCardUpload;
|
||||
|
||||
class UploadVCardTest extends DuskTestCase
|
||||
{
|
||||
/**
|
||||
* Make sure that the Add contact view has the link to the upload screen,
|
||||
* and that the screen contains the blank view.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_upload_vcard_is_accessible_from_add_contact_view()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->login()
|
||||
->visit('/people/add')
|
||||
->assertSee('import your contacts');
|
||||
|
||||
$browser->clickLink('import your contacts')
|
||||
->assertSee('You haven’t imported any contacts yet');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure that the Import button leads to the Import screen, and that
|
||||
* the cancel button leads to the Blank import screen.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_import_button_leads_to_import_screen()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->login()
|
||||
->visit('/settings/import')
|
||||
->clickLink('Import vCard')
|
||||
->assertPathIs('/settings/import/upload')
|
||||
->clickLink('Cancel')
|
||||
->assertPathIs('/settings/import');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a single contact from a valid vcard file.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_user_can_import_contacts_from_a_vcf_card()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->login()
|
||||
->visit('/settings/import')
|
||||
->clickLink('Import vCard')
|
||||
->attach('vcard', base_path('tests/stubs/single_vcard_stub.vcard'))
|
||||
->on(new ImportVCardUpload)
|
||||
->scrollTo('upload')
|
||||
->press('Upload')
|
||||
->assertSee('1 imported');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a contact from a broken vCard and see that it triggers an error.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_user_see_error_when_importing_broken_vcard()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->login()
|
||||
->visit('/settings/import')
|
||||
->clickLink('Import vCard')
|
||||
->attach('vcard', base_path('tests/stubs/broken_vcard_stub.vcard'))
|
||||
->on(new ImportVCardUpload)
|
||||
->scrollTo('upload')
|
||||
->press('Upload')
|
||||
->assertSee('The vcard must be a file of type: vcf, vcard.');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user