I have been trying to make my protractor test on a datepicker work. I have the following in my html file
<div fxFlex>
<mat-datepicker #pickerBirthdate></mat-datepicker>
<input matInput
style="visibility: hidden;"
[min]="minBirthdate"
[max]="maxBirthdate"
[matDatepicker]="pickerBirthdate"
placeholder="Fecha de nacimiento"
[(ngModel)]="registry.data.fechaNac"
name="fechaNac">
</div>
And the following on my spec file
expect(page.getElementByClass('.date-select-picker'));
// get today's date
let today: any = new Date();
let dd: any = today.getDate();
let mm: any = today.getMonth() + 1; // January is 0!
const yyyy = today.getFullYear();
if (dd < 10) {
dd = '0' + dd;
}
if ( mm < 10) {
mm = '0' + mm;
}
today = mm + '/' + dd + '/' + yyyy;
page.sleep();
page.getElementByClass('.date-select-picker').sendKeys(today);`
The problem is, it doesn't show up any date it just looks raised.
I've read this threads but I haven't been able to make it work, I don't know if it's due to my angular version.
- How to test a Angular js date picker from Protractor
- https://github.com/angular/material/issues/10404
Thanks in advance and good day