lundi 5 novembre 2018

How to test datepicker in non-angular website using Protractor

Help, please,to correctly write a test of datepicker. I have an unclickable field where my selected date will be set:

<input type="text" class="submit hasDatepicker" placeholder="License Expiry Date*" 
name="website_field[bGl==]" 
id="website_field_bGl" value="" size="16" 
readonly="readonly">

with clickable button that opens a date-form:

<img class="ui-datepicker-trigger" src="images/calendar.png" alt="Select date" 
title="Select date">

month:

<select class="ui-datepicker-month" data-handler="selectMonth" data- 
event="change"><option value="0">Jan</option></select> ...

year:

<select class="ui-datepicker-year" data-handler="selectYear" data- 
event="change"><option value="2000">2000</option></select> ...

and a script:

                    $(function(){
                        $( "#website_field_bGljZW5zZSBleHBpcnkgZGF0ZQ" 
).datepicker({
                            changeMonth: true,
                            changeYear: true,
                            firstDay:1,
                            dateFormat: "yy-mm-dd",
                            showOn: "button",
                            buttonImage: "images/calendar.png",
                            buttonImageOnly: true,
                            buttonText: "Select date",
                            minDate: "2000-01-01",
                            yearRange: "2000:+15"
                        }).attr("readonly", "readonly");
                    });

I need to set a date, for example: 2020-07-14.

How to do this? Thanks.

Aucun commentaire:

Enregistrer un commentaire