Skip to content

Commit

Permalink
playwright 3
Browse files Browse the repository at this point in the history
  • Loading branch information
vlio20 committed Dec 9, 2023
1 parent f0082fc commit 6ceff09
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/daypicker-e2e.spec.ts
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();
});
});

0 comments on commit 6ceff09

Please sign in to comment.