Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Reseller/LogonTest.php
Show All 22 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()) | ||||
->with(new Menu(), function ($browser) { | ->with(new Menu(), function ($browser) { | ||||
$browser->assertMenuItems(['explore', 'blog', 'support', 'login', 'lang']); | $browser->assertMenuItems(['support', 'login', 'lang']); | ||||
}) | }) | ||||
->assertMissing('@second-factor-input') | ->assertMissing('@second-factor-input') | ||||
->assertMissing('@forgot-password'); | ->assertMissing('@forgot-password'); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test redirect to /login if user is unauthenticated | * Test redirect to /login if user is unauthenticated | ||||
Show All 31 Lines | class LogonTest extends TestCaseDusk | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit(new Home()) | $browser->visit(new Home()) | ||||
->submitLogon('reseller@' . \config('app.domain'), \App\Utils::generatePassphrase(), true); | ->submitLogon('reseller@' . \config('app.domain'), \App\Utils::generatePassphrase(), true); | ||||
// Checks if we're really on Dashboard page | // Checks if we're really on Dashboard page | ||||
$browser->on(new Dashboard()) | $browser->on(new Dashboard()) | ||||
->within(new Menu(), function ($browser) { | ->within(new Menu(), function ($browser) { | ||||
$browser->assertMenuItems(['explore', 'blog', 'support', 'dashboard', 'logout', 'lang']); | $browser->assertMenuItems(['support', 'dashboard', 'logout', 'lang']); | ||||
}) | }) | ||||
->assertUser('reseller@' . \config('app.domain')); | ->assertUser('reseller@' . \config('app.domain')); | ||||
// Test that visiting '/' with logged in user does not open logon form | // Test that visiting '/' with logged in user does not open logon form | ||||
// but "redirects" to the dashboard | // but "redirects" to the dashboard | ||||
$browser->visit('/')->on(new Dashboard()); | $browser->visit('/')->on(new Dashboard()); | ||||
}); | }); | ||||
} | } | ||||
Show All 14 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(['explore', 'blog', 'support', 'login', 'lang']); | $browser->assertMenuItems(['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(['explore', 'blog', 'support', 'login', 'lang']); | $browser->assertMenuItems(['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'); | ||||
}); | }); | ||||
} | } | ||||
} | } |