<?php

namespace Tests\Browser;

use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;

class SuratTest extends DuskTestCase
{
    /**
     * A Dusk test example.
     *
     * @return void
     */
    public function testExample()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                    ->assertSee('Bhakti Anindya');
        });
    }

    public function testInputTanggalTidakSesuaiMelihatPesanError()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                    ->type('nisn', '1234567890')
                    ->type('tanggalLahir', '11223344')
                    ->click('#input-submit')
                    ->waitFor('.error', 3)
                    ->assertSee('Kolom tanggal lahir tidak sesuai.');
        });
    }

    public function testInputNISNTidakSesuaiMelihatPesanError()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                    ->type('nisn', '1bcd5fghi0')
                    ->type('tanggalLahir', '20190511')
                    ->click('#input-submit')
                    ->waitFor('.error', 3)
                    ->assertSee('Kolom nisn tidak sesuai.');
        });
    }

    public function testInputDataTidakDitemukanMelihatError()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                    ->type('nisn', '1234567890')
                    ->type('tanggalLahir', '20000529')
                    ->click('#input-submit')
                    ->waitFor('.error', 3)
                    ->assertSee('Siswa tidak ditemukan.');
        });
    }
}
