File: D:/HostingSpaces/MdnDirecteur/hours.komma.cloud/tests/Browser/hoursTest.php
<?php
namespace Tests\Browser;
use App\User;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
class hoursTest extends DuskTestCase
{
public function setUp()
{
Parent::setUp();
$this->browse(function (Browser $browser) {
$browser->loginAs(User::all()->first()->id);
});
}
/**
* @test
* @group Hours
*/
public function bookHours()
{
$this->browse(function (Browser $browser) {
$browser->visit('/hours')
->assertPathIs('/hours')
->click('.selectProject > button')
->click('.bootstrap-select.open > div > ul > li:nth-child(2)')
->waitFor('.project_progress_bar .progress')
->click('.selectSubproject > button')
->click('.bootstrap-select.open > div > ul > li:nth-child(2)')
->waitFor('.subproject_progress_bar .progress')
->type('hours', '0.5')
->waitFor('[data-id="selectTask"]')
->click('[data-id="selectTask"]')
->click('.bootstrap-select.open > div > ul > li:nth-child(2)')
->type('description', 'test uur')
->waitFor('.main-form-submit')
->press('.main-form-submit')
->waitUntil('pageLoaded')
->assertSee("test uur")
->assertSee("0.5");
});
}
/**
* @test
* @group Hours
*/
public function editHour()
{
$this->browse(function (Browser $browser) {
$browser->visit('/hours')
->assertPathIs('/hours')
->click('#dag > table > tbody > tr:nth-child(1) > td:nth-child(1)')
->waitFor('.main-form-submit')
->type('hours', '2.5')
->press('.main-form-submit')
->waitUntil('pageLoaded')
->assertSee("test uur")
->assertSee("2.5");
});
}
/**
* @test
* @group Hours
*/
public function deleteHour()
{
$this->browse(function (Browser $browser) {
$browser->visit('/hours')
->assertPathIs('/hours')
->click('#dag > table > tbody > tr:nth-child(1) > td:nth-child(5) > a.deleteModal')
->whenAvailable('.modal-dialog', function ($modal) {
$modal->assertSee('Zeker weten?')
->press('Verwijderen');
})
->waitUntil('pageLoaded')
->assertDontSee('test uur');
});
}
}