-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import {DemoPage} from './app.po'; | ||
import {expect, Page, test} from '@playwright/test'; | ||
|
||
test.describe('dpDayPicker dayPicker', () => { | ||
let po: DemoPage; | ||
let page: Page; | ||
|
||
test.beforeAll(async ({browser}) => { | ||
page = await browser.newPage(); | ||
}); | ||
|
||
test.beforeEach(async () => { | ||
po = new DemoPage(page); | ||
await po.navigateTo(); | ||
}); | ||
|
||
test('should check if min date validation is working', async () => { | ||
await po.minDateValidationPickerInput().clear(); | ||
await expect(po.minDateValidationMsg()).toBeHidden(); | ||
await po.setText(po.minDateValidationPickerInput(), '10-04-2017 10:08:07'); | ||
await po.setText(po.daytimePickerInput(), '09-04-2017 10:08:07'); | ||
await po.clickOnBody(); | ||
await expect(await po.minDateValidationMsg().textContent()).toEqual('minDate invalid'); | ||
await po.setText(po.minDateValidationPickerInput(), '08-04-2017 09:08:07'); | ||
await po.clickOnBody(); | ||
await expect(po.minDateValidationMsg()).toBeHidden() | ||
}); | ||
|
||
test('should check if max date validation is working', async () => { | ||
await po.maxDateValidationPickerInput().clear(); | ||
await expect(await po.maxDateValidationMsg()).toBeHidden() | ||
await po.setText(po.maxDateValidationPickerInput(), '12-04-2017 08:08:07'); | ||
await po.setText(po.daytimePickerInput(), '12-04-2017 09:08:07'); | ||
await expect(await po.maxDateValidationMsg().textContent()).toEqual('maxDate invalid'); | ||
await po.setText(po.maxDateValidationPickerInput(), '12-04-2017 09:08:07'); | ||
await expect(await po.maxDateValidationMsg()).toBeHidden() | ||
}); | ||
|
||
test('should check that the min selectable option is working', async () => { | ||
await po.setText(po.minSelectableInput(), '11-04-2017 09:08:07'); | ||
await po.setText(po.daytimePickerInput(), '17-04-2017 09:08:07'); | ||
await po.daytimePickerInput().click(); | ||
await expect(await po.calendarDisabledDays().count()).toBe(16); | ||
await po.setText(po.daytimePickerInput(), '11-04-2017 09:18:07'); | ||
await expect(po.hourDownBtn()).toBeDisabled(); | ||
await expect(po.minuteDownBtn()).not.toBeDisabled(); | ||
await expect(po.meridiemUpBtn()).not.toBeDisabled(); | ||
await expect(po.meridiemDownBtn()).not.toBeDisabled(); | ||
}); | ||
|
||
test('should check that the max selectable option is working', async () => { | ||
await po.setText(po.maxSelectableInput(), '11-04-2017 09:08:07'); | ||
await po.setText(po.daytimePickerInput(), '12-04-2017 09:08:07'); | ||
await po.daytimePickerInput().click(); | ||
expect(await po.calendarDisabledDays().count()).toBe(25); | ||
await po.setText(po.daytimePickerInput(), '11-04-2017 09:06:07'); | ||
await expect(po.hourUpBtn()).toBeDisabled(); | ||
await expect(po.minuteUpBtn()).not.toBeDisabled(); | ||
await expect(po.meridiemUpBtn()).toBeDisabled(); | ||
await expect(po.meridiemDownBtn()).toBeDisabled(); | ||
}); | ||
}); |