talkhabi / vue3-persian-datetime-picker

A vue plugin to select jalali date and time
162 stars 16 forks source link

Problem working with unit testing #16

Open ali-salavati opened 1 year ago

ali-salavati commented 1 year ago

I use dusk in Laravel for testing. For example, in my vue file to get the date of birth:

<div class="mb-2 col-md-4 col-sm-6">
    <label>تاریخ تولد</label>
    <div class="input-group">
        <input type="text" id="dateOfBirth" class="form-control form-control-sm" autocomplete="off">
        <date-picker v-model="user.date_of_birth" display-format="jYYYY/jMM/jDD"
                convert-numbers custom-input="#dateOfBirth" format="YYYY-MM-DD"
                :max="maxDateOfBirth" view="year"></date-picker>
    </div>
</div>

To test it, I have written:

$browser
            ->press('#dateOfBirth')
            ->assertSourceHas('<div class="vpd-container">')
            ->press('.vpd-addon-list-item')
            ->pause(500)
            ->press('.vpd-addon-list-item')
            ->pause(500)
            ->press('.vpd-day')
            ->press('تایید')
            ->pause(500)
            ->assertDontSee('تایید')
            ;

This code automatically clicks the first year in the list, then the first month and then the first day. In my opinion, instead of using the .vpd-addon-list-item class, each item should have a unique ID, While there is no. That is, if I want to test a specific date and time, it is not possible.

ali-salavati commented 12 months ago

خواهشا این مشکل رو برطرف کنید. کتابخانه‌تون با laravel dusk هماهنگ نیست و نمیشه تست‌های مناسب نوشت.