From b3ee566ceec58a47b89993aa4451ddc98b5c3c6a Mon Sep 17 00:00:00 2001 From: Vlad Ioffe Date: Sat, 9 Dec 2023 21:40:24 +0200 Subject: [PATCH] playwrite 11 --- tests/format-validation-e2e.spec.ts | 38 ++++++++++++++++++++++++++ tests/hide-input-container-e2e.spec.ts | 22 +++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tests/format-validation-e2e.spec.ts create mode 100644 tests/hide-input-container-e2e.spec.ts diff --git a/tests/format-validation-e2e.spec.ts b/tests/format-validation-e2e.spec.ts new file mode 100644 index 00000000..6ec60046 --- /dev/null +++ b/tests/format-validation-e2e.spec.ts @@ -0,0 +1,38 @@ +import {DemoPage} from './app.po'; +import {expect, Locator, Page, test} from '@playwright/test'; + +test.describe('format validation', () => { + 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 that the format validation is working', async () => { + const common = async (menu: Locator, input: Locator) => { + await menu.click(); + await input.click(); + await input.clear(); + await po.setText(input, 'lmaldlad'); + await po.clickOnBody(); + + expect(await po.formatValidationMsg().textContent()).toBe('invalid format'); + await input.clear(); + }; + + await common(po.daytimePickerMenu(), po.daytimePickerInput()); + await common(po.daytimeDirectiveMenu(), po.daytimeDirectiveInput()); + await common(po.dayPickerMenu(), po.dayPickerInput()); + await common(po.dayDirectiveMenu(), po.dayDirectiveInput()); + await common(po.monthPickerMenu(), po.monthPickerInput()); + await common(po.monthDirectiveMenu(), po.monthDirectiveInput()); + await common(po.timePickerMenu(), po.timePickerInput()); + await common(po.timeDirectiveMenu(), po.timeSelectDirectiveInput()); + }); +}); diff --git a/tests/hide-input-container-e2e.spec.ts b/tests/hide-input-container-e2e.spec.ts new file mode 100644 index 00000000..58d0ff8c --- /dev/null +++ b/tests/hide-input-container-e2e.spec.ts @@ -0,0 +1,22 @@ +import {DemoPage} from './app.po'; +import {expect, Locator, Page, test} from '@playwright/test'; + +test.describe('hideInputContainer', () => { + 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 hide/show InputContainer datetimepicker', async () => { + await expect(po.daytimePickerInput()).toBeVisible(); + await po.hideInputRadio().click(); + await expect(po.daytimePickerInput()).toBeHidden(); + }); +});