Tests: Try to fix test that fails on Travis, but not on my setup

pull/6453/head^2
Aleksander Machniak 5 years ago
parent f72054e761
commit cf8277ea3e

@ -48,7 +48,7 @@ class Toolbarmenu extends BaseComponent
/** /**
* Assert toolbar menu state * Assert toolbar menu state
*/ */
public function assertMenuState($browser, $active, $disabled) public function assertMenuState($browser, $active, $disabled = [], $missing = [])
{ {
// On phone the menu is invisible, open it // On phone the menu is invisible, open it
if ($browser->isPhone()) { if ($browser->isPhone()) {
@ -77,6 +77,10 @@ class Toolbarmenu extends BaseComponent
} }
} }
foreach ($missing as $option) {
$browser->assertMissing("a.{$option}");
}
$this->closeMenu($browser); $this->closeMenu($browser);
} }

@ -2,6 +2,8 @@
namespace Tests\Browser\Mail; namespace Tests\Browser\Mail;
use Tests\Browser\Components\Toolbarmenu;
class MailList extends \Tests\Browser\TestCase class MailList extends \Tests\Browser\TestCase
{ {
protected function setUp() protected function setUp()
@ -69,22 +71,20 @@ class MailList extends \Tests\Browser\TestCase
} }
else { // phone else { // phone
// On phones list options are in the toolbar menu // On phones list options are in the toolbar menu
$browser->click('.toolbar-menu-button'); $browser->with(new Toolbarmenu(), function ($browser) {
$active = ['select', 'options'];
$browser->with('#toolbar-menu', function ($browser) { $missing = [];
$browser->assertVisible('a.select:not(.disabled)');
$browser->assertVisible('a.options:not(.disabled)');
$imap = \bootstrap::get_storage(); $imap = \bootstrap::get_storage();
if ($imap->get_threading()) { if ($imap->get_threading()) {
$browser->assertVisible('a.threads:not(.disabled)'); $active[] = 'threads';
} }
else { else {
$browser->assertMissing('a.threads'); $missing[] = 'threads';
} }
});
$browser->closeToolbarMenu(); $browser->assertMenuState($active, [], $missing);
});
} }
}); });
} }
@ -96,8 +96,9 @@ class MailList extends \Tests\Browser\TestCase
{ {
$this->browse(function ($browser) { $this->browse(function ($browser) {
if ($browser->isPhone()) { if ($browser->isPhone()) {
$browser->click('.toolbar-menu-button'); $browser->with(new Toolbarmenu(), function ($browser) {
$browser->click('#toolbar-menu a.select'); $browser->clickMenuItem('select');
});
} }
else if ($browser->isTablet()) { else if ($browser->isTablet()) {
$browser->click('.toolbar-list-button'); $browser->click('.toolbar-list-button');

Loading…
Cancel
Save