Skip to content

Commit

Permalink
playwrite 11
Browse files Browse the repository at this point in the history
  • Loading branch information
vlio20 committed Dec 9, 2023
1 parent 15355b3 commit b3ee566
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/format-validation-e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -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());
});
});
22 changes: 22 additions & 0 deletions tests/hide-input-container-e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
});
});

0 comments on commit b3ee566

Please sign in to comment.