Tests: Add contacts print test

pull/7186/head
Aleksander Machniak 5 years ago
parent 2f20f43cbb
commit b536e18d97

@ -6,10 +6,8 @@ use Tests\Browser\Components\App;
class ContactsTest extends \Tests\Browser\TestCase
{
protected function setUp()
public static function setUpBeforeClass()
{
parent::setUp();
\bootstrap::init_db();
}

@ -4,13 +4,16 @@ namespace Tests\Browser\Contacts;
class ExportTest extends \Tests\Browser\TestCase
{
public static function setUpBeforeClass()
{
\bootstrap::init_db();
}
/**
* Test exporting all contacts
*/
public function testExportAll()
{
\bootstrap::init_db();
$this->browse(function ($browser) {
$browser->go('addressbook');

@ -6,13 +6,16 @@ use Tests\Browser\Components\Popupmenu;
class GroupsTest extends \Tests\Browser\TestCase
{
public static function setUpBeforeClass()
{
\bootstrap::init_db();
}
/**
* Contact groups UI basics
*/
public function testGroups()
{
\bootstrap::init_db();
$this->browse(function ($browser) {
$browser->go('addressbook');

@ -6,13 +6,16 @@ use Tests\Browser\Components\App;
class ImportTest extends \Tests\Browser\TestCase
{
public static function setUpBeforeClass()
{
\bootstrap::init_db();
}
/**
* Test basic elements of contacts import UI
*/
public function testImportUI()
{
\bootstrap::init_db();
$this->browse(function ($browser) {
$browser->go('addressbook');

@ -0,0 +1,52 @@
<?php
namespace Tests\Browser\Contacts;
use Tests\Browser\Components\App;
class PrintTest extends \Tests\Browser\TestCase
{
public static function setUpBeforeClass()
{
\bootstrap::init_db();
}
/**
* Test Print action
*/
public function testPrint()
{
$this->browse(function ($browser) {
$browser->go('addressbook');
$browser->waitFor('#contacts-table tbody tr:first-child')
->ctrlClick('#contacts-table tbody tr:first-child');
list($current_window, $new_window) = $browser->openWindow(function ($browser) {
if ($browser->isPhone()) {
$this->markTestSkipped();
}
$browser->clickToolbarMenuItem('print');
});
$browser->driver->switchTo()->window($new_window);
$browser->with(new App(), function ($browser) {
$browser->assertEnv([
'task' => 'addressbook',
'action' => 'print',
]);
});
$browser->assertVisible('#contactphoto img')
->assertSeeIn('#contacthead .firstname', 'John')
->assertSeeIn('#contacthead .surname', 'Doe')
->assertSeeIn('#contacttabs fieldset:first-child legend', 'Properties')
->assertSeeIn('#contacttabs', 'johndoe@example.org');
$browser->driver->close();
$browser->driver->switchTo()->window($current_window);
});
}
}

@ -113,6 +113,7 @@ class ListTest extends \Tests\Browser\TestCase
}
// Popup menu content
$browser->waitFor('#listselect-menu');
$browser->with('#listselect-menu', function($browser) {
$browser->assertVisible('a.selection:not(.disabled)');
$browser->assertVisible('a.select.all:not(.disabled)');

Loading…
Cancel
Save