browse(function ($browser) { $browser->go('mail'); if (!$browser->isDesktop()) { $browser->click('.back-sidebar-button'); } // Folders list $browser->whenAvailable('#mailboxlist', function ($browser) { $browser->assertVisible('li.mailbox.archive') ->assertMissing('li.mailbox.archive .unreadcount'); }); if (!$browser->isDesktop()) { $browser->click('.back-list-button'); } // Toolbar menu (Archive button inactive) $browser->assertToolbarMenu([], ['archive']); $browser->whenAvailable('#messagelist tbody', function ($browser) { $browser->ctrlClick('tr:last-child'); }); $browser->clickToolbarMenuItem('archive') ->waitForMessage('confirmation', 'Successfully archived') ->closeMessage('confirmation'); if (!$browser->isDesktop()) { $browser->click('.back-sidebar-button'); } // Folders list $browser->whenAvailable('#mailboxlist', function ($browser) { $browser->assertSeeIn('li.mailbox.archive .unreadcount', '1') ->click('li.mailbox.archive') ->waitUntilNotBusy(); }); // Messages list contains the moved message $browser->assertElementsCount('#messagelist tbody tr', 1); // Toolbar menu (Archive button inactive again) $browser->assertToolbarMenu([], ['archive']); // Test archive class on folder in folder selector $browser->ctrlClick('#messagelist tbody tr') ->clickToolbarMenuItem('more') ->with(new Popupmenu('message-menu'), function ($browser) { $browser->clickMenuItem('move'); }) ->with(new Popupmenu('folder-selector'), function ($browser) { $browser->assertVisible('li.archive') ->assertSeeIn('li.archive', 'Archive'); }) ->click(); // close menus }); } }