108 lines
3 KiB
PHP
108 lines
3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Tests\Browser\Schedule;
|
||
|
|
|
||
|
|
use Laravel\Dusk\Browser;
|
||
|
|
use Tests\DuskTestCase;
|
||
|
|
use Tests\Browser\Pages\SchedulePage;
|
||
|
|
use Tests\Browser\LoginHelpers;
|
||
|
|
|
||
|
|
class SchedulePageTest extends DuskTestCase
|
||
|
|
{
|
||
|
|
use LoginHelpers;
|
||
|
|
|
||
|
|
protected static $schedulePageTestPlanner = null;
|
||
|
|
protected static $schedulePageTestEmail = null;
|
||
|
|
|
||
|
|
protected function setUp(): void
|
||
|
|
{
|
||
|
|
parent::setUp();
|
||
|
|
self::$testPlanner = self::$schedulePageTestPlanner;
|
||
|
|
self::$testEmail = self::$schedulePageTestEmail;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function tearDown(): void
|
||
|
|
{
|
||
|
|
self::$schedulePageTestPlanner = self::$testPlanner;
|
||
|
|
self::$schedulePageTestEmail = self::$testEmail;
|
||
|
|
parent::tearDown();
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testCanAccessSchedulePage(): void
|
||
|
|
{
|
||
|
|
$this->browse(function (Browser $browser) {
|
||
|
|
$this->loginAndGoToSchedule($browser);
|
||
|
|
|
||
|
|
$browser->on(new SchedulePage)
|
||
|
|
->assertSee('SCHEDULE')
|
||
|
|
->assertSee('Generate Schedule');
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testSchedulePageHasMonthNavigation(): void
|
||
|
|
{
|
||
|
|
$this->browse(function (Browser $browser) {
|
||
|
|
$this->loginAndGoToSchedule($browser);
|
||
|
|
|
||
|
|
$browser->on(new SchedulePage)
|
||
|
|
->assertPresent('@previous-month')
|
||
|
|
->assertPresent('@next-month')
|
||
|
|
->assertSee(now()->format('F Y'));
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testCanNavigateToNextMonth(): void
|
||
|
|
{
|
||
|
|
$this->browse(function (Browser $browser) {
|
||
|
|
$this->loginAndGoToSchedule($browser);
|
||
|
|
|
||
|
|
$nextMonth = now()->addMonth();
|
||
|
|
|
||
|
|
$browser->on(new SchedulePage)
|
||
|
|
->goToNextMonth()
|
||
|
|
->assertSee($nextMonth->format('F Y'));
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testCanNavigateToPreviousMonth(): void
|
||
|
|
{
|
||
|
|
$this->browse(function (Browser $browser) {
|
||
|
|
$this->loginAndGoToSchedule($browser);
|
||
|
|
|
||
|
|
$prevMonth = now()->subMonth();
|
||
|
|
|
||
|
|
$browser->on(new SchedulePage)
|
||
|
|
->goToPreviousMonth()
|
||
|
|
->assertSee($prevMonth->format('F Y'));
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testScheduleGeneratorShowsUserSelection(): void
|
||
|
|
{
|
||
|
|
$this->browse(function (Browser $browser) {
|
||
|
|
$this->loginAndGoToSchedule($browser);
|
||
|
|
|
||
|
|
$browser->on(new SchedulePage)
|
||
|
|
->assertSee('Select Users')
|
||
|
|
->assertPresent('@generate-button')
|
||
|
|
->assertPresent('@clear-month-button');
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testCalendarDisplaysDaysOfWeek(): void
|
||
|
|
{
|
||
|
|
$this->browse(function (Browser $browser) {
|
||
|
|
$this->loginAndGoToSchedule($browser);
|
||
|
|
|
||
|
|
$browser->on(new SchedulePage)
|
||
|
|
->assertSee('Mon')
|
||
|
|
->assertSee('Tue')
|
||
|
|
->assertSee('Wed')
|
||
|
|
->assertSee('Thu')
|
||
|
|
->assertSee('Fri')
|
||
|
|
->assertSee('Sat')
|
||
|
|
->assertSee('Sun');
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|