Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/LogonTest.php
Show All 15 Lines | class LogonTest extends TestCaseDusk | ||||
/** | /** | ||||
* Test menu on logon page | * Test menu on logon page | ||||
*/ | */ | ||||
public function testLogonMenu(): void | public function testLogonMenu(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit(new Home()) | $browser->visit(new Home()) | ||||
->within(new Menu(), function ($browser) { | ->within(new Menu(), function ($browser) { | ||||
$browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'login', 'lang']) | $browser->assertMenuItems(['signup', 'support', 'login', 'lang']) | ||||
->assertSeeIn('#footer-copyright', \config('app.company.copyright')) | ->assertSeeIn('#footer-copyright', \config('app.company.copyright')) | ||||
->assertSeeIn('#footer-copyright', date('Y')); | ->assertSeeIn('#footer-copyright', date('Y')); | ||||
}); | }); | ||||
if ($browser->isDesktop()) { | if ($browser->isDesktop()) { | ||||
$browser->within(new Menu('footer'), function ($browser) { | $browser->within(new Menu('footer'), function ($browser) { | ||||
$browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'tos', 'login']); | $browser->assertMenuItems(['signup', 'support', 'login']); | ||||
}); | }); | ||||
} else { | } else { | ||||
$browser->assertMissing('#footer-menu .navbar-nav'); | $browser->assertMissing('#footer-menu .navbar-nav'); | ||||
} | } | ||||
$browser->assertSeeLink('Forgot password?') | $browser->assertSeeLink('Forgot password?') | ||||
->assertSeeLink('Webmail'); | ->assertSeeLink('Webmail'); | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | public function testLogonSuccessful(): void | ||||
// Checks if we're really on Dashboard page | // Checks if we're really on Dashboard page | ||||
->on(new Dashboard()) | ->on(new Dashboard()) | ||||
->assertVisible('@links a.link-profile') | ->assertVisible('@links a.link-profile') | ||||
->assertVisible('@links a.link-domains') | ->assertVisible('@links a.link-domains') | ||||
->assertVisible('@links a.link-users') | ->assertVisible('@links a.link-users') | ||||
->assertVisible('@links a.link-wallet') | ->assertVisible('@links a.link-wallet') | ||||
->assertVisible('@links a.link-webmail') | ->assertVisible('@links a.link-webmail') | ||||
->within(new Menu(), function ($browser) { | ->within(new Menu(), function ($browser) { | ||||
$browser->assertMenuItems(['explore', 'blog', 'support', 'dashboard', 'logout', 'lang']); | $browser->assertMenuItems(['support', 'dashboard', 'logout', 'lang']); | ||||
}); | }); | ||||
if ($browser->isDesktop()) { | if ($browser->isDesktop()) { | ||||
$browser->within(new Menu('footer'), function ($browser) { | $browser->within(new Menu('footer'), function ($browser) { | ||||
$browser->assertMenuItems(['explore', 'blog', 'support', 'tos', 'dashboard', 'logout']); | $browser->assertMenuItems(['support', 'dashboard', 'logout']); | ||||
}); | }); | ||||
} else { | } else { | ||||
$browser->assertMissing('#footer-menu .navbar-nav'); | $browser->assertMissing('#footer-menu .navbar-nav'); | ||||
} | } | ||||
$browser->assertUser('john@kolab.org'); | $browser->assertUser('john@kolab.org'); | ||||
// Assert no "Account status" for this account | // Assert no "Account status" for this account | ||||
Show All 30 Lines | public function testLogout(): void | ||||
}); | }); | ||||
// We expect the logon page | // We expect the logon page | ||||
$browser->waitForLocation('/login') | $browser->waitForLocation('/login') | ||||
->on(new Home()); | ->on(new Home()); | ||||
// with default menu | // with default menu | ||||
$browser->within(new Menu(), function ($browser) { | $browser->within(new Menu(), function ($browser) { | ||||
$browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'login', 'lang']); | $browser->assertMenuItems(['signup', 'support', 'login', 'lang']); | ||||
}); | }); | ||||
// Success toast message | // Success toast message | ||||
$browser->assertToast(Toast::TYPE_SUCCESS, 'Successfully logged out'); | $browser->assertToast(Toast::TYPE_SUCCESS, 'Successfully logged out'); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
Show All 10 Lines | public function testLogoutByURL(): void | ||||
// Use /logout url, and expect the logon page | // Use /logout url, and expect the logon page | ||||
$browser->visit('/logout') | $browser->visit('/logout') | ||||
->waitForLocation('/login') | ->waitForLocation('/login') | ||||
->on(new Home()); | ->on(new Home()); | ||||
// with default menu | // with default menu | ||||
$browser->within(new Menu(), function ($browser) { | $browser->within(new Menu(), function ($browser) { | ||||
$browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'login', 'lang']); | $browser->assertMenuItems(['signup', 'support', 'login', 'lang']); | ||||
}); | }); | ||||
// Success toast message | // Success toast message | ||||
$browser->assertToast(Toast::TYPE_SUCCESS, 'Successfully logged out'); | $browser->assertToast(Toast::TYPE_SUCCESS, 'Successfully logged out'); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |