|
| 1 | +import {DemoPage} from '../app.po'; |
| 2 | +import {browser} from 'protractor'; |
| 3 | + |
| 4 | +describe('format changed validation', () => { |
| 5 | + let page: DemoPage; |
| 6 | + |
| 7 | + beforeEach(async () => { |
| 8 | + page = new DemoPage(); |
| 9 | + await page.navigateTo(); |
| 10 | + }); |
| 11 | + |
| 12 | + it('should hide validation on date time picker', async () => { |
| 13 | + await page.daytimePickerMenu.click(); |
| 14 | + await page.setInputValue(page.dateFormatInput, 'DD-MM-YYYY'); |
| 15 | + await page.setInputValue(page.daytimePickerInput, '10-04-2017 09:08:07'); |
| 16 | + await page.clickOnBody(); |
| 17 | + browser.sleep(50000); |
| 18 | + expect(await page.formatValidationMsg.isPresent()).toBeTruthy(); |
| 19 | + await page.setInputValue(page.dateFormatInput, 'DD-MM-YYYY HH:mm:ss'); |
| 20 | + await page.setInputValue(page.daytimePickerInput, '10-04-2017 09:08:07'); |
| 21 | + await page.clickOnBody(); |
| 22 | + expect(await page.formatValidationMsg.isPresent()).toBeFalsy(); |
| 23 | + }); |
| 24 | + |
| 25 | + it('should hide validation on date time directive picker', async () => { |
| 26 | + await page.dayDirectiveReactiveMenu.click(); |
| 27 | + await page.setInputValue(page.dateFormatInput, 'DD-MM'); |
| 28 | + await page.setInputValue(page.dayDirectiveReactiveInput, '10-04-2017'); |
| 29 | + await page.clickOnBody(); |
| 30 | + expect(await page.formatValidationMsg.isPresent()).toBeTruthy(); |
| 31 | + await page.setInputValue(page.dateFormatInput, 'DD-MM-YYYY'); |
| 32 | + await page.setInputValue(page.dayDirectiveReactiveInput, '10-04-2017'); |
| 33 | + await page.clickOnBody(); |
| 34 | + expect(await page.formatValidationMsg.isPresent()).toBeFalsy(); |
| 35 | + }); |
| 36 | + |
| 37 | + it('should hide validation on day picker', async () => { |
| 38 | + await page.dayPickerMenu.click(); |
| 39 | + await page.setInputValue(page.dateFormatInput, 'DD-MM'); |
| 40 | + await page.setInputValue(page.dayPickerInput, '10-04-2017'); |
| 41 | + await page.clickOnBody(); |
| 42 | + expect(await page.formatValidationMsg.isPresent()).toBeTruthy(); |
| 43 | + await page.setInputValue(page.dateFormatInput, 'DD-MM-YYYY'); |
| 44 | + await page.setInputValue(page.dayPickerInput, '10-04-2017'); |
| 45 | + await page.clickOnBody(); |
| 46 | + expect(await page.formatValidationMsg.isPresent()).toBeFalsy(); |
| 47 | + }); |
| 48 | + |
| 49 | + it('should work on time picker picker', async () => { |
| 50 | + await page.timePickerMenu.click(); |
| 51 | + await page.setInputValue(page.dateFormatInput, 'HH'); |
| 52 | + await page.setInputValue(page.timePickerInput, '10:04'); |
| 53 | + await page.clickOnBody(); |
| 54 | + expect(await page.formatValidationMsg.isPresent()).toBeTruthy(); |
| 55 | + await page.setInputValue(page.dateFormatInput, 'HH:mm'); |
| 56 | + await page.timePickerInput.click(); |
| 57 | + await page.clickOnBody(); |
| 58 | + expect(await page.formatValidationMsg.isPresent()).toBeFalsy(); |
| 59 | + }); |
| 60 | + |
| 61 | + it('should hide validation on month picker', async () => { |
| 62 | + await page.monthDirectiveMenu.click(); |
| 63 | + await page.setInputValue(page.dateFormatInput, 'MM'); |
| 64 | + await page.setInputValue(page.monthDirectiveInput, 'Jan'); |
| 65 | + await page.clickOnBody(); |
| 66 | + expect(await page.formatValidationMsg.isPresent()).toBeTruthy(); |
| 67 | + await page.setInputValue(page.dateFormatInput, 'MMM'); |
| 68 | + await page.setInputValue(page.monthDirectiveInput, 'Jan'); |
| 69 | + await page.clickOnBody(); |
| 70 | + expect(await page.formatValidationMsg.isPresent()).toBeFalsy(); |
| 71 | + }); |
| 72 | +}); |
0 commit comments